File Compression Info
The commands below are run in Shell (Terminal,) so SSH access, which is enabled on your account by default, is required to use them. In the future this page may include compressing/archiving files using a programming language such as PHP or Ruby.
Getting Dirty with Commands
The commands available on our servers typically include 'zip/unzip', 'tar', 'bzip2/bunzip2', and 'gzip/gunzip'. An impressive array of options!
Within Shell type 'man command' , where command is one of the above. It will explain how to use and display the various options associated with the command. Also, many online resources (tutorials and articles) exist for your reference.
The most common Linux approach is to create .tar.gz files. Using zip is more common for Windows users, and Bzip2 use is increasing. Notice how with tar we are passing options c (create) or x (extract) along with z (gzip), v (verbose), and f (file) into tar. The man page will show additional options and will explain these.
zip a few files and directories, creates test.zip
zip test.zip test.txt images/ phone.txt
unzipping all of the above into the current directory
## gzipping and tarring a directory and file (common method)
tar -czvf archive.tar.gz files/ hello.pdf
## ungzipping/untarring the same file
tar -xzvf archive.tar.gz
## viewing the contents of a .tar.gz file
tar -tzvf archive.tar.gz