Results 1 to 3 of 3

Thread: Command line tar command with compression

  1. #1
    Join Date
    Jan 2007
    Beans
    712

    Command line tar command with compression

    I use the following command line to put everything in the D folder into a tar file in the backup folder.

    sudo tar -cf /home/backup/D_backup$(date +"%Y%m%d").tar /home/D

    However the backup file is the same size as the original folder. How do I compress it, doing something like a zip file in windows. I would like to do this from the command line.

    Also, is there a way to encrypt it from the command line?

  2. #2
    Join Date
    Jan 2006
    Location
    Leuven, Belgium
    Beans
    3,414

    Re: Command line tar command with compression

    For .tar.gz:
    Code:
    sudo tar -czf /home/backup/D_backup$(date +"%Y%m%d").tar.gz /home/D
    For .tar.bz2 (higher compression, takes longer):
    Code:
    sudo tar -cjf /home/backup/D_backup$(date +"%Y%m%d").tar.bz2 /home/D
    You might want to read up on gpg for the encryption.

  3. #3
    Join Date
    Sep 2007
    Location
    010101010101001101000001
    Beans
    858
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Command line tar command with compression

    Quote Originally Posted by Ramses de Norre View Post
    For .tar.gz:
    Code:
    sudo tar -czf /home/backup/D_backup$(date +"%Y%m%d").tar.gz /home/D
    For .tar.bz2 (higher compression, takes longer):
    Code:
    sudo tar -cjf /home/backup/D_backup$(date +"%Y%m%d").tar.bz2 /home/D
    You might want to read up on gpg for the encryption.
    cool... I was looking for a script or command by date

Bookmarks

Posting Permissions

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