Operating System - HP-UX
1837765 Members
3590 Online
110119 Solutions
New Discussion

Need help about tee command...

 
SOLVED
Go to solution
OLIVA_1
Regular Advisor

Need help about tee command...

Hello,

I would like trace all command I type in a log file.
For this I use: ksh | tee -a /tmp/log_file and I type my command "ls", "bdf", "uname -a" etc...

When I read /tmp/log_file I can see the command result but not the command typed... someone can help me ?

I would like a log file where I could see my command and its result.

Thanks,

5 REPLIES 5
Jeff_Traigle
Honored Contributor
Solution

Re: Need help about tee command...

Check out the man page for script. It will make a transcript of your entire session until you exit it.
--
Jeff Traigle
Steven E. Protter
Exalted Contributor

Re: Need help about tee command...

I generally use tee to split a copy of the output of individual commands to a log file

bdf | tee $logfile

for example.

Your methdology is interesing but unfamiliar to me. I wonder if its a supported use.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
OLIVA_1
Regular Advisor

Re: Need help about tee command...

Thank you for your help !!!
Dietmar Konermann
Honored Contributor

Re: Need help about tee command...

Of course Oliva's use of tee(1) is supported... and the supporter's answer is "works as designed". :-)

The tee command duplicates its stdin stream and end sends one copy to stdout and the other one to a file.

With "ksh | tee -a /tmp/log_file" the stdout of ksh is piped to tee's stdin. So tee copies ksh's stdout to the file. But what you are typing at the prompt is ksh's stdin... not the stdout.

Use the script(1) command instead, as already suggested.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Edgar Zapata
Esteemed Contributor

Re: Need help about tee command...

is there a way you can make it with the
.sh_history and/or .bash_history files?