Developer's Daily Unix by Example
  main | java | perl | unix | DevDirectory
   
Main
Unix
Education
Unix by Example
   

 

Command tar
Description The "tar" command stands for tape archive.

This command is used to create new archives, list files in existing archives, and extract files from archives.

The tar command can be used to write archives directly to tape devices, or you can use it to create archive files on disk. In many cases, tar archives are created on disk so it's easier to transport them across networks, such as the Internet.

Note - the tar command does not compress files. Use the compress command to compress the tar archive after you've created it.

Examples tar cvf /dev/rct0 /home

This command writes a tar archive to the tape device /dev/rct0. It copies the files in the /home directory, and all subdirectories of /home to the tape device.

tar cvf /dev/fd0 /home/fred

This command writes a tar archive to the diskette device /dev/fd0. It copies the files in the /home/fred directory, and all subdirectories of /home/fred to the diskette.

tar cvf /tmp/home.tar /home

This command creates a tar archive named /tmp/home.tar. The tar command copies the files in the /home directory, and all subdirectories of /home.

tar cvf /tmp/home.tar /home
compress /tmp/home.tar

This example shows two commands issued in sequence. The first command creates a tar archive named /tmp/home.tar. The second command compresses the tar archive, and replaces it with a new compressed tar archive, named /tmp/home.tar.Z. See the compress command for more details.

 


What's related

copyright 1998-2007, devdaily.com, all rights reserved.
devdaily.com, an alvin j. alexander production.