Debugging

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

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 }'

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 user@remote.host:/path/to/copy /path/to/local/storage

Kickstarter Coming January

I'm launching a board game called Delivery Duck. You're a duck, in a truck, delivering packages. It's a strategic family game for 2 to 6 players.

Check out the board game!