Using the tar and unzip commands

linux-penguinYou will often upload and download zipped files to a web server.  This article details how to use tar and the unzip command to compress and decompress archives.


tar

The following command will create a gzipped file of Steven's directory.

$ tar cvzf myzipfile.tar.gz /home/steven
  • c - Creates a new .tar file.
  • v - Shows the file processing verbose.
  • f - File name type.
  • z - Create a gzip archive.

 

unzip

If unzip is not already installed on your system, run the following...

$ sudo apt-get install unzip

Note that depending on your permissible access to the destination directory, you may need to sudo the command as follows...

sudo unzip myfile.zip -d /wherever/you/want/to/extract/to/

 

Thanks for visiting.