Wednesday, September 30, 2009

See the output of a command on your screen, and store the output in a file

To capture only the output associated with specific operating system command,use the tee command. Output generated by a command is writen, both, on the screen and a designated file.

Example below runs the ls command to list all files in a directory, and save
that output to a file, for later viewing to determine the names and sizes of files on a particular date:

$ ls -altr /ora01/BRDSTN | tee /home/oracle/log/oct15_df.log

Sample output (displayed to the screen and recorded in the log file)

-rw-r----- 1 oracle oinstall 52429312 Oct 15 08:00 redo03a.log
-rw-r----- 1 oracle oinstall 838868992 Oct 15 08:25 undotbs01.dbf
-rw-r----- 1 oracle oinstall 524296192 Oct 15 08:30 system01.dbf
-rw-r----- 1 oracle oinstall 15056896 Oct 15 08:37 control01.ctl

No comments:

Post a Comment