Reference: tar
tar
tar [options]
[files]-Cdir files-Ifile-X
Function Options (choose one)
cr-
Append files to archive.
t-
Table of contents. Print the names of files if they are stored on the archive (if files not specified, print names of all files).
ux
Options
bn-
Be-
Exit immediately upon unexpected errors. Solaris only.
E-
Use an extended header that allows longer filenames, larger files, and other extensions. Not portable. Solaris only.
farchF,FFi-
ksizel-
Print error messages about links that can't be found.
L-
Follow symbolic links. SVR4 only.
mno-
pP-
Do not add a trailing
/to directory names in the archive. Solaris only. v-
Print function letter (
xfor extraction orafor archive) and name of files. Witht, print a listing similar to that ofls -l. w- n[c]
Examples
tar cvf /dev/rmt/0 /bin /usr/bin
tar tvf /dev/rmt/0
Extract the /bin directory:
tar xvf /dev/rmt/0 /bin
Create an archive of the current directory, and store it in a file /tmp/backup.tar on the system. (Backing up a directory into a file in that directory almost never works.)
tar cvf /tmp/backup.tar .
tar cvf - . | compress > /tmp/backup.tar.Z
# cd olddir; tar cf - . | (cd newdir; tar xvpf -)





