Useful shortcuts for vi editor

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 *.txt
- all text files will be tarred in current path (pwd)

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

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

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