Friday, April 19, 2013

LINUX commands related to kernel

dmesg

The dmesg command can be used to examine or control the kernel ring buffer. 
Ring buffer
A ring buffer is a cyclic data structure similar to a normal buffer having a fixed size but it is managed in such a way that the newest entries are recorded, and if required, only the oldest entries are removed to keep the size of the buffer constant. Just think about a ring as if it reaches the end point it will start from the beginning.
The kernel Ring buffer
Also called the Kernel Log Buffer, it is a kind of Ring Buffer which contains messages related to the kernel and its different modules. For example it prints messages when any new kernel module is loaded or when a new file-system is registered in the kernel etc. The Linux kernel outputs these messages which are of great help in debugging and troubleshooting although it contains a great amount of noise. These messages are further classified into log levels depending upon the severity of the message.
The Log Level of Kernel Messages.
LOG_EMERG system is unusable
LOG_ALERT action must be taken immediately
LOG_CRIT critical conditions
LOG_ERR error conditions
LOG_WARNING warning conditions
LOG_NOTICE normal, but significant, condition
LOG_INFO informational message
LOG_DEBUG debug-level message

 ---------------------------------------------------------------------------------------------------------------------------------

uname -r

print the kernel release.

 ---------------------------------------------------------------------------------------------------------------------------------

rpm -q kernel (RedHat/CentOS)

dpkg --list | grep linux-image (Ubuntu, debian)

list all installed kernel and its version.

 ---------------------------------------------------------------------------------------------------------------------------------

lsmod

show the status of modules in the Linux Kernel.

---------------------------------------------------------------------------------------------------------------------------------

ldd

print shared library dependencies of a binary

---------------------------------------------------------------------------------------------------------------------------------

0 comments:

Post a Comment