dmesg gets Human Readable Output

Many Linux command line tools, such as ls or du, have a “human” option to make it more readable by… humans. When you want to get the kernel log, to find otu potential problems, you’d usually run dmesg, which dump the complete log in one go and looks like:

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.11.0-15-generic ([email protected]) (gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) ) #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 (Ubuntu 3.11.0-15.25-generic 3.11.10)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.11.0-15-generic root=UUID=9c042788-fa75-4fc4-9b12-598c809410e8 ro quiet splash
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bfd9ffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bfda0000-0x00000000bfdd0fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000bfdd1000-0x00000000bfdfffff] ACPI data
[    0.000000] BIOS-e820: [mem 0x00000000bfe00000-0x00000000bfefffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000efffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000043effffff] usable

The more recent version of util-linux add support for “human” output option which looks better, and adds some colors for better readability, and shows one page at a time. Run it as dmesg --human
dmesg_human
You’ll also notice it won’t wrap long time, e.g. “Command line: …”

Instead of listing the total time on the right, it will display the time taken by an individual tasks. For example:


will show as


when using human readable option.

If your linux-util version is not recent enough, human readable option won’t be available. You can build the code as follows:

If you have an earlier version, you could also get something similar with commands like:

For color, and per task timestamps.

or

To display the output page per page.

Via Greg KH.

Support CNX Software - Donate via PayPal or become a Patron on Patreon

5
Leave a Reply

avatar
5 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
Alfred BraithewaiteLeoKeslerGrrDiego.Sander Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Sander
Guest
Sander

don’t forget the “sudo make install”…

Diego.
Guest
Diego.

Another useful option of recent dmesg versions is “-w” which allows you to follow output of the kernel like with “tail -f”.

Grr
Guest
Grr

That’s useful. Thanks 🙂

LeoKesler
Guest

Very nice. But I got an error, when I execute mount :

mount: /lib/arm-linux-gnueabihf/libmount.so.1: version MOUNT_2.25' not found (required by mount)
mount: /lib/arm-linux-gnueabihf/libmount.so.1: version
MOUNT_2.23′ not found (required by mount)
mount: /lib/arm-linux-gnueabihf/libmount.so.1: version MOUNT_2.21' not found (required by mount)
mount: /lib/arm-linux-gnueabihf/libmount.so.1: version
MOUNT_2.24′ not found (required by mount)
mount: /lib/arm-linux-gnueabihf/libmount.so.1: version `MOUNT_2.22′ not found (required by mount)

To fix, I removed the symbolic link:
rm -r -I /lib/arm-linux-gnueabihf/libmount.so.1

At least, I think it is fixed …

By the way, any other hint to get a more human (or beautiful) linux ?

Alfred Braithewaite
Guest
Alfred Braithewaite

“checking for SYSTEMD_DAEMON”

Even these simple fundamental system utilities have become infected with the requirements of systemd.

systemd — all your programs and log files belong to us.