Wednesday, November 01, 2006

Command of the week: tar

Sorry I haven't gotten back to posting in sometimes. Anyway, this week's command is tar. Tar, course, stands for TApe aRchive. It is used to compress files into an archive. Its basic syntax goes like this:

tar file.tar file1 file2 file3

What to me is amazing about tar is its vast expanse of options. You can dump directly to a disk in a drive (-cvfz) and do many other interesting things with tar. For the most part, some basic tar functions are -x, extract, -c, create (new archive), -f, file (set tarfile name), -u, update, -t, which leaves a table of contents, and -r, replace. Here are some examples:

tar -xf /foo/capio.tar /foo

Extract the contents of capio.tar into the folder foo.

tar -cvfz /dev/rfd0a prog1.c newstuff.vi httpd.conf

Tar takes over the floppy drive (in NetBSD in this case) and directly writes the following three files to the floppy. It can be change to burn a CD, though, I think.

Still, this is only a basic tutorial. For more, try this site - http://www.computerhope.com/unix/utar.htm

xatapu

No comments: