- - stdin
- - stdout
- - stderr
- - tee
- - xargs
stdin
stuff a program chews up
wc < file1.txt
some programs don’t accept data from stdin
stdout
stuff a program spits out
ls > ls.txt
ls 1> ls.txt
stderr
where a program complains
ls bob 2> ls.txt
redirects stderr to ls.txt
Both stdout and stderror go to the console
To keep a log you would like to:
ls >> ls.txt→ will append
ls bob 2>> ls.txt→ will append stderr
ls bob >> results.txt 2>> errors.txt→ redirects both to files
ls bob > output.txt 2>&1→ redirect stderr to stdout in the same place
pipes
not all applications support stdin from other applications
ls | grep 3
tee
- write a program see what is doing and write to a file
- read from std input and write to standard output and file
ls | tee output.txt
xargs
- ls | echo
echo does not accept input from ls
- ls | xargs echo
No comments:
Post a Comment