Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

log the output of the terminal

# The table below show the common syntax for logging terminal in ubuntu 
#The numerals 0 through 9 are file descriptors in bash. 
#0 stands for standard input, 1 stands for standard output, 
#2 stands for standard error. The syntax follows the following examples:
mycommand |& tee output.txt
#The above, logs in both standard output and standard error to output.txt.
mycommand 2>stderr.log 1>stdout.log
#The above logs the standard error and standard output to different files.

|| visible in terminal ||   visible in file   || existing
  Syntax  ||  StdOut  |  StdErr  ||  StdOut  |  StdErr  ||   file   
==========++==========+==========++==========+==========++===========
    >     ||    no    |   yes    ||   yes    |    no    || overwrite
    >>    ||    no    |   yes    ||   yes    |    no    ||  append
          ||          |          ||          |          ||
   2>     ||   yes    |    no    ||    no    |   yes    || overwrite
   2>>    ||   yes    |    no    ||    no    |   yes    ||  append
          ||          |          ||          |          ||
   &>     ||    no    |    no    ||   yes    |   yes    || overwrite
   &>>    ||    no    |    no    ||   yes    |   yes    ||  append
          ||          |          ||          |          ||
 | tee    ||   yes    |   yes    ||   yes    |    no    || overwrite
 | tee -a ||   yes    |   yes    ||   yes    |    no    ||  append
          ||          |          ||          |          ||
 n.e. (*) ||   yes    |   yes    ||    no    |   yes    || overwrite
 n.e. (*) ||   yes    |   yes    ||    no    |   yes    ||  append
          ||          |          ||          |          ||
|& tee    ||   yes    |   yes    ||   yes    |   yes    || overwrite
|& tee -a ||   yes    |   yes    ||   yes    |   yes    ||  append
Comment

PREVIOUS NEXT
Code Example
Shell :: Docker show currently running containers 
Shell :: where is sudo in linux 
Shell :: how to find the number of files in a directory linux 
Shell :: delete line in sed 
Shell :: aws cli cloudformation list stacks 
Shell :: copying a file from a server to a local folder 
Shell :: how to use https in npm install instead of ssh 
Shell :: docker tag image 
Shell :: step6 pgadmin ubuntu 20.04 
Shell :: install gitlab-ce on centos 
Shell :: sudo rename command 
Shell :: tar append 
Shell :: linux print pdf from console 
Shell :: grep remove -- 
Shell :: download file on linus ssh 
Shell :: create gz in ubuntu 
Shell :: vscode manually install extension 
Shell :: View Commit History With Changes in git command 
Shell :: How To Make Log File On Batch Script 
Shell :: archive file 
Shell :: how to remove file from directory in linux 
Shell :: crontab view output 
Shell :: execute cron.daily 
Shell :: bash loop over files with extension 
Shell :: delete merge branch git 
Shell :: list directories linux 
Shell :: git update from another branch 
Shell :: How do I save terminal output to a file? 
Shell :: git diff ignore file 
Shell :: git fork 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =