Knowledgebase
How to compress a directory via ssh (Ubuntu 14.04)...???
Posted by -liquid-, 05-04-2015, 01:11 PM | Hello.. i want to compress a directory which has folders..subfolders and files in Ubuntu 14.04.. how i can do this..???
|
Posted by Syslint, 05-04-2015, 01:24 PM | Try tar commad
# tar -czf foo.tgz foo/
or use the zip command
# zip -r foo foo
|
Posted by Srv24x7, 05-05-2015, 10:43 AM | Hi,
It depends on what level of compression you want.
Only Tar, use " tar -cvf file.tar file "
Gzip with tar, use " tar -zcvf file.tar.gz file "
For more compression, use " bzip2 -c file > file.bz2 "
|
Posted by sgtc, 05-05-2015, 05:08 PM | http://unixhelp.ed.ac.uk/CGI/man-cgi?tar
|
Posted by jaijop, 05-06-2015, 06:12 AM | Hello,
You can do it in many ways:
1. Using tar command
tar -cvf filename.tar filename
It will archive the directory and sub-directories(sub folders ) inside it
2. You can compress the archived files using gzip & bzip2
with gzip
gzip filename.tar It will compress the archived directory to 50-60% of its actual size ( the file extension will be like this after compressing filename.tar.gz)
with bzip2
bzip2 filename.tar It will compress the archived directory to 70-80% of its actual size ( the file extension will be like this after compressing filename.tar.bz2)
Also insted of doing archive and compression separately. You can use it in a single step
tar -czvf filename.tar ( for gzip)
tar -cjvf filename.tar ( for bzip2)
You can use gunzip & bunzip2 to uncompressing the files
ie gunzip filename.tar.gz
bunzip2 filename.tar.bz2
Hope this helps you.
Thanks,
Jaijo
Last edited by jaijop; 05-06-2015 at 06:15 AM.
Reason: spell change
|
Posted by dcserverforyou, 05-06-2015, 08:48 AM | open folder ( cd /home/..../folder , and tar -zcvf file.tar.gz file , ) , for download file wget website/file.tar.gz.
|
|
Add to Favourites
Print this Article |
Also Read