A system administrator is running a find /etc -name "app.conf" command as a non-root user. The command generates many "Permission denied" messages to the terminal, which makes it difficult to see the actual results. The administrator wants to separate these error messages from the standard output and save them to a file named find_errors.log for later analysis. Which of the following commands will accomplish this?
The correct command is find /etc -name "app.conf" 2> find_errors.log. In Bash and other shells, file descriptors are used to manage input and output streams. Standard output (stdout) is file descriptor 1, and standard error (stderr) is file descriptor 2. The 2> operator specifically redirects the standard error stream to the specified file, find_errors.log. The command find /etc -name "app.conf" > find_errors.log (or 1>) only redirects standard output, so the error messages would still appear on the terminal. The command find /etc -name "app.conf" &> find_errors.log redirects both standard output and standard error to the file. The command find /etc -name "app.conf" | tee find_errors.log pipes the standard output of find to the tee command, which then writes it to both the specified file and standard output; it does not redirect standard error by default.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are file descriptors in Linux?
Open an interactive chat with Bash
What does the `2>` operator do in Bash?
Open an interactive chat with Bash
How is `&>` different from `2>` in Bash?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access