File System
List directory tree:
tree -df .
List directory tree with full paths:
find . -type d
List the actual size of each directory/file within a directory:
du -sh */ | sort -n
List all files bigger than 100MB for the entire disk:
du --all --one-file-system / | awk '{if($1 > 102400) print int($1/1024) "MB" " " $2 }'
Encoding
Convert the charset of a file to UTF-8
iconv -f [old-charset] -t utf-8 [old-filepath] > [new-filepath]
Find non-ASCII characters in a text file
Linux:
grep --color='auto' -P -n "[\x80-\xFF]" file.txt
Mac OS X:
brew install pcre
pcregrep --color='auto' -n "[\x80-\xFF]" file.txt
You may need to increase your buffer with --buffer-size=999999999
. – Source
Backups
Download a copy of a directory to a local directory:
rsync --dry-run --archive -vv --stats --progress <source> ~/dev/<destination>
or
rsync -chavzP --stats [email protected]:/path/to/copy /path/to/local/storage