Type the complete command that displays the last 20 lines of the file /var/log/syslog. Pass the file as an argument, not through a redirect.
LPIC-1 Exam 101-500, objective 103. GNU and Unix commands easy
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
tail -n 20 /var/log/syslogtail -n20 /var/log/syslogtail -20 /var/log/syslogtail --lines=20 /var/log/syslogtail --lines 20 /var/log/syslog
Case sensitive — Linux is, and grading LS as ls would teach a falsehood.
Why
tail prints the end of a file, 10 lines by default; -n N (or the older -N form) sets the count. `tail -n +20` means something different: start AT line 20 and print to the end. The other option you need in practice is -f, which keeps the file open and prints new lines as they are appended, which is how log files are watched live.
Where this comes from
- Cited
- LPI exam objective 103.2
- What it says
- Display the beginning or the end of a text file with head and tail.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 103 and space the ones you get wrong.