How to get the Linux information on a running system?

I love Linux

If you’re running a desktop Linux distribution, chances are that you know the distribution and other details of the system. In situations where you remotely accessing a server not owned by you, these tricks help you to find the Linux OS and system details that keep you well-informed.

How to find the Linux distribution running on the system?

To know whether the distribution that’s running is Ubuntu, RedHat or Kali Linux, you can read the /etc/issue file. This works on almost all the Linux flavors.

$ cat /etc/issue


To know more about the distribution like the distribution code name, ID, PRETTY_NAME etc. you can read the /etc/*release files. Ubuntu names this file as os-release whereas RedHat redhat-release. *release encompasses both files. This command may not work on all the Linux distributions but will on major ones.

$ cat /etc/*release


One more method to obtain the distribution information is by running lsb_release. LSB (Linux Standard Base) is a project collaborated by several Linux distributions to promote compatibility and to standardize the software structure. Though not all Linux distros align to LSB, major ones do. Notably Ubuntu, Redhat and SUSE. lsb_release provides distribution specific details.

$ lsb_release -a


How to see the kernel version?
As you know Linux itself is not an OS; it’s a kernel that provides the core functionality such as device drivers, file system, memory management and networking. Various utilities, window managers and applications are combined to make a fully-functional OS which in Linux parlance known as a distribution. Kernel is the core and engine that drives the OS. To know the kernel that’s encapsulated by the Linux distro you can run the uname command.

$ uname -r

The kernel information can also be obtained from the /proc/version file. This gives additional information along withe the kernel version.

$ cat /proc/version
Linux version 3.11.0-15-generic (buildd@akateko) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #25~precise1-Ubuntu SMP Thu Jan 30 17:42:40 UTC 2014

Note: The Linux kernel used odd minor version numbers to denote development releases and even minor version numbers to denote stable releases; For example, Linux kernel version 2.3 was a development version and Linux 2.4 was the stable version. Since 2004 release of the v2.6 kernel, Linux no longer uses this system, and has a much shorter release cycle, instead now simply incrementing the third number, using a fourth number as necessary.
How to know whether the kernel is 32bit or 64bit?

Note that you can install a 32-bit OS on a 64-bit CPU whereas the converse is not true. So there are two things: OS type & CPU type.

To know whether the running OS(kernel) is 32-bit or 64-bit:

$ uname -m

If the output is i386 or i686 then it’s a 32-bit kernel. 64-bit kernel outputs x86_64.

Another method is to run getconf. Splendid!

$ getconf LONG_BIT


An elegant hack to know whether you’re running a 32-bit or 64-bit kernel is to check the binary.

$ file /usr/bin/file
$ file /sbin/init


To know whether the CPU is 32-bit or 64-bit:

$ lscpu

The Architecture field displays the CPU type.

$ grep -w lm /proc/cpuinfo

If the output has lm in red then its 64-bit. Otherwise 32-bit.

$ sudo lshw | grep "description: CPU" -A 12 | grep width

It clearly displays what we want.

Note: The i386 is old 32-bit architecture for 386,486, Pentium and AMD processors. The i686 tag is modern 32-bit OS that includes extensions and performance-enhancements for most Pentium-class CPUs and AMD processors. Plus 32-bit machines are no longer manufactured.

About Deepak Devanand

Seeker of knowledge
This entry was posted in Linux and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s