Jump to content

Quick Reference of common used commands


Recommended Posts

Needed a quick reference to troubleshoot / monitor linux systems


Identify CPU/Hardware
dmidecode | less (shows everything in BIOS)
cat /proc/cpuinfo
less /proc/cpuinfo
lscpu (lists available cpus)
lshal (list all hardware visible by HAL)
lspci (shows all PCI devices)
lsusb (shows all USB devices)
lsblk (shows all block devices like hardrives, cdroms)
lsmod (shows installed device drivers/modules)
df -h (disk space usage)
du -h (estimate disk usage)
cat /proc/partitions (show partitions)
hdparm -i /dev/sda
hwinfo --short
hwinfo | more
grep processor /proc/cpuinfo | wc -l (If the load averages show that the load is increasing and is above the number of CPUs, you should look at what is causing the load. Load is a combined measure of CPU and I/O utilisation so top can be used to get real-time statistics.)
vmstat 5 10 (the free column shows that the amount of free memory, The si and so columns show the amount of data being transferred between the systems swap and its memory)
ifconfig -a
ifconfig -a|less
more  /etc/sysconfig/network-scripts/ifcfg-eth0
route -n
route (shows network route)
netstat -tulpn (list of all open ports)
Identify Memory
cat /proc/meminfo
free -m (shows memory and swap information)
free -mt
free -gt
Identify Kernel (Linux version)
cat /proc/version
uname -mrs
uname -a
lsb_release -a
cat /etc/*release*
top (display list of tasks)
ps aux (display all running processes)
ps aux | grep process-name
rpm -qa (shows what software is installed)
rpm -qa | grep 'software-name'
rpm -qa | less
ulimit -a (find out user limits)
ps -p $$ | tail -1 | awk '{ print $4 }'  (find out user shell)
tail -f /var/log/secure (view login logs)
vi /var/log/secure (view login logs)
grep 'something' /var/log/secure (view login logs)
who (whos logged on)
groups userid (shows what groups a user is a member of) note: could also do $ grep userid /etc/group
lid -g groupname (shows members of a group) note: could also do $ grep '^groupname' /etc/group
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...