What does the 'tail' command do?

70,307

Solution 1

I'd suggest you take a look at the man page of tail. Just run man tail in your shell, or check it online.

Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input.

-f, --follow[={name|descriptor}]
output appended data as the file grows; -f, --follow, and --fol- low=descriptor are equivalent

And if you don't know what's man, you can always type man man ;)

Solution 2

The tail command shows the last ten lines of a file.

tail -f displays the last ten lines of the file and monitors the file for any new changes. In other words, it will append any changes to the Terminal as they appear in the file.

Of course, for more information, run man tail in Terminal.

Solution 3

The tail command is a command-line utility for outputting the last part of files given to it via standard input. It writes results to standard output. By default, tail returns the last ten lines of each file that it is given. It may also be used to follow a file in real-time and watch as new lines are written to it.

To view the last ten lines of a file pass the name of a file to the tail command.

To set the number of lines to show with tail pass the -n option followed by the number of lines to show.

tail -n 1 /usr/share/dict/words

Solution 4

What you've got is the output of your /var/logs/syslog file.

That is a file that store information about your system functionality. Those files are used to check what is the reason of a possible system failure. Obviously you will not look at those files unless you have a problem.

For further information about this sort of files look at this question: Difference between /var/log/messages, /var/log/syslog, and /var/log/kern.log?

You should know that tail is a command, and as others users says, you can know what a command does adding man at the beginning.

Share:
70,307

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm new to Ubuntu. I previously ran a tail -f /var/logs/syslog and get the following displayed results:

    kernel: [ 2609.699995] [drm:gen6_sanitize_pm] *ERROR* Power management discrepancy: GEN6_RP_INTERRUPT_LIMITS expected 000d0000, was 1a0d0000
    

    What does that mean?

  • s1mmel
    s1mmel almost 6 years
    Use the combination of both to show the last n lines and keep on following hte log tail -f -n100 /var/log/syslog