Creating An Archive & Extracting Files from Archive On Linux Command


tar czvf myfolder.tar.gz abcfolder/

The above command creates an archive file name, myfolder.tar.gz. Everything under the directory abcfolder/ will be compressed and stored.

To compress all the files within a folder:

tar czvf allmyfiles.tar.gz

The above command thus compresses all the files (including subfolders) within the directory and archived it as allmyfiles.tar.gz

Basically, there are various variants you can play around with tar command in Linux. All you need is to type “man tar” o find out more information. So next, let’s extract these files.

Extracting Files from Archive

Extracting is probably quite easy. If you have a .tar.gz file, simply type the command to extract all the files and folders to the current folder you are in.

tar -zxvf extractme.tar.gz

The above command extracts the archive, extractme.tar.gz to your current folder or directory.

So, you see, it’s not really that difficult to use compress and uncompress files and folders in linux via command line. It’s time to throw away some of GUIs.

Sumber:http://www.neohide.com/tar-gz-a-quick-and-easy-compression-and-extraction-command-line

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s