Useful shortcuts for vi editor

Showing posts with label tar. Show all posts
Showing posts with label tar. Show all posts

Friday, 5 June 2015

.tar examples for gzip

e.g.
tar -cvzf mytarfiles.tar myfile1 myfile2
- c, create a new file
- v, verbose (display) file to compress or uncompress
- z, use gzip to zip it
- f, create tar file with filename provided as the argument

e.g.
tar -cvzf mytarnewfiles.tar.gz *.txt
- all text files will be tarred in current path (pwd)

e.g.
lz mytarnewfiles.tar.gz
- lz, list files inside of tar

e.g.
gzip -t mytarnewfiles.tar.gz
- verify the tarball is valid

e.g.
tar -xvzf mytarnewfiles.tar.gz
- x, extract files in the current path (pwd)

e.g.
tar -xvzf mytarnewfiles.tar.gz -C myfiles/
- C, extract files into defined folder as new

Please note that, tar is used to combine numerous files and directories into a single archive without compression but gzip is a compression utility uses for tar files (tarball).