[go: up one dir, main page]

Jump to content

dmesg

From Wikipedia, the free encyclopedia
dmesg
Operating systemUnix-like
PlatformCross-platform
TypeCommand


dmesg (diagnostic messages[1]) is a command on most Unix-like operating systems that prints the message buffer of the kernel.[2][3] The output includes messages produced by the device drivers.

Booting

[edit]

When initially booted, a computer system loads its kernel into memory. At this stage device drivers present in the kernel are set up to drive relevant hardware. Such drivers, as well as other elements within the kernel, may produce output ("messages") reporting both the presence of modules and the values of any parameters adopted. (It may be possible to specify boot parameters which control the level of detail in the messages.) The booting process typically happens at a speed where individual messages scroll off the top of the screen before an operator can read/digest them. The dmesg command allows the review of such messages in a controlled manner after the system has started.[4]

After booting

[edit]

Even after the system has fully booted, the kernel may occasionally produce further diagnostic messages. Common examples of when this might happen are when I/O devices encounter errors, or USB devices are hot-plugged. dmesg provides a mechanism to review these messages at a later time. When first produced, they will be directed to the system console. If the console is in use, these messages may be confused with or quickly overwritten by the output of user programs.[5]

Output

[edit]
Output of dmesg viewed with grep

The output of dmesg can amount to many complete screens. For this reason, this output is normally reviewed using standard text-manipulation tools such as more, tail, less or grep.[6] Size of the dmesg buffer is limited and the output is often captured in a permanent system logfile via a logging daemon, such as syslog.

Format

[edit]

Traditionally, dmesg lines begin with a device name followed by a colon, followed with detailed text. Often these come in clusters, with the same device showing up on multiple lines in succession. Each cluster is usually associated with a single device enumeration, by one particular device driver (or device facility) associated with the device name.

Each driver or facility emits diagnostic information in its own chosen format. Device drivers may specify the format in the manual page by convention called identically to the device file name without the trailing number.

See also

[edit]
  • lspci, detailed information about all PCI buses and devices in the system
  • lsusb, detailed information about USB ports and devices
  • uname prints the name, version and other details about the current machine and the operating system
  • List of Unix commands
  • udev – Linux device manager, with some control over device visibility

References

[edit]
  1. ^ DMESG(8) (Research Unix 8th ed.). Bell Labs. 1985. Retrieved 2020-02-10.
  2. ^ "Dmesg(1) - Linux manual page".
  3. ^ "Use dmseg to check your Linux system's kernel message buffer". Network World. Retrieved 2024-07-08.
  4. ^ Gareth Anderson (15 April 2006). "GNU/Linux Command-Line Tools Summary" (PDF). www.tldp.org. The Linux Documentation Project. p. 32. Archived from the original (PDF) on 23 November 2016. Retrieved 29 May 2017.
  5. ^ "dmesg explained LG #59". tldp.org. Retrieved 2024-03-22.
  6. ^ Mendel Cooper (5 April 2012). "Advanced Bash-Scripting Guide" (PDF). www.tldp.org. The Linux Documentation Project. p. 329. Archived from the original (PDF) on 18 May 2017. Retrieved 29 May 2017.
[edit]