Linux Command: Tail

Linux Command: Tail

I had come a cross a question from a class I'm currently taking. I know, I shouldn't seek help and figure it out by myself; but I gave up on it after looking all over the class book as well as internet. The question reads as this:  

"In /var/log/, there should be a file that records every email message sent. Using the tail command and the appropriate switch (which you may have to find by using the man command) display the last 11 lines of that file to the screen. Paste the command and output here."

What I've done so far:

cd /var/log
tail -11 messages

But it says you may have to use man command to find appropriate switch. How would I do that? Could you please help me? Thank you.

1

2 Answers

If you'd like to see the man(manual) page for a particular command(i.e. tail)

man tail

press 'q' to exit man pages.

or

tail --help
tail --help | less

press 'q' to exit

I normally look for sent emails in /var/log/mail.log

To display the last 11 lines of the tail command you can specify the -n option:

tail -n 11 /var/log/mail.log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.