Bash I/O redirection
I/O Redirection allows us to change destination of data. Reasons to use it are countless. Some of them are clean output when looking for files. Commands like:
find / -iname '*.java'
grep -irl 'Hello World' /
Produces huge amount of errors when we try to look into directory (or files) without proper permission.
find: /.DocumentRevisions-V100: Permission denied
find: /.fseventsd: Permission denied
find: /.Spotlight-V100: Permission denied
find: /.Trashes: Permission denied
Other reason can be saving different outputs to different log files or advance piping.
Most of uses:
# Hide / remove error stream
command 2>/dev/null
# Combine output and error stream as one output stream
command 2>&1