dmesg

{{Short description|Standard UNIX utility that prints the message buffer of the kernel}}

{{Multiple issues|

{{Primary sources|date=August 2020}}

{{Tone|date=August 2020}}

}}

{{Infobox software

| title = dmesg

| name = dmesg

| logo =

| logo caption =

| logo alt =

| logo size =

| collapsible =

| screenshot = File:Clocksource on Linux booting screenshot.png

| screenshot size =

| screenshot alt = dmesg output piped through grep

| caption = dmesg output piped through grep

| other_names =

| author =

| developer =

| released =

| ver layout =

| discontinued =

| latest release version =

| latest release date =

| latest preview version =

| latest preview date =

| repo =

| qid =

| programming language =

| middleware =

| engine =

| operating system = Unix-like

| platform = Cross-platform

| included with =

| replaces =

| replaced_by =

| service_name =

| size =

| standard =

| language =

| language count =

| language footnote =

| genre = Command

| license =

| website =

| AsOf =

}}

{{lowercase title|title=dmesg}}

dmesg (diagnostic messages{{cite book |title=DMESG(8) |date=1985 |publisher=Bell Labs |edition=Research Unix 8th |url=http://man.cat-v.org/unix_8th/8/dmesg |access-date=2020-02-10}}) is a command on most Unix-like operating systems that prints the message buffer of the kernel.{{Cite web|url=http://man7.org/linux/man-pages/man1/dmesg.1.html|title = Dmesg(1) - Linux manual page}}{{Cite web |title=Use dmseg to check your Linux system's kernel message buffer |url=https://www.networkworld.com/article/970526/use-dmseg-to-check-your-linux-systems-kernel-message-buffer.html |access-date=2024-07-08 |website=Network World |language=en}} The output includes messages produced by the device drivers.

Booting

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 {{mono|dmesg}} command allows the review of such messages in a controlled manner after the system has started.{{cite web|author1=Gareth Anderson|title=GNU/Linux Command-Line Tools Summary|url=http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/GNU-Linux-Tools-Summary.pdf|website=www.tldp.org|publisher=The Linux Documentation Project|access-date=29 May 2017|archive-url=https://web.archive.org/web/20161123050515/http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/GNU-Linux-Tools-Summary.pdf|archive-date=23 November 2016|page=32|language=English|date=15 April 2006}}

After booting

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.{{Cite web |title=dmesg explained LG #59 |url=https://tldp.org/LDP/LG/issue59/nazario.html |access-date=2024-03-22 |website=tldp.org}}

Output

File:Clocksource on Linux booting screenshot.png]]

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.{{cite web|author1=Mendel Cooper|title=Advanced Bash-Scripting Guide|url=http://tldp.org/LDP/abs/abs-guide.pdf|website=www.tldp.org|publisher=The Linux Documentation Project|access-date=29 May 2017|archive-url=https://web.archive.org/web/20170518032925/http://tldp.org/LDP/abs/abs-guide.pdf|archive-date=18 May 2017|page=329|language=English|date=5 April 2012}} 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

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

  • List of Unix commands
  • 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
  • Ring buffer, the structure of the buffer used by dmesg
  • udev {{En dash}} Linux device manager, with some control over device visibility

References

{{Reflist}}