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 (buildd@roseapple) (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
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:
1 2 |
[ 0.065115] ftrace: allocating 27844 entries in 109 pages [ 1.555780] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 |
will show as
1 2 |
[ +0.055397] ftrace: allocating 27844 entries in 109 pages [ +1.490665] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 |
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:
1 2 3 4 5 6 |
git clone git://<a href="http://git.kernel.org/pub/scm/utils/util-linux/util-linux.git" target="_blank" rel="nofollow">git.kernel.org/pub/scm/utils/util-linux/util-linux.git</a> util-linux cd util-linux/ sudo apt-get install autopoint libtool ./autogen.sh ./configure make |
If you have an earlier version, you could also get something similar with commands like:
1 |
dmesg -L -e |
For color, and per task timestamps.
or
1 |
dmesg | less |
To display the output page per page.
Via Greg KH.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
don’t forget the “sudo make install”…
Another useful option of recent dmesg versions is “-w” which allows you to follow output of the kernel like with “tail -f”.
That’s useful. Thanks 🙂
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_2.23′ not found (required by mount)mount: /lib/arm-linux-gnueabihf/libmount.so.1: version
mount: /lib/arm-linux-gnueabihf/libmount.so.1: version
MOUNT_2.21' not found (required by mount)
MOUNT_2.24′ not found (required by mount)mount: /lib/arm-linux-gnueabihf/libmount.so.1: version
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 ?
“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.