Tuesday, July 24, 2018

How to Compress and Extract Files Using the tar Command on Linux





Make tar.gz file
----------------------

tar -czvf db_1.tar.gz db_1

Extract tar.gz file
--------------------

tar -xzvf archive.tar.gz

Make tar file
----------------------

tar -cvf db_1.tar db_1

Extract tar file
--------------------

tar -xvf db_1.tar

See contents under tar file
---------------------------


tar -tvf db_1.tar


-c: Create an archive.
-z: Compress the archive with gzip.
-v: Display progress in the terminal while creating the archive, also known as "verbose" mode. The v is always optional in these commands, but it's helpful.
-f: Allows you to specify the filename of the archive.
-t : Display the contents (file list) of an archive.

No comments:

Post a Comment