101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 37


Which of the following are valid stream redirection operators within Bash? (Choose two.)

Show Answer
Correct Answer: AE

In Bash, stream redirection operators are used to redirect input and output of commands. The '<' operator is used for input redirection, which allows a file to be used as the input for a command. For example, 'command < file'. The '2>&1' operator is used to redirect the standard error (file descriptor 2) to the same location as the standard output (file descriptor 1), which is useful for capturing both output streams. The other options '#>' and '%>' are not recognized as standard stream redirection operators in Bash, while '>>>' is also not a valid operator as '>>' is used for appending output to a file.

Discussion

4 comments
Sign in to comment
aMiPL
Mar 31, 2021

The answer is correct: https://tldp.org/LDP/abs/html/io-redirection.html

stefano1856Options: AE
Oct 30, 2021

2>&1 is used to redirect standard error output (2) to standard output (1), for example: find / -name *.log > result.txt 2>&1: register errors in results.txt and don't display nothing find / -name *.log > result.txt: display errors

JilNOptions: AE
May 25, 2021

Is it supposed to be < or > Am used to redirecting my output via >. I have not encountered < before. Someone please educate me.

CuriousLinuxCat
Jul 24, 2021

You use < when you want to input some information to a command. Basically, it's the other way around of >.

NinymoOptions: AE
Mar 24, 2024

Answer: AE