Show Linux Version, Distribution (Distro), System Information

This is quick guide howto show Linux version, howto show Linux distributin (distro) info, howto show Linux System information, kernel version and kernel information on command line.

Show Linux Version

Linux version information can be checked using the following commands:
cat /proc/version
Another way to check Linux Version information is following:
dmesg | grep "Linux version"

Example output:

Linux version 2.6.35.4-28.fc14.i686 (mockbuild@x86-19.phx2.fedoraproject.org) (gcc version 4.5.1 20100907 (Red Hat 4.5.1-3) (GCC) ) #1 SMP Wed Sep 15 02:03:44 UTC 2010

Show Linux Distribution/Distro information

Use lsb_release command to show Linux distribution information:
lsb_release -a

Example output:

LSB Version:	:core-4.0-ia32:core-4.0-noarch
Distributor ID:	Fedora
Description:	Fedora release 14 (Laughlin)
Release:	14
Codename:	Laughlin

Show Linux System Information

Use uname command to show Linux system information:
uname -a

Example output:

Linux localhost.localdomain 2.6.35.4-28.fc14.i686 #1 SMP Wed Sep 15 02:03:44 UTC 2010 i686 i686 i386 GNU/Linux
Show just all Linux kernel information (Kernel name, Kernel release, Kernel version) with following command:
uname -srv

Example output:

Linux 2.6.35.4-28.fc14.i686 #1 SMP Wed Sep 15 02:03:44 UTC 2010
Follow If Not True Then False Updates!

3 Comments

  1. Hi all..

    i have a script with me… I just want to be open hearted as Linux…

    save the following script as mysystemconfig.sh

    then do the following command
    chmod 777 mysystemconfig.sh

    then execute it
    sh mysystemconfig.sh

    #=================== You will get almost everything here================

    #!/bin/bash

    #
    # System configuration
    # (All most complete information)
    # @uther : [email protected]
    #

    userId=`id -g`

    if [ $userId == 0 ]; then

    clear
    echo “”
    echo ” System configuration”
    echo ” ====================”

    #System-Info———————[
    host_name=`hostname`
    date_n_time=`date '+%m/%d/%y %H:%M:%S'`
    #System-Info---------------------]

    #os-details———————-[
    os_installed=`cat /etc/issue | head -1`
    os_name=`uname -a`
    hw_platform=`uname -i`
    if [ $hw_platform == "i386" ]; then
    hw_platform=”32bit”
    fi
    if [ $hw_platform == "x86_64" ]; then
    hw_platform=”64bit”
    fi
    #os-details———————-]

    #users—————————[
    no_of_users=`who | wc -l`
    users=`users | awk '{ while(++i&1 | awk '{print $2}' | head -2 | tail -1`" MB"
    RAM_total_used=`free -m 2>&1 | awk '{print $3}' | head -2 | tail -1`" MB"
    if [ $userId == 0 ]; then
    countRams=`dmidecode –type 17 | grep “Size” | grep “MB” | wc -l`
    RamSize=`echo \`dmidecode –type 17 | grep “Size” | grep “MB” |awk ‘{print $2}’\` | tr ” ” “,”`” MB [$countRams RAM(s)]”
    else
    RamSize=`free -m | grep “Mem:” | awk ‘{print $2 “”}’`”MB (Please login as root to get accurate information)”
    fi
    #RAM Info————————]

    #HDD Info————————[
    if [ $userId == 0 ]; then
    No_of_HDDs=`fdisk -l 2>&1 | grep Disk | grep -v “identifier” | grep -v “valid partition” | awk ‘{print $3}’ | wc -l`
    countHDD=`fdisk -l 2>&1 | grep Disk | grep -v “identifier” | grep -v “valid partition” | awk ‘{print $3}’ | wc -m`
    countHDD=`echo $[ $countHDD - 1 ]`
    HDD=`fdisk -l 2>&1 | grep “Disk” | grep -v “identifier” | grep -v “valid partition” | awk ‘{print $3 “”}’ | tr “\n” “,”| cut -c1-$countHDD`” GB [$No_of_HDDs HDD(s)]”
    else
    HDD=”not configured -deepak”
    fi
    #HDD Info————————]

    #Tomcat-Status——————-[
    tomcat_count=`ps -ef | grep catalina | grep -v "grep catalina" | grep -v "catalina.out"| wc -l`
    psid=`ps -ef | grep catalina | grep -v "grep catalina" | grep -v "catalina.out" | awk '{print $2}' | head -1`
    if [ $tomcat_count = 1 ]
    then
    tomcat_status=”Running. ( pid “`ps ax –width=1000 | grep “[o]rg.apache.catalina.startup.Bootstrap start” | awk ‘{printf $1 ” “}’`”)”
    KBusedbyTomcat=`pmap $psid 2>&1 | tail -1 | awk ‘{print $2}’ | cut -dK -f1`
    elif [ $tomcat_count -gt 1 ]
    then
    tomcat_status=”Not Running (There may be an error. Pid “`ps ax –width=1000 | grep “[o]rg.apache.catalina.startup.Bootstrap start” |awk ‘{printf $1 ” “}’`”)”
    else
    tomcat_status=”Not Running”
    KBusedbyTomcat=”0″
    fi
    #Tomcat-Status——————-]

    #Postgres-Status——————-[
    postgres_count=`ps -ef | grep postgres | grep -v "grep postgres" | wc -l`
    if [ $postgres_count -gt 0 ]; then
    postgres_status=”Running. ( pid “`ps ax –width=1000 | grep “postgres” | grep -v “grep postgres” | awk ‘{printf $1 ” “}’`”)”
    else
    postgres_status=”Not Running”
    fi
    #Postgres-Status——————-]

    echo “”
    echo ” Computer Name : $host_name”
    echo ” Operating System (Name) : $os_installed”
    echo ” Operating System (Description) : $os_name”
    echo ” OS Hardware platform : $hw_platform”
    echo ” System Date & Time : $date_n_time”
    echo ” IP address(es) given : $ip_address”
    echo ” CPU :$cpu [$no_of_cpu cpu(s)]”
    echo ” RAM installed : $RamSize”
    echo ” RAM available : $RAM_total_available”
    echo ” RAM used : $RAM_total_used”
    echo ” Hard disk(s) : $HDD”
    echo ” Users logged in : $users (in $no_of_users places)”

    echo “”
    echo ” Tomcat status : $tomcat_status”
    echo ” Memory used by Tomcat : $KBusedbyTomcat KB”
    echo ” Postgres status : $postgres_status”
    echo “”

    else
    echo “”
    echo “!!! Please Login as root !!!”
    echo “”
    echo “Please enter the password:”
    su
    fi

    #==========================End===============================

  2. Thank you guys

  3. When I run that script, I get:

    james@localhost Documents]$ sh mysystemconfig.sh
    mysystemconfig.sh: line 43: syntax error near unexpected token `(‘
    mysystemconfig.sh: line 43: `RamSize=`echo \`dmidecode –type 17 | grep “Size” | grep “MB” |awk ‘{print $2}’\` | tr ” ” “,”`” MB [$countRams RAM(s)]”’

    I am running PCLinuxOS KDE 2012-02 (32-bit) in a VM Workstation environment.

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>