BASH(oh) LOCAL BASH(oh) bash - usage, redirection and tips. REDIRECTION Commands can output to files or programs. Files Overwrite file : ls > log Append to file : ls >> log File descriptors Command results can: - be displayed on the terminal: stdout, file descriptor 1. - be an error: stderr, file descriptor 2. When redirecting, only the output is sent, to add error, stderr must be added to stdout: ls > log 2>&1 This redirects stderr(2) to stdout(&1) and the output is saved to log. &1 means 1 is a file descriptor, not a file. CHAINED COMMANDS Commands can be combined: Sequential execution : command1 ; command2 Execute command2 if command1 was successful : command1 && command2 Execute command2 if command1 failed : command1 || command2 SUBSHELL Commands can be grouped and redirected together. ( command1 && command2 ) >> log 2>&1 SEE ALSO linux(oh) - Archlinux manpages: bash(1) AUTHORS ohazot(oh) | about(oh) | ohazot.com: https://ohazot.com linux , OpenBSD 7.8 | Created:2026-03-27|Updated:2026-03-27| BASH(oh)