A Linux administrator needs to convert all lowercase characters in a file named report.txt to uppercase and display the result on the terminal. The tr command is chosen for this task, but it only reads from standard input. Which of the following commands correctly uses input redirection to supply the contents of report.txt as standard input to the tr command?
The correct command is tr 'a-z' 'A-Z' < report.txt. The < operator is used for standard input redirection, which takes the contents of the specified file (report.txt) and passes it as standard input to the command (tr). The > operator redirects standard output, the <<< operator provides a 'here string' (passing the literal string 'report.txt' as input), and the pipe | is used to send the standard output of one command to the standard input of another, which is a different mechanism than direct file input redirection.
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 does the `tr` command do in Linux?
Open an interactive chat with Bash
What is the purpose of the `<` operator in Linux?
Open an interactive chat with Bash
Why is `cat report.txt | tr 'a-z' 'A-Z'` considered incorrect?
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