tar cheatsheet

Home

1 tar Tape Archive

gunzip XF86-2.1.1-<package>.tar.gz | tar xvfBp -

cd sourcedirectory
tar cvf - . | (cd targetdirectory; tar xfBp - )
      c = create a tar file
      v = verbose
      f = specify a tar filename as 1st argument
      - = the tarfile default output is /dev/rst0 .i.e. tape
          - changes this the <STDOUT> so that it can be piped
      . = archive all files, all subdirectories starting from "this" dir.
      x = extract
      f = specify a tar filename as 1st argument (must be 1st arg.)
      B = write BLOCKS filling in only the space in a Block that
          is used.  Must be used when running with pipes.
      p = preserve owners, permissions
      X = exlude files or directories appearing in filename 
      t = table of contents

To see (list) what is in a file.tar.gz file:

  • zcat file.tar.gz | tar -tvf -

1.1 tar with a password protection

pipe the file to gpg -c after tarring.

gpg -c –o filename.gpg filename so for a tar file:

  • gpg -o mynewtarfile.tgz.gpg --symmetric mynewtarfile.tgz

You will be prompted for a passphrase. To decrypt:

  • gpg mynewtarfile.tgz.gpg

You will again be prompted for a password, obiously it needs to match the password used to create the encyrpted mynewtarfile.tgz.gpg

You can also use crypt: cat filename | crypt > filename.crypt but I have always stuck with gpg.

So all in one step:

tar -cvf - *.org | gpg -c -o myorgfiles.tgz.gpg tar -cvf - *.org | gpg -ea -o myorgfiles.tgz.gpg tar -cvf - *.org | gpg -ea -r zintis -o myorgfiles.tgz.gpg

1.2 Home