Notas de Luis

File - Fu

Con este comando puedo saber las características de un archivo, vídeo o directorio:

Display a numbered list of 50 biggests files sorted by size (human readable)

  du -ah | sort -hr | head -n50 | cat -n

Create a large test file (sparse, taking no space).

  dd bs=1 seek=2TB if=/dev/null of=ext3.test

Untar undo

  tar tfz filename.tgz |xargs rm -Rf

Create a file of a given size in linux

  dd if=/dev/zero of=foo.txt bs=1M count=1
  dd if=/dev/zero of=sparse_file bs=1024 skip=1024 count=1

Find all files with root SUID or SGID executables

  sudo find / -type f \( -perm /4000 -a -user root \) \
      -ls -o \( -perm /2000 -a -group root \) -ls

Find today created files

  find -maxdepth 1 -type f -newermt "00:00" -printf "%f\n" | sort

DELETE all those duplicate files but one based on md5 hash comparision in the current directory tree

  find . -type f -print0|xargs -0 md5sum|sort|\
      perl -ne 'chomp;$ph=$h;($h,$f)=split(/\s+/,$_,2);
                print "$f"."\x00" if ($h eq $ph)'|\
      xargs -0 rm -v --

Start dd and show progress every X seconds

  dd if=/path/to/inputfile of=/path/to/outputfile & pid=$! && \
      sleep X && while kill -USR1 $pid; do sleep X; done
computing/linux/ficheros/file-fu.txt · Última modificación: por 127.0.0.1