Output redirection and pipelines
cheat sheet · Ubuntu 24.04 · Bash 5.2 https://lab.dimsanych.ru/en/wiki/redirection/Cheat sheet
-
cmd > out.txtoutput to a file (overwrite) -
cmd >> out.txtoutput appended to a file -
cmd 2> err.txterrors to a file -
cmd > all.txt 2>&1output and errors in one file -
cmd &> all.txtthe same, shorter (bash) -
cmd 2>/dev/nullthrow errors away -
cmd < in.txtinput from a file -
cmd1 | cmd2cmd1's output into cmd2's input -
cmd 2>&1 | lessinto a pipe together with errors -
cmd | tee out.txtboth to the screen and to a file