how can i get the log of shutdown of linux
To obtain the log of shutdown events in Linux, you can check the system logs. The specific log file and its location may vary depending on the Linux distribution you are using. Here are a few common locations:
-
/var/log/messages or /var/log/syslog: These files contain general system messages, including shutdown events. You can view these logs using the
catorlesscommand:cat /var/log/messages -
/var/log/kern.log: This file logs kernel-related events, including shutdowns. You can view the log with the
catorlesscommand:cat /var/log/kern.log -
/var/log/lastlog: This log file provides information about the last login session, including the shutdown time. You can view it using the
lastcommand:last -x -
/var/log/wtmp or /var/log/utmp: These files record user login and logout information, including shutdown events. You can use the
lastcommand to view this log as well:last -x
Remember that you may need root or sudo privileges to access some of these log files. Additionally, the log files may rotate or be compressed, so you might need to use tools like zcat, gzip, or journalctl depending on your system configuration
原文地址: http://www.cveoy.top/t/topic/hQn1 著作权归作者所有。请勿转载和采集!