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.
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins

- My 10 UNIX Command Line Mistakes
- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
Facebook it - Tweet it - Print it -
We're here to help you make the most of sysadmin work. So, subscribe!


{ 33 comments… read them below or add one }
Also uname -r displays the kernel version.
-narayanan
OMG I forgot to mention uname :/? thanks for pointing out I will update post :)
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
uname -r
is for kernel name..
uname -a
is for kernel information.
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. :)
Thanks.
Thanks.
Thanks for the nice info.
Hi , is there a command to list the installed TAPE Drive device under CENTOS/REDHAT ?
example names: /dev/st0 or /dev/rt0
Thanks much.
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.
ya senip you are write….
uptime or top or w is used to see how long system is running..
what is the command that displays system diagnostic information?
what is the command that displays system diagnostic information?
In solaris its prtdiag.
command to find the Linux Version:
cat /etc/issue
Command to find Hostname, Kernel Version etc
uname -a
Thanks for hte commands.
THANK YOU VERY MUCH FOR PROVIDING INFO
how to find the no of Unix/Linux servers present in your network / enevironment.
your help is appreciated.
great stuff!!
hdparm -i /dev/hda
HI
This is useful notes for you
What is the LINUX command to find out the version of the softwares installed on a particular LINUX m/c??
rpm -qa
very nice updates………………
Excellent list of commands. Waiting for more onces.
very nice stuff….thanks alot
Very nice
can you please help me to get the command to get the power info in linux ?
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”
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…
thank you
thanks……..
is there a command line way to find out how many unused hard drive bays my computer has?
very nice update….thanks alot