Created
January 25, 2014 12:13
-
-
Save sangeeths/8615443 to your computer and use it in GitHub Desktop.
Frequently Used Commands - tar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compose a tar file: | |
------------------- | |
tar -cvf file.tar dir1/ | |
tar -zcvf file.tar.gz dir1/ | |
tar -jcvf file.tar.bz2 dir1/ | |
Extract a tar file: | |
------------------- | |
tar -xvf file.tar | |
tar -zxvf file.tar.gz | |
tar -jxvf file.tar.bz2 | |
List the files inside the tar ball without extracting: | |
------------------------------------------------------ | |
tar -tvf file.tar | |
tar -ztvf file.tar.gz | |
tar -jtvf file.tar.bz2 | |
Command Options: | |
---------------- | |
c: Compose | |
x: Extract | |
t: List the contents of an archive | |
v: Verbosely list files processed | |
z: Filter the archive through gzip so that we can open compressed (decompress) .gz tar file | |
j: Filter archive through bzip2, use to decompress .bz2 files. | |
f filename: Use archive file called filename | |
Tips: | |
----- | |
-> Use ‘z’ while compressing/decompressing/listing the file with GZIP. | |
-> Use ‘j’ while compressing/decompressing/listing the file with BZIP2. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment