Exercises

Exercises

Questions & Answers

What are the three data streams in Bash?

CLICK FOR ANSWER
  1. STDIN
  2. STDOUT
  3. STDERR

What is the purpose of STDIN?

CLICK FOR ANSWER

STDIN is the mechanism for passing data to a bash command or script.

What is the purpose of STDOUT?

CLICK FOR ANSWER

STDOUT is the repository of any standard output generated by the command or script.

What is the purpose of STDERR?

CLICK FOR ANSWER

STDERR is the repository of any error output generated by a command or script.

When running a command or script from a bash shell where is STDOUT & STDERR directed?

CLICK FOR ANSWER

By default STDOUT & STDERR are routed to the terminal that invoked the command or script.

How can STDOUT be redirected from a terminal window to a file?

CLICK FOR ANSWER

By using the STDOUT redirection write operator > and designating a file to write the contents to.

Additionally, the STDOUT redirection append operator >> and designating a file to append the contents to.

How can STDOUT be redirected to the STDIN of the following command?

CLICK FOR ANSWER

By using the pipe operator |, the STDOUT generated by one command is converted into the STDIN of the following command.