Type the complete command line that runs `dmesg` so that its output appears on the terminal and is written to the file boot.log at the same time. Use a pipe and the standard tool for this.
LPIC-1 Exam 101-500, objective 103. GNU and Unix commands medium
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
Answer
Type the answer.
Accepted answers
dmesg | tee boot.logdmesg|tee boot.log
Case sensitive — Linux is, and grading LS as ls would teach a falsehood.
Why
tee copies standard input to standard output and to each file named on its command line, which is how you inspect a stream and keep a copy of it. tee -a appends instead of truncating, and `sudo tee` is the usual way to write to a root-owned file from a pipeline, since the redirect in `sudo cmd > /etc/file` is performed by your unprivileged shell.
Where this comes from
- Cited
- LPI exam objective 103.4
- What it says
- Use tee to send a stream to a file and onward through a pipeline.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 103 and space the ones you get wrong.