You are on page 1of 4

# to know which process listens on tcp port 80:

fuser 80/tcp
# to know which process uses the /dev/sdb1 filesystem:
fuser -vm /dev/sdb1

atop
top [z,A,p,o]
htop
iptraf

iptstate – Iptables state

bmon – graphs/tracks network activity/bandwidth real time.


etherape – great visual indicator of what traffic is going where on the network
wireshark – tcpdump on steroids.
multitail – tail multiple files in a single terminal window
swatch – track your log files and fire off alerts

iotop
vnstat

iftop
nethogs

dstat
mpstat
iostat
ifstat
netstat
vmstat
vnstat
sar

mtr
mtrace
traceroute
tracepath

lsof
nmap

strace
dtrace
mtrace
gdb

Run strace against /bin/foo and capture its output to a text file in output.txt:
$ strace -o output.txt /bin/foo
You can strace the webserver process and see what it's doing. For example, strace
php5 fastcgi process, enter:
$ strace -p 22254 -s 80 -o /tmp/debug.lighttpd.txt
To see only a trace of the open, read system calls, enter :
$ strace -e trace=open,read -p 22254 -s 80 -o debug.webserver.txt

tcpdump

# tcpdump -n -i eth1 -s 0 -w output.txt src or dst port 80


# tcpdump -ni eth0 'dst 192.168.1.5 and tcp and port http'
# tcpdump -i eth1 'dst 202.54.1.5 and (port 21 or 20)'
# tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) !=
0)'

wireshark
ethereal
ss
pmap -d <pid>

mpstat -p ALL

sar
sar 4 5
# sar -n DEV -f /var/log/sa/sa24 | more
# sar -n DEV | more

ps -p 19358 -o comm=

Find Out The Top 10 Memory Consuming Process


# ps -auxf | sort -nr -k 4 | head -10
Find Out top 10 CPU Consuming Process
# ps -auxf | sort -nr -k 3 | head -10

Set Output In a User-Defined Format


# ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
# ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
# ps -eopid,tt,user,fname,tmout,f,wchan

Display Only The Process IDs of Lighttpd


# ps -C lighttpd -o pid=

The top command provides several useful hot keys:


Hot
Usage
Key
t Displays summary information off and on.
m Displays memory information off and on.
Sorts the display by top consumers of various system resources. Useful for
A
quick identification of performance-hungry tasks on a system.
Enters an interactive configuration screen for top. Helpful for setting up
f
top for a specific task.
o Enables you to interactively select the ordering within top.
r Issues renice command.
k Issues kill command.
z Turn on or off color/mono

Tload

watch

watch --interval=5 "ps aux | grep foozle | grep -v xaprb"

# ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’

You might also like