How to view error logs in Linux

WBOY
Release: 2022-06-22 17:09:32
Original
22029 people have browsed it

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 [参数] [文件]
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template