Detecting Linux distribution name and version

by Anish


Posted on Sunday May 5th


Referefce 8gwifi.org

Just execute lsb_release -a

bash ~ lsb_release -a
No LSB modules are available.
Distributor ID:  Ubuntu
Description:  Ubuntu 16.04.4 LTS
Release:  16.04
Codename:  xenial

if the lsb_release is not available then

bash ~ cat /etc/issue
Ubuntu 16.04.4 LTS \n \l

Or Look at /etc/os-release

bash ~ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.4 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Or you can try cat /etc/*release

bash ~ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.4 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

For fedora like system look at /etc/redhat-release

$ cat /etc/redhat-release 
Red Hat Enterprise Linux Workstation release 6.7 (Santiago)

execute uname -a to get basic information about the Linux Kernel

bash ~ uname -a 
Linux provisoner 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Showing kernel Information el6 architecture x86_64

$ uname -a 
Linux my-rhel 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

As per man page here few more options for uname

-a, --all                         print all information, 
-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 (non-portable)
-i, --hardware-platform print the hardware platform (non-portable)
-o, --operating-system  print the operating system

Next Reading : How to Monitoring All Executed Commands in Linux



Thanku for reading !!! Give a Share for Support

Asking for donation sound bad to me, so i'm raising fund from by offering all my Nine book for just $9


python Cryptography Topics
Topics
For Coffee/ Beer/ Amazon Bill and further development of the project Support by Purchasing, The Modern Cryptography CookBook for Just $9 Coupon Price

Kubernetes for DevOps

Hello Dockerfile

Cryptography for Python Developers

Cryptography for JavaScript Developers

Go lang ryptography for Developers