Little Things I Keep Forgetting

Compress a file / directory using tar and bz2:
tar -cjvf filename.tar.bz2 directory

Compress a file / directory using tar and gzip:
tar -czvf filename.tar.gz directory

Uncompress a file / directory using tar and bz2:
tar -xjvf filename.tar.bz2 directory

Uncompress a file / directory using tar and gzip:
tar -xjvf filename.tar.gz directory

Create a patch file:
diff -Nru original.file new.file > file.patch

To apply a patch file:
patch -p1 -E -s -d root directory file.patch