Get Linux Version Information from the Command Line

Goal / Scope

The information below will provide a couple of methods for outputting Linux version information on the command prompt.


NOTE: This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo.

Any one of the following methods should provide the Linux distribution and name:

  1.     /etc/*-release file
  2.     lsb_release command
  3.     /proc/version file

and the following command will provide kernel information:

  1.     uname command

Methodology / Process Steps

Method 1: /etc/*-release file

Entering the command below will provide information about the version of Linux and usually the “codename” as well.

$ cat /etc/*-release

Method 2: lsb_release Command

The lsb_release command displays certain LSB (Linux Standard Base) and distribution-specific information.

$ sudo lsb_release -a

Method 3: cat /proc/version

This will display the kernel version and gcc version used to build it.

$ cat /proc/version

Method 4: uname Command

$ uname -a

Sample Output:

Linux host1 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux


if -a (–all) is specified, the information will be printed in the following order of individual options

-s–kernel-name Print the kernel name.
-n–nodename Print the network node hostname.
-r–kernel-release Print the kernel release.
-v–kernel-version Print the kernel version.
-m–machine Print the machine hardware name.
-p–processor Print the processor type, or “unknown“.
-i–hardware-platform Print the hardware platform, or “unknown“.
-o–operating-system Print the operating system.
–help Display a help message, and exit.
–version Display version information, and exit.
Another example, would be to combine a couple of switches, to obtain the Kernel name, version number, and machine hardware name using the following command:
$ uname -mrs

Sample Output:

Linux 4.4.0-96-generic x86_64


  • Linux – Kernel name
  • 4.4.0-96-generic – Kernel version number
  • x86_64 – Machine hardware name (64 bit)
$ uname

Sample Output:



  • Linux – Kernel name


Known Issues / Troubleshooting

This section is for the issues that have well defined and tested solutions.

Problem: | Error messages or permission denied is displayed

Solution: | Attempt the command again with elevated privileges (sudo [command])

Problem: | Nothing is displayed

Solution: | Check the syntax, verify the command provided was correct and what the system expected


HowTo: Find Out My Linux Distribution Name and Version

Linux uname Command Examples (Get Kernel version, release, hostname, etc)