Check Network Traffic Linux Part 1

You need to monitor performance Linux Server? Try the following command. Most Linux distributions will be in complete with many monitoring tools. This tool will measure the activity system. With this tool we can find out the cause of the problem that occurred. Basic commands in the following described be beneficial especially for analysis and debugging the server to issue,

1. Look for bottlenecks.
2. Disk (storage) bottlenecks.
3. CPU and memory bottlenecks.
4. Network bottleneck.

top = Command to view the process activities
Top real time gives an overview of a system that is running the process. By default, it will display the process that is using the CPU and update him every 5 seconds.

The top command has several hot key is a very useful as
t = Show summary information off and on
m = View memory information off and on.
A = Sort display based on the user of most system resources.
f = log onto interactive configuration screen to the top.
o = allows us to interactively select the sequence in the top
r = issued orders renice.
k = issued orders to kill a process.
z = turn on or turn off color or mono.

vmstat = Activity systems, Hardware and Hardware Information
The command vmstat reports information about processes, memory, paging, block IO, traps and cpu activity.
vmstat 3

Displays the memory usage Slab info
vmstat -m

Get information about memory on/off
vmstat -a

w = looking for who's logged in and what he is doing
the w command displays information about the users who are on the inside of the machine and display the process from the user.
w username
w onno

uptime = Tells how long the system has been running
The uptime command can be used to see how long the server has been running. More details of these commands let you know the current time, how long the system is running, how many users are currently logged in and the average server load at 1, 5 and 15 minutes.

ps = displays the process
The ps command will report a snapshot of the current processes. To select all processes use the option -A or -e.
ps -A

ps like top but provides more information.
See the long format output
ps -Al

Turn on extra full mode (showing the command line arguments in the process):
ps -AlF

View threads (LWP and NLWP)
ps -AlFH

View threads after processes
ps -AlLm

Displays all processes on the server
ps ax
ps axu

Displays the process tree
ps -ejH
ps axjf

Displays security information
ps -eo euser,ruser,suser,fuser,f,comm,label
ps axZ
ps -eM

To see every process running as user onno
ps -U onno -u onno u

Set the output is suit we desire
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

Show only the process ID of Lighttpd
ps -C lighttpd -o pid=
pgrep lighttpd
pgrep -u vivek php-cgi

Displays the name of PID 55977
ps -p 55977 -o comm=

Find out the 10 most memory consuming process many
ps -auxf | sort -nr -k 4 | head -10

Find out 10 CPU consuming process most
ps -auxf | sort -nr -k 3 | head -10

Click here for Comments