The dmesg command is used to print the kernel buffer which contains Linux kernel-related messages. The tail
command is used to print specified files or input in an elegant way. We can use the dmesg and tail commands together in order to print dmesg messages. In this tutorial, we examine how to tail the dmesg command output.
tail dmesg Output
The tail
command is used to print specified output into the terminal. In the following example, we simply tell the dmesg command output for the dmesg messages.
$ sudo dmesg | tail
tail -f dmesg Output
The tail -f
command is used to monitor output in an interactive way by printing newly generated output into the terminal. But as you expect the dmesg command should also produce new messages and redirect to the “tail -f” command. The --follow
option can be used for the dmesg command to output new messages.
$ sudo dmesg --follow | tail -f
dmesg -w
The dmesg command provides a very simple way to print dmesg messages in an interactive way. The -w
parameter can be used to print current and newly coming dmesg messages to the terminal.
$ sudo dmesg -w