
Linux Shell Scripting Essentials
By :

In some cases, it's necessary to print an output on stdout
and save an output in a file. In general, command output can either be printed or can be saved in a file. To solve it, the tee
command is used. This command reads from the standard input and writes to both standard output and files. The syntax of tee
will be as follows:
tee [OPTION] [FILE …]
The tee
command copies the output to each FILE
and also to stdout
. The OPTIONS
can be as follows:
Option |
Description |
---|---|
|
This appends to the |
|
This ignores interrupt signals, if any |
Writing an output to stdout
and file: In general, to write an output to stdout
and file, we will call the same command twice, with and without redirection. For example, the following command shows how to print an output on stdout
and save it to a file:
$ ls /usr/bin/*.pl # Prints output on stdout /usr/bin/rsyslog-recover-qi.pl /usr/bin/syncqt.pl $ ls /usr/bin/*...
Change the font size
Change margin width
Change background colour