Linux command to gathers up information about a Linux system

by on December 15, 2005 · 43 comments· LAST UPDATED August 2, 2007

in , ,

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/libc.so*

Find out user limits:

ulimit -a

Find out installed device drivers (modules)

lsmod

Find out information about an X server:

xdpyinfo

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

OR

free -m

OR

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
route

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

uname
w

Show who is logged on and what they are doing

w
who

Display list of tasks

top

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.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 43 comments… read them below or add one }

1 Ranganathan St. December 15, 2005 at 3:18 pm

Also uname -r displays the kernel version.

-narayanan

Reply

2 LinuxTitli December 15, 2005 at 5:30 pm

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

Reply

3 Gurumurthy July 5, 2007 at 4:23 am

Hi,

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?

Thanks,
Guru

Reply

4 pranith November 13, 2011 at 4:57 pm

uname -r
is for kernel name..

uname -a
is for kernel information.

Reply

5 clyde July 18, 2007 at 8:45 am

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. :)

Reply

6 Gaurav December 16, 2008 at 1:24 pm

Thanks.

Reply

7 pranjith c January 8, 2009 at 4:32 am

Thanks.

Reply

8 Thirupathi Uppu January 12, 2009 at 3:04 am

Thanks for the nice info.

Reply

9 jordanx February 9, 2009 at 4:39 pm

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

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

Thanks much.

Reply

10 Senip Gib April 7, 2009 at 12:11 pm

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.

Reply

11 pranith November 13, 2011 at 4:52 pm

ya senip you are write….

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

Reply

12 hussein abdallah June 15, 2009 at 11:41 am

what is the command that displays system diagnostic information?

Reply

13 hussein abdallah June 15, 2009 at 11:42 am

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

Reply

14 anil September 16, 2009 at 3:00 pm

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

Command to find Hostname, Kernel Version etc
uname -a

Reply

15 vasuki October 2, 2009 at 7:07 pm

Thanks for hte commands.

Reply

16 deepak November 9, 2009 at 2:17 am

THANK YOU VERY MUCH FOR PROVIDING INFO

Reply

17 venu February 2, 2010 at 8:43 pm

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

your help is appreciated.

Reply

18 libran March 2, 2010 at 7:01 pm

great stuff!!

Reply

19 anonymous April 27, 2010 at 9:55 pm

hdparm -i /dev/hda

Reply

20 KALAIARASU CHANDERBOSE May 26, 2010 at 3:38 pm

HI
This is useful notes for you

Reply

21 Smita Kamdar August 13, 2010 at 10:06 am

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

Reply

22 Suman Kant May 10, 2011 at 6:44 pm

rpm -qa

Reply

23 lalman verma October 11, 2010 at 7:41 am

very nice updates………………

Reply

24 Ankit Shah November 1, 2010 at 7:20 am

Excellent list of commands. Waiting for more onces.

Reply

25 srinivas March 2, 2011 at 8:52 am

very nice stuff….thanks alot

Reply

26 Lacarte Claby July 17, 2011 at 4:13 pm

Very nice

Reply

27 els engineer July 18, 2011 at 2:54 pm

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

Reply

28 Vlad July 29, 2011 at 2:14 pm

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”

Reply

29 AristaTechno October 9, 2011 at 9:06 am

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…

Reply

30 bhaskar December 5, 2011 at 4:51 am

thank you

Reply

31 S.Ashok kumar December 15, 2011 at 12:43 am

thanks……..

Reply

32 yo-g January 10, 2012 at 6:20 pm

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

Reply

33 rajan January 20, 2012 at 10:39 am

very nice update….thanks alot

Reply

34 Vipul Solanki February 12, 2012 at 8:12 pm

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

Reply

35 monr4 February 14, 2012 at 3:45 pm

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

Reply

36 Gary March 14, 2012 at 3:44 pm

Thanks for the commands. It helped out a lot.

Reply

37 dhanraj singh April 28, 2012 at 9:47 am

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

Reply

38 zivag November 26, 2012 at 4:23 pm

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.

Reply

39 Debashis Biswas January 13, 2013 at 2:57 pm

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

Reply

40 Jalal Hajigholamali March 30, 2013 at 9:39 am

Hi,
Thanks for useful information

but:

Find how long the system has been running

uname
w

uname just show Unix/Linux name….

Reply

41 kalpesh Tailor December 24, 2013 at 10:16 am

Very good Information about Linux command Line.
Thanks.

Reply

42 Drew February 5, 2014 at 7:17 am

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.

Reply

43 Ravi May 6, 2014 at 9:43 am

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

Thanks for the above information..

Reply

Leave a Comment

Tagged as: , , , , , , , , , ,

Previous post:

Next post: