exam questions

Exam LFCS All Questions

View all questions & answers for the LFCS exam

Exam LFCS topic 1 question 40 discussion

Actual exam question from Linux Foundation's LFCS
Question #: 40
Topic #: 1
[All LFCS Questions]

In Bash, inserting 1>&2 after a command redirects

  • A. standard error to standard input.
  • B. standard input to standard error.
  • C. standard output to standard error.
  • D. standard error to standard output.
  • E. standard output to standard input.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
7Messer
3 months, 2 weeks ago
This is wrong. It means standard output to standard error, what is already unusual. https://www.thomas-krenn.com/de/wiki/Bash_stdout_und_stderr_umleiten
upvoted 1 times
...
Buruguduystunstugudunstuy
1 year, 6 months ago
Selected Answer: C
In Bash, inserting '1>&2' after a command redirects standard output to standard error. Option C is the correct answer. In Bash, the '>' symbol is used to redirect output from a command to a file. The '&' symbol is used to specify a file descriptor, which is a numerical identifier for a file that is used by the operating system to keep track of open files. The number '1' specifies the standard output file descriptor, and the number '2' specifies the standard error file descriptor. Therefore, the command '1>&2' redirects the standard output file descriptor ('1') to the standard error file descriptor ('2'). This means that the output of the command will be written to the standard error instead of the standard output.
upvoted 1 times
Buruguduystunstugudunstuy
1 year, 6 months ago
The other options do not accurately describe what happens when '1>&2' is inserted after a command: Option A: Standard error is not redirected to standard input. Option B: Standard input is not redirected to standard error. Option D: Standard error is not redirected to standard output. Option E: Standard output is not redirected to standard input. To redirect standard error to standard output, you can use the command '2>&1'. This will redirect the standard error file descriptor ('2') to the standard output file descriptor ('1'). This means that the error output of the command will be written to the standard output along with the normal output.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago