CS246 Lecture Notes - Lecture 1: Grep, Uniq, Regular Expression
Document Summary
Note, just typing cat will print whatever you type. Cat infile. txt passes the name infile. txt as an argument to cat which opens the file and displays it. Output redirection - typing something follow the pattern command args > file will execute the command with the arguments and capture the output in a file instead of to the screen. You can do both input and output redirection (i. e. cat < infile. txt > outfile. txt which copies the file to a new one). Cat *. txt is a globbing pattern (the shell finds all files in the current directory that match the pattern / sequence of chars and substitutes them onto the command line). This can be used with other commands too! Every process is attached to three streams and redirection is changing what those streams are attached to: stdin (keyboard) redirects with , stdout (screen) redirects with , stderr (screen) redirects with 2>