a non-geek's blog

Random notes on linux and web development

How to get system info in Linux

with 17 comments

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)

 

About these ads

Written by nongeekboy

August 18, 2008 at 9:10 am

17 Responses

Subscribe to comments with RSS.

  1. For Distro

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

    Full Hard ware specs

    sudo or su lshw

    Regards

    Shashwat

    August 18, 2008 at 5:53 pm

  2. Thank you Shashwat for the tips.
    I will add this info to my post.
    Thanks,
    Marius

    nongeekboy

    August 18, 2008 at 7:26 pm

  3. There’s a standalone (read: printable report) version of Open-AudIT. http://www.open-audit.org

    Mark unwin

    August 19, 2008 at 11:28 am

  4. 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.

    Coyote

    August 19, 2008 at 1:36 pm

  5. For SUSE Linux Enterprise Server:

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

    kah00na

    August 19, 2008 at 3:08 pm

  6. 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

    kah00na

    August 19, 2008 at 3:16 pm

  7. 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 “”

    coolScript

    August 19, 2008 at 5:45 pm

  8. “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.

    Tenzer

    August 20, 2008 at 6:55 am

  9. @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

    nongeekboy

    August 20, 2008 at 7:51 am

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

    kostadin

    August 21, 2008 at 2:04 am

  11. Cpuinfo Links…

    Tagged your site as cpuinfo at iLinkShare!…

  12. 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.

    Coyote

    August 23, 2008 at 12:08 am

  13. @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

    nongeekboy

    August 23, 2008 at 9:43 am

  14. [...] Come ottenere informazioni su un sistema Linux: impariamo ad ottenere le più importanti informazioni dalla nostra linuxbox, per monitorare le sue prestazioni ed eventualmente migliorarle; [...]

  15. is there any way that i can get the info such as CPU speed, RAM, HDD, NIC in simple command?

    fir

    January 23, 2009 at 7:38 am

  16. 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.

    nongeekboy

    January 23, 2009 at 3:04 pm

  17. 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.

    Cleta

    October 18, 2012 at 2:26 pm


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

Join 200 other followers

%d bloggers like this: