How to get system info in Linux

Here are some useful commands that you can use to find (almost) every information that you want to know about your system from the command line. Most of this commands can be run as non-privileged user, but more information can be obtained if (and should be) run as root.:

linux_inside
General system information:
# uname -a
Process information:
# top

(Shift-M to order the list by memory use)

Memory information:
# free -m
BIOS information:
# dmidecode | less
Read more >>(UPDATE: The link is broken. Sorry)

 

18 thoughts on “How to get system info in Linux

  1. For Distro

    Ubuntu lsb_release -a
    Redhat/Mandriva/Fedora cat /etc/osname_version

    Full Hard ware specs

    sudo or su lshw

    Regards

  2. For getting your IP address you might find the command route -n a little easier. Gives you your IP address, netmask, and gateway address (router) all in one quick shot.

  3. For SUSE Linux Enterprise Server:

    $cat /etc/SuSE-release
    SUSE Linux Enterprise Server 10 (s390x)
    VERSION = 10
    PATCHLEVEL = 2

  4. SUSE Linux Enterprise Server:
    chkconfig – displays status of all servcies started at runtime
    arch – architecture of the server (i586, i686, s390x, etc.)
    dmesg – displays all kernel messages since bootup
    lsmod – Show kernel modules that have been loaded
    swapon -s – shows the current paging space usage

  5. cat si.sh
    GREP_OPTIONS=’–color=never’

    # This only works for Linux and Solaris. Skip to bottom for AIX and HP-UX
    if [ “`uname -s`” = “Linux” ] || [ “`uname -s`” = “SunOS” ] ; then

    echo “”
    echo “System Information”
    echo “”
    echo -n “Node Name: “;uname -n
    echo -n “Operation System: “;uname -s
    echo -n “Version: “;uname -r
    echo -n “Hardware: “;uname -i
    echo -n “Machine Type: “;uname -m
    echo “”

    if [ “`uname -s`” = “Linux” ] ; then
    echo “Processor Information:”
    cat /proc/cpuinfo | grep “vendor_id” -m 1
    cat /proc/cpuinfo | grep “name” -m 1
    cat /proc/cpuinfo | grep “MHz” -m 1
    echo “”
    echo -n “Number of Processors: “;cat /proc/cpuinfo | grep vendor_id | wc -l
    echo “”
    cat /proc/meminfo | grep “MemTotal\|MemFree”
    echo “”
    fi

    if [ “`uname -s`” = “SunOS” ] ; then
    echo “Processor Information:”
    if [ “`uname -r`” = “5.10” ] ; then
    /usr/sbin/psrinfo -vp
    else
    /usr/sbin/psrinfo -v
    fi
    echo “”
    echo -n “Number of Processors: “;/usr/sbin/psrinfo -v | grep “Status of ” | wc -l
    echo “”
    /etc/prtconf | grep Memory
    echo “”
    fi

    echo “IP Address:”
    if [ “`uname -s`” = “SunOS” ] && [ “`uname -r`” = “5.10” ] || [ “`uname -r`” = “5.9” ] ; then
    /sbin/ifconfig -a | /usr/xpg4/bin/grep -E ‘[0-9]*\.[0-9]*\.[0-9]*’ | sed ‘s/^[ \t]*//’ | /usr/xpg4/bin/grep -v “127.0.0”
    echo “”
    echo -n “Number of NICs: “;/sbin/ifconfig -a | /usr/xpg4/bin/grep -E ‘[0-9]*\.[0-9]*\.[0-9]*’ | sed ‘s/^[ \t]*//’ | /usr/xpg4/bin/grep -v “127.0.0” | wc -l
    else
    /sbin/ifconfig -a | grep -E ‘[0-9]*\.[0-9]*\.[0-9]*’ | sed ‘s/^[ \t]*//’ | grep -v “127.0.0”
    echo “”
    echo -n “Number of NICs: “;/sbin/ifconfig -a | grep -E ‘[0-9]*\.[0-9]*\.[0-9]*’ | sed ‘s/^[ \t]*//’ | grep -v “””127.0.0” | wc -l
    fi

    echo “”
    echo “Release Information:”
    cat /etc/*release 2>/dev/null

    fi

    # AIX
    if [ “`uname -s`” = “AIX” ] ; then

    echo “”
    echo “System Information”
    echo “”
    echo “Node Name: \c”;uname -n
    echo “Operation System: \c”;uname -s
    echo “Version: \c”;uname -v
    echo “Release: \c”;uname -r
    echo “Hardware: \c”;uname -M
    echo “Machine Type: \c”;uname -p

    echo “”
    echo “Processor Information:”
    lscfg -vpl proc0 | grep Name: | sed ‘s/^[ \t]*//’
    pmcycles
    echo “Number of Processors: \c”; lscfg -vp | grep proc | wc -l

    fi

    # HP-UX
    if [ “`uname -s`” = “HP-UX” ] ; then

    echo “”
    echo “System Information”
    echo “”
    echo “Node Name: \c”;uname -n
    echo “Operation System: \c”;uname -s
    echo “Version: \c”;uname -r
    echo “Hardware: \c”;uname -m

    echo “”
    echo “Processor Information:”
    /usr/contrib/bin/machinfo | grep “processor model” | sed ‘s/^[ \t]*//’
    /usr/contrib/bin/machinfo | grep “Clock speed” | sed ‘s/^[ \t]*//’
    /usr/contrib/bin/machinfo | grep “Number of CPUs” | sed ‘s/^[ \t]*//’
    fi

    echo “”
    echo “Summary:”
    uname -a
    echo “”

  6. “cat /etc/debian_version” also works.
    “mdadm –misc –detail /dev/md0” gives information about a software RAID device.
    “cat /proc/meminfo” gives a lot of memory information.
    “cat /proc/version” is probably the best way to find out what distro you are running, in case you don’t know.

  7. @coyote
    Command inserted in the post.
    @kah00na
    I added lsmod because this command don’t has any correspondence in my initial list.
    @Coolscript
    I tried your script on my Archlinux, but that are some info’s that are not displayed. I will work on it to see where is the problem.
    @Tenzer
    I agree with you. The info in /proc are a very fast way to find the most important info about the OS and PC.
    Thank you all for your suggestions.
    Regards

  8. who -r shows runlevel
    cat /proc/partitions show artitions even unmounted
    acpi -t shows temperatures
    nmap -sV shows daemons versions

  9. Ah sorry, didn’t see that you inserted route -n . Was in a hurry. Still
    can’t hurt though to point out the quick and dirty. ifconfig can be a bit busy when getting someone’s homenetwork up n’ going on Linux.

  10. @Coyote

    Well, the first version of the post didn’t had route -n. I inserted it as a result of your comment; that was the idea behind “Command inserted in the post”. Sorry for not being very clear in my answer and thanks again for the tip. One more thing, I agree with you about the “quick and dirty ifconfig”.

    Regards,
    Marius

  11. Hello fir!
    I am afraid there is no such command. At least, I don’t know one. Anyway, the commands posted in this article are simple, so you could use them.

  12. Hello there! I know this is somewhat off topic but I was
    wondering which blog platform are you using for this site?

    I’m getting sick and tired of WordPress because I’ve had issues with hackers
    and I’m looking at alternatives for another platform. I would be fantastic if you could point me in the direction of a good platform.

Leave a reply to kah00na Cancel reply