dmesg
Processes and system
Usage
sudo dmesg -T | tailReads the kernel ring buffer, the first place to look after a disk or USB problem; it is a fixed-size buffer so older lines are already gone, and most distributions now require root (macOS uses `log show`).
Common flags
| Flag | Meaning |
|---|---|
| -T | Human-readable timestamps instead of seconds since boot. |
| -w | Follow new kernel messages as they appear. |
| -l err,warn | Filter by level. |
| -H | Paged, colourised, relative-time output. |
| --since "5 min ago" | Time-bounded output (newer util-linux). |
Examples
sudo dmesg -T | tail -50Read what the kernel said about a disk or USB device just now.
dmesg -wWatch live while you plug something in.
log show --last 10mThe macOS equivalent; its dmesg exists but shows almost nothing.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does dmesg do?
Reads the kernel ring buffer, the first place to look after a disk or USB problem; it is a fixed-size buffer so older lines are already gone, and most distributions now require root (macOS uses `log show`).
Q. How do I type it?
sudo dmesg -T | tail — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
5 are listed here; the full set is in man dmesg. This command sits under Processes and system.
Related commands
man page: man dmesg