Home > Article > Operation and Maintenance > How to view error logs in Linux
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.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
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
-n
--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
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!