Definitions
# $PATH
# Add to beginning of $PATH
PATH=~/opt/bin:$PATH
# Add to end of $PATH
PATH=$PATH:~/opt/bin# Standard input & output
# Send output of command to a file instead of terminal
# Shell will create a file if it does not exist, if it does, the shell erases (clobbers) the original file first
command > file
# Append to file
command >> file
# Match every line that I type after that has 'this' in it and put the results in to hello_grep.txt file
grep this > hello_grep.txt
# Put all the lines matching 'line' into grep_output.txt file
grep line hello.txt > grep_output.txt
# >> Redirect output to append to FILE
grep line hello.txt >> grep_output.txt
# Redirect standard error stream to FILE
# where 2> means redirect output stream 2 to write results to the
# file and not to the terminal
find / -name 'story.txt' 2> error_log.txt
# 1> specifies stream ID 1 (standard output) (default)
# 2> specifies stream ID 2 (standard error)
# Sends both standard error and output to some location
ls /fffff > f 2>&1Last updated
Was this helpful?