How to use Tar and Unzip on Linux to compress and decompress files

Tar and Zip are both file compression formats that you’ll encounter. You can use built-in utilities in Linux to compress and decompress / expand these files.

The command for “tar”ring a directory is:

tar -cvf filename.tar ./directory_name/

The command for un”tarring” a file is:

tar -xvf FileName.tar.gz

-c compress – you need this flag if you are compressing a file
-x extract – you need this flag if you are decompressing a file
-v verbose (optional)
-f specify the name of the file – needed

The command for unzipping a file is:

unzip filename.zip


Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top