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

Flags:
-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

Reference:
https://www.interserver.net/tips/kb/use-tar-command-linux-examples/
https://www.cyberciti.biz/faq/howto-compress-expand-gz-files/

Share this article

Leave a Reply

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

Scroll to Top