Read dmesg From Previous Session
If your system uses journalctl then you can easily get the kernel messages (dmesg log) from prior shutdown/crash (in a dmesg -T format) through the following.
Options:
-kShow kernel messages.-b <boot_number>How many reboots ago 0, -1, -2, etc.-o short-precisePrint in admesg -Tformat.-p <priority>Filter by priority output (4 to filter out notice and info).
There is also an -o short and -o short-iso which gives you the date only, and the date-time in ISO format respectively.
Commands:
- All boot cycles :
journalctl -o short-precise -k -b all - Current boot :
journalctl -o short-precise -k - Last boot :
journalctl -o short-precise -k -b -1 - Two boots prior :
journalctl -o short-precise -k -b -2
And so on.
The amount of boots you can look back on can be viewed with the following.
journalctl --list-boot |
The output of journalctl --list-boot looks like the following.
1 | -6 cc4333602fbd4bbabb0df2df9dd1f0d4 Sun 2016-11-13 08:32:58 JST—Thu 2016-11-17 07:53:59 JST |