|
Command display output on console and simultaneously save the command and its output
Hi folks,
Please advise which command/command line shall I run;
1) to display the command and its output on console
2) simultaneous to save the command and its output on a file
I tried tee command as follows;
$ ps aux | grep mysql | tee /path/to/output.txt
It displayed the command and its output on console but only saved the
output on output.txt without the command executed.
2)
$ ls -l | tee -a /path/to/outpu.txt
The output was added to the file also without the command.
3)
$ locate test.txt | tee -a /path/to/output.txt
locate: warning: database `/var/cache/locate/locatedb' is more than 8
days old
It won't add the warning on the file.
Please help. TIA
B.R.
satimis
|