Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirections on Screen and Log file at the same time.

Status
Not open for further replies.

salimwng

IS-IT--Management
Mar 11, 2002
134
MU

Hi guys,

I wanted to log all the output of a tar command to a log file and at the same time to have scroll on the monitor too.

The command i am using is not working, i.e. either it's going in the log file or being displayed on the screen. I would like that both happens;

tar cv8 /u/peg > /u/salim/LOG/log.txt 2>&1

Could anybody tell me who this could be done.

Thank you
Salim
 
Salim,

take a look at the man page for tee. That should enable you to do away with the > and see it on screen too. So:

tar cv8 /u/peg | tee /u/salim/LOG/log.txt

should work for you. Regards.
 
Well, it would do as long as you tell it which files to tar up of course!

tar cv8 <tarfile> /u/peg | tee /u/salim/LOG/log.txt
 
Thanks Ken,

I'll check right away the man tee. As for the tar cv8 /u/peg, the 8 means the tape device ID in /etc/default/tar and /u/peg is the folder that needs to be backed up.

Thanks again.
Salim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top