Create and extract a .tar.gz archive using command line
To create a tar.gz archive from a given folder you can use the following command
tar -zcvf tar-archive-name.tar.gz source-folder-name
This will compress the contents of source-folder-name to a tar.gz archive named tar-archive-name.tar.gz
To extract a tar.gz compressed archive you can use the following command
tar -zxvf tar-archive-name.tar.gz
This will extract the archive to the folder tar-archive-name.
To Preserve permissions
tar -pcvzf tar-archive-name.tar.gz source-folder-name
Switch the ‘c’ flag to an ‘x’ to extract (uncompress).
tar -pxvzf tar-archive-name.tar.gz
Comments (4)
it doesnt work extract. i tried many ways n pasted that. linux sucks !
Linux does not suck. You should learn how to use it. Just because there is a learning curve does not mean it sucks. If you don’t want to learn then go back to your windows and stop leaving rude comments on Linux blogs.
if you are using a desktop distribution with graphical interface, like Ubuntu desktop edition or Linux mint, you can have a fluent experience for a beginner.
For me, I use command line only with ssh sessions of a linux server.
Thank you Brett! @linusucks “apt-get install unzip” if you don’t have patience. The day you install Windows, your hardware depreciates at least 50% IMHO!