How to Compress and Extract tar.bz2 Files in the Terminal

Quick tip: to create a backup of a directory (like a website) with a .tar.bz2 format, you can compress it like this:

  1. To compress a directory, you can use: tar -cjvf BACKUP_my_directory.tar.bz2 ./www
  2. To extract the tar.bz2 file do: tar -xjf BACKUP_my_directory.tar.bz2