UNIX Shells by Example
Authors: Quigley E.
Published year: 2004
Pages: 390-395/454
Buy this book on amazon.com >>
 <  Day Day Up  >  

tar ”stores and retrieves files from an archive file, normally a tape device

tar [  ] crtux [ bBefFhilmopvwX0134778 ] [ tarfile ]

[ blocksize ] [ excludefile ] [ I includefile ]

filename1 filename2 . . . C directory filenameN ...

Example A.57.
1   tar cvf /dev/diskette

2   tar tvf /dev/fd0

3   tar xvf /dev/fd0

EXPLANATION

  1. Sends all files under the present working directory to tape at device /dev/diskette , and prints the files that are being sent.

  2. Displays the table of contents of what is on tape device /dev/fd0 .

  3. Extracts all files from tape and prints which files were extracted.

 <  Day Day Up  >  
 <  Day Day Up  >  

tee ”replicates the standard output

tee [ ai ] [ filename ]

tee copies the standard input to the standard output and one or more files, as in lstee outfile . Output goes to screen and to outfile .

Example A.58.
date  tee nowfile

EXPLANATION

The output of the date command is displayed on the screen and also stored in nowfile .

 <  Day Day Up  >  
 <  Day Day Up  >  

telnet ”communicates with a remote host

Example A.59.
telnet necom.com

EXPLANATION

Opens a session with the remote host necom.com .

 <  Day Day Up  >  
 <  Day Day Up  >  

test ” evaluates an expression

test evaluates an expression and returns an exit status indicating that the expression is either true (0) or false (not zero). Used primarily by Bourne and Korn shell for string, numeric, and file testing. The C shell has most of the tests built-in.

Example A.60.
1   test 5 gt 6

2   echo $? ( Bourne and Korn shells)

   (Output is 1, meaning the result of the test is not true.)

EXPLANATION

  1. The test command performs an integer test to see if 5 is greater than 6 .

  2. The $? variable contains the exit status of the last command. If a nonzero status is reported , the test results are not true; if the return status is 0, the the test result is true.

 <  Day Day Up  >  
 <  Day Day Up  >  

time ”displays a summary of time used by this shell and its children

 <  Day Day Up  >  
 <  Day Day Up  >  

timex ”times a command; reports process data and system activity

timex [ o ] [ p [ fhkmrt ] ] [ s ] command

The given command is executed; the elapsed time, user time, and system time spent in execution are reported in seconds. Optionally, process accounting data for the command and all its children can be listed or summarized, and total system activity during the execution interval can be reported . The output of timex is written on standard error.

 <  Day Day Up  >  
UNIX Shells by Example
Authors: Quigley E.
Published year: 2004
Pages: 390-395/454
Buy this book on amazon.com >>

Similar books on Amazon

Similar books