红联Linux门户
Linux帮助

Linux command to gathers up information

发布时间:2007-12-26 00:01:01来源:红联作者:pixsvtrn
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 -mrsuname -acat /proc/version
Dump or display memory information and swap information:
free -m
Network card and IP address information:
ifconfig -aifconfig -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 -nroute
Display list of all open ports
netstat -tulpn
View login related logs
tail -f /var/log/securevi /var/log/securegrep 'something' /var/log/secure
View mail server related logs
tail -f /var/log/maillogvi /var/log/mailloggrep 'something' /var/log/maillog
Find how long the system has been running
unamew
Show who is logged on and what they are doing
wwho
Display list of tasks
top
Display all running process
ps auxps aux | grep process-name
Display list of all installed software on Redhat / CentOS / Fedora
rpm -qarpm -qa | grep 'software-name'rpm -qa | less
Display list of all installed software on Debian / Ubuntu
dpkg --list
文章评论

共有 0 条评论