Home  >  Article  >  Operation and Maintenance  >  How to view error logs in Linux

How to view error logs in Linux

WBOY
WBOYOriginal
2022-06-22 17:09:3221919browse

In Linux, you can use the tail command to view the error log. This command is used to view the contents of the file. The syntax is "tail -f /var/log/messages"; the parameter "-f" means to The last content is displayed on the screen and constantly refreshed. The "/var/log/message" file is the information and error log after the system is started.

How to view error logs in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to view the error log in Linux

The tail command can be used to view the contents of the file. There is a common parameter -f which is often used to view the changing log file.

tail -f filename will display the last content in the filename file on the screen and refresh it continuously. As long as filename is updated, you can see the latest file content.

Command format:

tail [参数] [文件]

Parameters

  • -f Loop reading

  • -q Not displayed Processing information

  • -v Display detailed processing information

  • -c Number of bytes displayed

  • -n Display the last n lines of the file

  • --pid=PID Used with -f to indicate that the process ID and PID died End after

  • -q, --quiet, --silent Never output the header of the given file name

  • -s, -- sleep-interval=S Used in combination with -f, it means to sleep for S seconds between each iteration

The syntax is as follows:

tail /var/log/messages

How to view error logs in Linux

How to view error logs in Linux

Log file description

  • /var/log/message is the information and error log after system startup, which is the most commonly used in Red Hat Linux One of the logs

  • /var/log/secure Security-related log information

  • /var/log/maillog Mail-related Log information

  • /var/log/cron Log information related to scheduled tasks

  • /var/log/spooler and UUCP and news devices Related log information

  • /var/log/boot.log Log information related to daemon startup and stop

Recommended learning:Linux video tutorial

The above is the detailed content of How to view error logs in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn