I'll keep it updated when I find more.
Some of this snippets would do nice if used as aliases ^^
Show the disk usage of the files and directories, sorted by size (useful when cleaning the disk)
du -ms * | sort -nr | $PAGERIf you want it to show all the files in the directory tree...
du -m * | sort -nr | $PAGERSearch all the coincidences of a regular expression (POSIX) recursively in all the files and display the line and context where they were found.
grep --color -nIHr . -e REGULAR_EXPRESSIONExcluding backups, hidden files/directories (beware of excluding "." and ".."), etc...
grep --color --exclude=*[~#] --exclude-dir=.??* -nIHr . -e REGULAR_EXPRESSIONSearch and replace a string of text in all the files of a directory tree recursively...
find . -type f -exec sed -i 's/STRING1/STRING2/' {} \;Archive all the files that haven't been modified within the last 60 days
find . -type f -mtime +60 | xargs tar -cvf `date '+%d%m%Y'_archive.tar`Create a patch for all the changes between two directories.
diff -urNp OLD_DIRECORY NEW_DIRECTORY > file.patchDownload all the files ending with "PREFIX" found recursively (through 10 levels) from www.example.com
wget -r -l 10 -A PREFIX http://www.example.com/
No hay comentarios:
Publicar un comentario