Read Kernel Messages
sudo dmesg -T | less
sudo dmesg -T | tail -n 50Each line is one kernel message, oldest first. Without -T, each line starts with the number of seconds since boot, such as [ 3021.448120]. The newest messages are at the end, which is usually where the answer is.
Why dmesg Needs sudo
Debian and Ubuntu (since 20.10) set the kernel option kernel.dmesg_ to 1, so a normal user gets a permission error such as "Operation not permitted" instead of the messages. Other distributions may leave it at 0. Use sudo dmesg. You can check the setting with:
sysctl kernel.dmesg_restrictLeave the restriction in place: kernel messages can contain memory addresses and hardware details that help an attacker.
Readable Timestamps and Why They Drift
-T turns the seconds since boot into a date and time. The dmesg manual warns that these times can be inaccurate: the kernel's log clock is not updated across suspend and resume, so after a suspend, or a pause of a virtual server, they can be off by minutes or more. When the exact time matters, read the same messages from the journal, which stores the real time of each entry:
sudo journalctl -k --since "1 hour ago"Follow New Messages
sudo dmesg -Tw-w waits and prints new messages as they arrive. Leave it running while you attach a disk, restart a network interface, or reproduce a crash. Ctrl+C stops it.
Filter by Level
sudo dmesg -T --level=err,warn
sudo dmesg -T -l errThe levels are emerg, alert, crit, err, warn, notice, info, and debug. -x adds the facility and level to each line.
Find Common Problems
| Problem | Search with |
|---|---|
| Out of memory | grep -i -E "out of memory|oom" |
| Disk errors | grep -i -E "i/ |
| Network link | grep -i "link is" |
| Program crashes | grep -i segfault |
Pipe sudo dmesg -T into each search. What to look for:
- Out of memory: lines that say the OOM killer was invoked, followed by a line naming the killed process and its PID. Reading that record is covered in the OOM killer guide.
- Disk errors: I/O errors on a device such as
vdaorsda, and file system messages saying it was remounted read-only. Back up your data first and report the errors to your hosting provider for a virtual disk. A slow disk without errors is covered in how to check disk I/O. - Network: "Link is Down" and "Link is Up" lines from the network driver show an interface losing its connection.
- Segfaults: a program crashed on a memory error; the line names it.
Useful Options
| Option | What it does |
|---|---|
-T | Human-readable time |
-w | Follow new messages |
-l | Filter by level |
-H | Readable output, color, pager |
-x | Show facility and level |
Avoid -c and -C: they clear the ring buffer, and the messages you are looking for go with it.
dmesg or journalctl -k?
The ring buffer has a fixed size and is lost at reboot, so dmesg shows only recent messages of the current boot. If the journal is stored on disk, journalctl -k -b -1 shows the kernel messages from the boot before, which is what you need after a crash. See how to use journalctl.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations