Linux command to gathers up information about a Linux system

If you are developing an application for Linux desktop and would like to automatically find out more information about system, use the following commands in shell scripts to gather information about system. Recently I was involved in project where I need to collect information about running GUI, browser and other information such as disk space, running kernel etc.

Find out KDE Desktop version:

konqueror --version

Find out Gnome Desktop version:

gnome-panel --version

Find out Mozilla browser version:

mozilla --version

Find out Firefox browser version:

firefox --version

Find out current Language:

set | egrep '^(LANG|LC_)'

Find out disk space usage:

df -h

Find/Estimate file space usage:

du -h

Find out version of Linux glibc:

ls -l /lib/libc-*.so /lib/*

Find out user limits:

ulimit -a

Find out installed device drivers (modules)


Find out information about an X server:


It can find out:

  • Name of display:
  • Version number
  • Vendor name (such as The XFree86 Project)
  • Vendor release number
  • And XFree86 version number

Find out information about Linux CPU

cat /proc/cpuinfo

Find out information about Linux Memory

cat /proc/meminfo


free -m


free -g

Find out user shell name:

ps -p $$ | tail -1 | awk '{ print $4 }'

Dump Linux kernel variables

/sbin/sysctl -a

Find out running Linux kernel version:

uname -mrs
uname -a
cat /proc/version

Dump or display memory information and swap information:

free -m

Network card and IP address information:

ifconfig -a
ifconfig -a|less

Debian / Ubuntu Linux network configuration file (all interface eth0,eth1,…ethN)

more /etc/network/interfaces

Redhat / CentOS / Fedora Linux network configuration file (eth0)

more  /etc/sysconfig/network-scripts/ifcfg-eth0

Note replace eth1 for 2nd network card and so on.

Display routing information

route -n

Display list of all open ports

netstat -tulpn

View login related logs

tail -f /var/log/secure
vi /var/log/secure
grep 'something' /var/log/secure

View mail server related logs

tail -f /var/log/maillog
vi /var/log/maillog
grep 'something' /var/log/maillog

Find how long the system has been running


Show who is logged on and what they are doing


Display list of tasks


Display all running process

ps aux
ps aux | grep process-name

Display list of all installed software on Redhat / CentOS / Fedora

rpm -qa
rpm -qa | grep 'software-name'
rpm -qa | less

Display list of all installed software on Debian / Ubuntu

dpkg --list

Once information collected it can be easily send as an email to help desk. You can use all above command to gathers information about a remote Linux system over secure ssh session (see related functions that gathers up information about a Linux and FreeBSD system). Best part is all above commands runs in non privileged mode.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 44 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
44 comments… add one
  • Ranganathan St. Dec 15, 2005 @ 15:18

    Also uname -r displays the kernel version.


  • LinuxTitli Dec 15, 2005 @ 17:30

    OMG I forgot to mention uname :/? thanks for pointing out I will update post 🙂

  • Gurumurthy Jul 5, 2007 @ 4:23


    May I know the command to find out the Linux version. Is this the same command ‘uname -a’ which prints the kernel version? Both are same?


    • pranith Nov 13, 2011 @ 16:57

      uname -r
      is for kernel name..

      uname -a
      is for kernel information.

  • clyde Jul 18, 2007 @ 8:45

    nice information… but how can i run the cat /proc/cpuinfo as a user log in only? sudo or su in the first was not still recognize it. 🙂

  • Gaurav Dec 16, 2008 @ 13:24


  • pranjith c Jan 8, 2009 @ 4:32


  • Thirupathi Uppu Jan 12, 2009 @ 3:04

    Thanks for the nice info.

  • jordanx Feb 9, 2009 @ 16:39

    Hi , is there a command to list the installed TAPE Drive device under CENTOS/REDHAT ?

    example names: /dev/st0 or /dev/rt0

    Thanks much.

  • Senip Gib Apr 7, 2009 @ 12:11

    There’s mistake on one of the entries. To monitor how long a system has been up; use these commands:

    “uptime” or “top” or “w”

    The word uptime; mentally, is usually the easiest to remember which is funny considering it’s a bigger word than the rest, hehe.

    • pranith Nov 13, 2011 @ 16:52

      ya senip you are write….

      uptime or top or w is used to see how long system is running..

  • hussein abdallah Jun 15, 2009 @ 11:41

    what is the command that displays system diagnostic information?

  • hussein abdallah Jun 15, 2009 @ 11:42

    what is the command that displays system diagnostic information?
    In solaris its prtdiag.

  • anil Sep 16, 2009 @ 15:00

    command to find the Linux Version:
    cat /etc/issue

    Command to find Hostname, Kernel Version etc
    uname -a

  • vasuki Oct 2, 2009 @ 19:07

    Thanks for hte commands.

  • deepak Nov 9, 2009 @ 2:17


  • venu Feb 2, 2010 @ 20:43

    how to find the no of Unix/Linux servers present in your network / enevironment.

    your help is appreciated.

  • libran Mar 2, 2010 @ 19:01

    great stuff!!

  • anonymous Apr 27, 2010 @ 21:55

    hdparm -i /dev/hda

  • KALAIARASU CHANDERBOSE May 26, 2010 @ 15:38

    This is useful notes for you

  • Smita Kamdar Aug 13, 2010 @ 10:06

    What is the LINUX command to find out the version of the softwares installed on a particular LINUX m/c??

    • Suman Kant May 10, 2011 @ 18:44

      rpm -qa

  • lalman verma Oct 11, 2010 @ 7:41

    very nice updates………………

  • Ankit Shah Nov 1, 2010 @ 7:20

    Excellent list of commands. Waiting for more onces.

  • srinivas Mar 2, 2011 @ 8:52

    very nice stuff….thanks alot

  • Lacarte Claby Jul 17, 2011 @ 16:13

    Very nice

  • els engineer Jul 18, 2011 @ 14:54

    can you please help me to get the command to get the power info in linux ?

  • Vlad Jul 29, 2011 @ 14:14

    The “Find how long the system has been running” section is wrong.
    It says that the commands are : “uname” and “w”, but it should list the commands:
    “uptime” and “top”

  • AristaTechno Oct 9, 2011 @ 9:06

    Very Information information on this website.

    I think google should first find this site in its search engine and than rest of others.

    I have always found too many of my needs or commands for day to day task from this site.

    keep up…

  • bhaskar Dec 5, 2011 @ 4:51

    thank you

  • S.Ashok kumar Dec 15, 2011 @ 0:43


  • yo-g Jan 10, 2012 @ 18:20

    is there a command line way to find out how many unused hard drive bays my computer has?

  • rajan Jan 20, 2012 @ 10:39

    very nice update….thanks alot

  • Vipul Solanki Feb 12, 2012 @ 20:12

    I wanna Simple Learning Soft Copy Book Of Linux, Would U Help Me ?

  • monr4 Feb 14, 2012 @ 15:45

    Hi, is there a command or tool for recolect the system info??? something like Sunexporer?

  • Gary Mar 14, 2012 @ 15:44

    Thanks for the commands. It helped out a lot.

  • dhanraj singh Apr 28, 2012 @ 9:47

    Hi i am dhanraj singh I want to learn linux please provide to me linux notes soft copy

  • zivag Nov 26, 2012 @ 16:23

    dmidecode will give you hardware info on the system. All of it, including make and model of the pc, chassis, N/SB. Like this:
    Handle 0x0002, DMI type 2, 8 bytes. Base Board Information
    Manufacturer: Intel
    Product Name: C440GX+
    Version: 727281-001
    Serial Number: INCY92700942
    Read man dmidecode for more.

  • Debashis Biswas Jan 13, 2013 @ 14:57

    Hey i’m gonna devolop an operating system.At this time i already gathered minimal info but i cn’t understnd after completing kernel,then what to to for other program applications….so plz help me.plz help me how to arrenge all programs upon kernel…..plzzzzz…….

  • Jalal Hajigholamali Mar 30, 2013 @ 9:39

    Thanks for useful information


    Find how long the system has been running


    uname just show Unix/Linux name….

  • kalpesh Tailor Dec 24, 2013 @ 10:16

    Very good Information about Linux command Line.

  • Drew Feb 5, 2014 @ 7:17

    Does anyone know of a Linux command to obtain the server model number/name?

    I am not speaking of the dmidecode info as that all points to the actual internal hardware components…..I need the model number/name of the actual server all hardware components are installed into…not sure if Linux can provide this information or not??

    Any assistance is appreciated.

  • Ravi May 6, 2014 @ 9:43

    command to configure newly attached hardware ?&
    how to find hardware configuration ?

    Thanks for the above information..

  • leandro Aug 26, 2017 @ 15:05

    thanks a lot, very helpful, in particular last & lastb commands!

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum