Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


linux:shell_commands:tar

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:shell_commands:tar [2019/05/07 13:31] (current)
tplecko created
Line 1: Line 1:
 +====== Tar / Untar ======
 +<code bash>tar -zcvf archive-name.tar.gz directory-name</​code>​
  
 +Where,
 +    *-z : Compress archive using gzip program in Linux or Unix
 +    *-c : Create archive on Linux
 +    *-v : Verbose i.e display progress while creating archive
 +    *-f : Archive File name
 +For example, say you have a directory called /​home/​jerry/​prog and you would like to compress this directory then you can type tar command as follows:
 +<code bash>$ tar -zcvf prog-1-jan-2005.tar.gz /​home/​jerry/​prog</​code>​
 +Above command will create an archive file called prog-1-jan-2005.tar.gz in current directory. If you wish to restore your archive then you need to use the following command (it will extract all files in current directory):
 +<code bash>$ tar -zxvf prog-1-jan-2005.tar.gz</​code>​
 +Where,
 +    *-x: Extract files from given archive
 +If you wish to extract files in particular directory, for example in /tmp then you need to use the following command:
 +<code bash>
 +$ tar -zxvf prog-1-jan-2005.tar.gz -C /tmp
 +$ cd /tmp
 +$ ls - 
 +</​code>​
linux/shell_commands/tar.txt · Last modified: 2019/05/07 13:31 by tplecko