Bash & Shell Scripting (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What are the basic Stream Redirections (`>`, `>>`, `2>`, `2>&1`)?
junior Levelbash-shellBasic
In Simple Words:
Linux processes have three standard streams: File Descriptor 0 (stdin), 1 (stdout), and 2 (stderr):
>: Overwrites standard output to a file (echo "hello" > file.txt).>>: Appends standard output to a file.2>: Redirects standard error only (ls /root 2> errors.log).2>&1: Redirectsstderr(2) to whereverstdout(1) is currently pointing.&>: Redirects both stdout and stderr together to a file (./run.sh &> all_output.log).>/dev/null 2>&1: Completely silences all output.