1. standard input and output
equipment file name file descriptor type
keyboard /dev/stdin 0 standard input
monitor /dev/stdout 1 standard output
monitor /dev/stderr 2 standard err output
2. output redirection
command > file cover standard input to file or equipment
command >> file append standard input to file or equipment
err command 2> file cover standard err input to file or equipment
err command 2>> file append standard err input to file or equipment
3. output 2 ways at same time
command > file 2>&1 cover output 2 ways in same file
command &> file
command >> file 2>&1 append output 2 ways in same file
command &>> file
command &>/dev/null special file, black hole
command >>file1 2>>file2 output the correct result appending to file1 and the error result appending to file2
4. input redirection
wc [<] [option] [filename] count the input strings or file
-c count bytes
-w count words
-l count rows
wc << [words] count the input strings between beginning and the words