Concept Flow - dmesg for kernel messages
Run dmesg command
Kernel buffer read
Display kernel messages
User reads output
The dmesg command reads the kernel's message buffer and shows system startup and hardware messages.
dmesg | head -5| Step | Action | Command Output | Explanation |
|---|---|---|---|
| 1 | Run 'dmesg | head -5' | Displays first 5 lines of kernel messages | Reads kernel ring buffer and pipes to head |
| 2 | Output line 1 | [0.000000] Initializing cgroup subsys cpuset | First kernel message about control groups |
| 3 | Output line 2 | [0.000000] Initializing cgroup subsys cpu | Second kernel message about CPU control groups |
| 4 | Output line 3 | [0.000000] Linux version 5.15.0-50-generic | Kernel version info |
| 5 | Output line 4 | [0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.15.0-50-generic | Boot command line parameters |
| 6 | Output line 5 | [0.000000] KERNEL supported cpus: | List of supported CPUs |
| 7 | End of output | No more lines shown | head limits output to 5 lines |
| Variable | Start | After 1 | After 2 | After 3 | After 4 | After 5 | Final |
|---|---|---|---|---|---|---|---|
| dmesg_output_line | none | [0.000000] Initializing cgroup subsys cpuset | [0.000000] Initializing cgroup subsys cpu | [0.000000] Linux version 5.15.0-50-generic | [0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.15.0-50-generic | [0.000000] KERNEL supported cpus: | 5 lines shown, output ends |
dmesg command reads kernel message buffer Use 'dmesg' to see system and hardware logs Pipe to 'head' to limit output lines Timestamps show seconds since boot Useful for troubleshooting hardware and boot issues