
Monitoring various aspects of your system
Author: John M. Gabriele | back to index
- System Monitoring
- General
- Who has which files open?
- CPU
- Memory
- CPU and processes
- disk info
- Network traffic
- Network settings
- Users
- Log files
---
System Monitoring
Many of the following commands can be run by the watch command,
which runs a command for you every 2 seconds and shows the ouput
full-screen.
More general info here:
- http://www.tldp.org/LDP/sag/html/system-monitoring.html
- http://www.karakas-online.de/gnu-linux-tools-summary/
- http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/admin-primer/s1-resource-rhlspec.html
General
The /proc directory is chock full of system information. Some utilities
will process that info a bit to make it more digestible.
lsmodvmstatuname -acat /etc/debian_versioncat /proc/version
Who has which files open?
fuser <filename> [...]-- show processes using specified file. Use-uto show the actual username.lsof <file_name>-- see the end of its man page for examples.
CPU
cat /proc/cpuinfo
Memory
free-- Use with-mto see it in MB
CPU and processes
top-- Show the table of processes, updated liveps -el-- List all processes ("every" one of them) in long format.ps -eo pid,tt,user,fname,args,%cpu --sort %cpu-- Like before, but sort by cpu usage. Nice.pstree
disk info
fdisk -lcat /etc/mtabdf -h-- Shows how disk space is being used on all mounted partitions.du -hs [directory|file] ...-- Shows how much space a given directory or file (or many of them) are taking up.
Network traffic
mtr <url|ip_address>-- Matt's traceroute.ping <url|ip_address>traceroute <url|ip_address>-- example:tcpdump -i eth0 src or dst host 10.0.0.3
Network settings
routeifconfig -anetstat -nlsof -i :<port_num>
Users
last-- listing of last logged-in users
Log files
tail -f /var/log/messages-- Tail this file, as well as others in/var/log.