Basic Linux Tutorial
Computer Tutorial

Offline File Storage Commands



Offline File Storage Commands

The tar Command

The tar command archives the tape file. It saves and restores files onto magnetic tape. Its function is controlled by its first argument called the key argument.

Synopsis :

$ tar   -key   [f device_file] [file. . .]

Example :

Create an archive:
$ tar   –cv   f /dev/rmt/0m   myfile
Get a table of contents from the archive :
$ tar   -tv   f /dev/rmt/0m
Extract a file from the archive :
$ tar   –xv   f /dev/rmt/0m   myfile

The nohup Command

the nohup command to make commands immune to hanging up and logging off. The nohup command is one of a group of commands which precede another command.

Synopsis :

nohup   command line   &

Example :

nohup   cat *   > bigfile   &
c     A new archive is created.
x     Files are extracted from the archive.
t     A table of contents of the archive is printed.
r     Files are added to the end of the archive.
u     Files are added to the archive if they are new or modified.
v     Echoes filenames to screen as they are archived or restored - verbose.

The cpio Command

This command makes archive copies of files and directories in HP-UX. cpio stands for copy input to output.
cpio has two modes:
-o Make a backup. Read standard input, and copy each file to standard output.
-i Restore a backup. Read standard input for the backup data, and recreate it on the disk.
When creating backups, the cpio -o command uses standard input as its source of file names and standard output as the archive output.
When restoring an archive, the cpio -i command will read the archive from standard input (the tape special device file) and restore the file contents to your disk.
cpio   -o[cvx] Generate an archive.
cpio   -i[cdmtuvx] Restore from an archive.

Example :

Create an archive of all files under current directory :
$ find   |   cpio   -ocv   /dev/rmt/0m
Restore all files from an archive :
$ cpio   -icdmv   <   /dev/rmt/0m