Wednesday, March 3, 2021

How to Compress and Extract Files in Linux Using tar Command.

Use the following command to compress an entire directory or a single file on linux it will also compress every other directory inside a directory you specify in other words, it works recursively.


Step 1

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

 

Step 2     

        Let's say you have a directory named "mydir" in the current directory and you want to save it to a file named archive.tar.gz. You would run the following command.

tar -czvf archive.tar.gz stuff

 

Step 3

        Or, let's say there's a directory at "/usr/local/something" on the current system and you want to compress it to a file named archive.tar.gz. You'd run the following command.

 
tar -czvf archive.tar.gz /usr/local/something

 

That's it. hmm.


No comments:

Post a Comment

SEO 2021 - Learn White Hat SEO to Make Your Site Rank Higher.

SEO 2021 - Learn White Hat SEO to Make Your Site Rank Higher.      Description: Find out information on how to rank better on Google in 2021...