Last active
June 7, 2017 11:58
-
-
Save syammohanmp/2a002cb7fd0f7402f3e36e4dcf6e9ada to your computer and use it in GitHub Desktop.
How do I compress a directory?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you want to create ZIP files using Ubuntu (or almost any other Linux), use zip. You can install it to Ubuntu by running | |
sudo apt-get install zip | |
Then you can create zip file by running | |
zip -r compressed_filename.zip foldername | |
If you want to use "zip" for .zip extentension you can see manual of zip. The commandline for using tar is: | |
tar cvzf tarball.tar.gz directory/ | |
tar -xvzf community_images.tar.gz | |
To explain a little further, tar collected all the files into one package, community_images.tar. The gzip program applied compression, hence the gz extension. So the command does a couple things: | |
f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file. | |
z: tells tar to decompress the archive using gzip | |
x: tar can collect files or extract them. x does the latter. | |
v: makes tar talk a lot. Verbose output shows you all the files being extracted. | |
If you want the files to be extracted to a particular destination you can add -C /destination/path/ | |
Example: | |
tar xf community_images.tar.gz -C /home/emmys/Pictures/Community/ | |
You can easily memorize it if you consider telling tar to e X tract a F ile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment