How do I know about the Linux kernel version I am using? How do I check the Linux distribution name? How can I see the Linux kernel version number?
Many times, you might have required to know about some details about your Linux system, such as name of the kernel, its version, host name and many more. No doubt you can get these details in the corresponding files residing in the proc directory, but uname command makes the things more convenient and quicker. uname can provide you a lot of information about your Linux system.
Before we move to tutorial part of uname command, just remember the syntax of this command:
uname [OPTION]
Usage: uname
You may also use the option –s to know the kernel name.
Usage: uname –s
Output:
Usage: uname –n
Output:
You will get the same output when you run the hostname command.
Usage: hostname
Output:
Usage: uname –r
Output:
Usage: uname –v
Output:
Usage: uname –p
Output:
Usage: uname –i
Output:
Usage: uname –o
Output:
Usage: uname –a
Output:
This command will display the distribution specific information. Just try running lsb_release –a to see a few details about the distribution you are using.
Usage: lsb_release –a
Output:
The /proc/version file will show you the version of the kernel the system is running. Open this file using cat command and see its contents. (Know more about cat command in this article)
Output:
Now, run the following command and compare its output with the above output.
cat /proc/sys/kernel/{ostype,osrelease,version}
Output:
The conclusion is, the output of the command cat /proc/version contains the contents of /proc/sys/kernel/ostype, /proc/sys/kernel/osrelease, and /proc/sys/kernel/version files.
That’s all. I have tried to cover basic use of uname command to observe the information related to your system. If you like this article then share it as much as possible, for any feedback use the comment section below and please stay tuned for some more interesting articles.
Many times, you might have required to know about some details about your Linux system, such as name of the kernel, its version, host name and many more. No doubt you can get these details in the corresponding files residing in the proc directory, but uname command makes the things more convenient and quicker. uname can provide you a lot of information about your Linux system.
Before we move to tutorial part of uname command, just remember the syntax of this command:
uname [OPTION]
Basic Use of uname Command
1. Know the Name of Your Kernel
Simplest use of any command is when it is used without any option. When uname command is used with no option, it displays the name of the kernel present in your system.Usage: uname
You may also use the option –s to know the kernel name.
Usage: uname –s
Output:
2. Know the Node Name of the Host
Node name is the name with which your system is identified in the computer network. To know what your systems node name is, use the option –n with uname command.Usage: uname –n
Output:
You will get the same output when you run the hostname command.
Usage: hostname
Output:
3. Knowing the Kernel Release Information
The uname command when used with the option –r will display the kernel release information.Usage: uname –r
Output:
4. Knowing the Kernel Version
The uname command when used with the option –v will show the kernel version information.Usage: uname –v
Output:
5. Knowing the Processor Type Information
The uname command when used with the option –p will display the processor type information. If somehow uname fails to get the processor type information, it will display 'unknown' on the output screen.Usage: uname –p
Output:
6. Knowing the Hardware Platform Information
The uname command when used along with option –i will display hardware platform information. Again, if uname fails to get hardware platform information, it will print 'unknown' in the output.Usage: uname –i
Output:
7. Know the Name of the Operating System
The uname command when used with option –o will show the name of the operating system.Usage: uname –o
Output:
8. Know All Details of the System
All the information we have seen till this point can be retrieved using only one command which is uname –a.Usage: uname –a
Output:
Alternatives to Some uname Usages
lsb_release
This command will display the distribution specific information. Just try running lsb_release –a to see a few details about the distribution you are using.
Usage: lsb_release –a
Output:
The /proc Directory
We have read about this directory in our previous article Know About Important Directories in Linux and Their Usage.The /proc/version file will show you the version of the kernel the system is running. Open this file using cat command and see its contents. (Know more about cat command in this article)
Output:
Now, run the following command and compare its output with the above output.
cat /proc/sys/kernel/{ostype,osrelease,version}
Output:
The conclusion is, the output of the command cat /proc/version contains the contents of /proc/sys/kernel/ostype, /proc/sys/kernel/osrelease, and /proc/sys/kernel/version files.
That’s all. I have tried to cover basic use of uname command to observe the information related to your system. If you like this article then share it as much as possible, for any feedback use the comment section below and please stay tuned for some more interesting articles.
Thank you for your introduction ^.^
ReplyDelete