PageList1

Blog Archive

About Me

My Photo
Little student in little place
  • Integer vitae nulla!

    Integer vitae nulla!

    Suspendisse neque tellus, malesuada in, facilisis et, adipiscing sit amet, risus. Sed egestas. Quisque mauris. Duis id ligula. Nunc quis tortor. In hendrerit, quam vitae mattis interdum, turpis augue viverra justo, sed semper sem lorem sed ligula. Curabitur id urna nec risus volutpat ultrices....

  • Suspendisse neque tellus

    Suspendisse neque tellus

    Suspendisse neque tellus, malesuada in, facilisis et, adipiscing sit amet, risus. Sed egestas. Quisque mauris. Duis id ligula. Nunc quis tortor. In hendrerit, quam vitae mattis interdum, turpis augue viverra justo, sed semper sem lorem sed ligula. Curabitur id urna nec risus volutpat ultrices....

  • Curabitur faucibus

    Curabitur faucibus

    Suspendisse neque tellus, malesuada in, facilisis et, adipiscing sit amet, risus. Sed egestas. Quisque mauris. Duis id ligula. Nunc quis tortor. In hendrerit, quam vitae mattis interdum, turpis augue viverra justo, sed semper sem lorem sed ligula. Curabitur id urna nec risus volutpat ultrices....

Friday, November 23, 2007

Compressing File in FreeBSD

See also this Backing up Files with Tar by Dru Lavigne. It covers much more detail than this article does.
tar is used to create a Tape ARchive. The resulting file is known as a tarball. It's pretty much the same concept as a ZIP file, if you know what they are, but without the compression. To get the files out of a tarball, you can use the following commands:

tar xvf something.tar

If the tarball has also been gzipped (compressed), you can use the following command:

tar xvfz something.tar.gz

If you only want certain directories from the tarball, do this:

tar xvzf something.tar.gz */dir.you.want/*

If you have a .tar.bz2 file, then you need bzip2 installed (/usr/ports/archivers/bzip2), and you issue this command:

tar yxf something.tar.bz2


tar
To tar up *.db in the current directory into a tarball called blah.tar.gz, issue this command:

tar cfz blah.tar.gz *.db

The z option compresses.
listing the contents
To see a list of the files within a tarball, issue the following command:

tar -tzf blah.tar.gz

The -t provides a list. the -z indicates that the tarball is compressed. The -f identifies the tarball.

# tar -tzf makeworld.991126.tgz 
etc/
etc/protocols
etc/aliases
etc/services
etc/hosts

1 comments:

Zoe said...
6:36 PM

Interesting to know.