Categories
All Categories
DMV
ServSafe
OSHA
NCLEX
HESI
TEAS
ATI Nursing
CNA & Nurse Aide
NREMT & EMS
ACLS
BLS
CPR
Quizzes
Study Guides
Flashcards
Packages
0
Log In
Register
Categories
All Categories
DMV
ServSafe
OSHA
NCLEX
HESI
TEAS
Quizzes
Study Guides
Flashcards
Packages
Contact
Cart
0
Log In
Register
OSCP Linux Practice Exam
Access More Questions
Report question problem
×
I think the answer is wrong
There are multiple correct answers
There is a typing error
Image or comprehension text is not display properly
Something else(please specify below)
Any more information
If you're trying to redirect stdout or stderr AND throw a long command that's been piped multiple times and includes multiple commands into the background, how do you need to do it?
(command | commands; commands) > /dev/null 2>&1 &
(command | commands; commands) 2> /dev/null/ &
(command | commands; commands) &
(command; commands | commands) > /dev/null 2>&1 &
Reveal Answer
Correct Answer:
(command; commands | commands) > /dev/null 2>&1 &
Explanation:
The key idea is to treat the whole multi-part command as a single job, so you can redirect both outputs for the entire block and run it in the background. Wrapping the entire sequence in a subshell and then redirecting and backgrounding that subshell ensures stdout and stderr from every part of the long command are sent to /dev/null, not just a piece of it. The syntax shown does exactly that: the long sequence (including an initial simple command followed by a pipeline) is grouped, then its stdout is redirected to /dev/null and 2>&1 sends stderr there as well, and finally the ampersand backgrounds the entire grouped job. This avoids partial redirection and guarantees the whole job runs quietly in the background. In contrast, options without proper grouping or with an incorrect redirection path would either fail to redirect both streams for all parts or would not reliably background the entire composite command.
Access more questions from this quiz
Continue to OSCP Linux Practice Exam for more practice questions and the full quiz experience.
Access More Questions