Knowledgebase: How-To
File Compression Info
Posted by on 02 July 2012 12:48 PM

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.

Example Uses

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
    unzip test.zip

  • ## 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

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako fusion
ERROR: This domain name (kb.asmallorange.com), does not match the domain name in the license key file help.asmallorange.com.

For assistance with your license, please contact the Kayako support team: https://support.kayako.com