Popular Posts

Dec 21, 2016

Solaris tar / gzip / zip / unzip / bzip2 / pbzip2 / p7zip / zcat / gzcat

tar / gzip / zip / unzip / bzip2 / pbzip2 / p7zip / zcat / gzcat

Tricks - .zip file format
1. List or view contents of a .zip file
     unzip -l archive.zip

2. Extract a specific file from a zip file
     unzip file name.zip filename.txt

3. View the content of a file inside a zip file
      unzip -p myarchive.zip filename

4. Extract a specific file content from a zip file to a new file
     unzip -p myarchive.zip filename >file.txt


Tricks - .Z file format
1. Extract or uncompress a .Z file
     uncompress filename.tar.Z


Tricks - .gz file format
1. List the contents of a tar file
     tar -tvf filename.tar

2. List the contents of a tar file



Tricks - .gz file format
1. Extract or uncompress a .gz file
     gunzip filename.tar.gz


Tricks - .tar.gz file format - quick method
1. Extract or uncompress a tar.gz file
     gzcat filename.tar.gz | tar xvf -
     tar -xzf filename.tar.gz

2. List the contents of a tar.gz file
     tar -ztvf file.tar.gz

3. Search for specific files in a .tar.gz file
     tar -tvf my-data.tar.gz 'search-pattern'

4. Create a compress archive
     tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
     tar -czvf testfile.tar.gz /var/tmp/testdir

Tricks - .tar.Z file format - quick method
1. Extract or uncompress a tar.Z file
     zcat filename.tar.Z  | tar xvf -



Tricks - .tar.bz2 file format
1. List the contents of a tar.bz2 file
     tar -jtvf file.tar.bz2

2. Search for specific files in a .tar.bz2 file
     tar -tvf projects.tar.bz2 '*.pl'

No comments:

Post a Comment

Popular Posts