Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2013
    Posts
    463

    How to compress a directory via ssh (Ubuntu 14.04)...???

    Hello.. i want to compress a directory which has folders..subfolders and files in Ubuntu 14.04.. how i can do this..???

  2. #2
    Join Date
    Apr 2009
    Location
    inside wht
    Posts
    746
    Try tar commad
    # tar -czf foo.tgz foo/
    or use the zip command

    # zip -r foo foo
    24x7 PROACTIVE SERVER MANAGEMENT | OUTSOURCED WEB HOSTING SUPPORT
    Sales : sales @ syslint.com | Call us : (+91)9447607799 | Are you looking for DevOps Admins ?

  3. #3
    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 "
    www.24x7servermanagement.com
    Server Management, Server Security, Server Monitoring.
    India's Leading Managed Service Provider !! Skype: techs24x7

  4. #4
    Join Date
    Apr 2014
    Posts
    264

  5. #5
    Join Date
    Mar 2015
    Posts
    36
    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

  6. #6
    Join Date
    May 2015
    Posts
    4
    open folder ( cd /home/..../folder , and tar -zcvf file.tar.gz file , ) , for download file wget website/file.tar.gz.

Similar Threads

  1. How to copy large directory via SSH?
    By LP560 in forum Hosting Security and Technology
    Replies: 11
    Last Post: 07-15-2009, 02:13 AM
  2. How to move a file via ssh ?
    By chengaz in forum Hosting Security and Technology
    Replies: 12
    Last Post: 08-08-2008, 10:03 AM
  3. how to rename a folder via SSH ?
    By WWWhost in forum Hosting Security and Technology
    Replies: 3
    Last Post: 02-24-2005, 07:25 AM
  4. How to PROPERLY restart services via ssh
    By Enduro-Maaaan in forum Hosting Security and Technology
    Replies: 4
    Last Post: 07-06-2004, 10:34 AM
  5. How to change (Keyboard) Language via SSH ?
    By JapAniManga.ch in forum Web Hosting Lounge
    Replies: 1
    Last Post: 08-26-2003, 04:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •