Wednesday, September 1, 2021

Tar + Gzip folder and file

$ tar -zcvf outputFileName folderToCompress

Exam Compress by tar + gzip folder

$ tar -zcvf html.tar.gz /var/www/html/

$ cd /var/www/html

$ tar -zcvf html.tar.gz html

Exam Compress by tar + gzip files

$ tar czf file.tar.gz file

$ tar czf file.tar.gz file1 file2

Exam Compress by tar + gzip files and folder

$ tar -cvf - file1 file2 dir3 | gzip > archive.tar.gz

Exam Extract files gz

$ tar -zxvf prog-1-jan-2005.tar.gz
$ tar -zxvf prog-1-jan-2005.tar.gz -C /tmp

Related

  • https://juuier.blogspot.com/2009/01/command-line.html

Ref

  • https://mkyong.com/linux/linux-how-to-gzip-a-folder/ 
  • https://www.cyberciti.biz/faq/how-do-i-compress-a-whole-linux-or-unix-directory/

No comments:

Post a Comment