Wednesday, March 9, 2022

System Performance Commands

 

System Performance Commands

In this blog, I will be sharing some linux commands which might help you to understand the system’s internal activities.

Note: These commands are very safe to run on production environment other than strace.

Command            Usageuptime             Load Averagedmesg | tail       Kernal Errorsvmstat 1           Overall stats by timempstat -P ALL 1    CPU balanceiostat -xz 1       disk i/opidstat 1          process usagefree -m            Memory usagesar -n DEV 1       network i/osar -n TCP,ETCP 1  TCP statstop                check overview

How to monitor certain process only:

top -p 4360,4358ORhtop -p PID

Check Process tree(Useful to identify which parent process):

ps -ef f

show the connections an application is making including the port being used:

netstat -taucp | grep <pid or process name>

show open ports:

netstat -tulpn

Virtual memory Stats:

vmstat -Sm 1

System I/O:

iostat -xmdz 1

System Activity Reporter

sar -n DEV 1sar -n TCP,ETCP,DEV 1

Processor Related Statistics:

mpstat -P ALL 1

Socket Stats:

ss -s

System Call tracer:

strace -tttT -p 333strace -pt PID 2>&1 | head -100Note: Always use head -10 or so to get only first x call output otherwise it will show down system.

Sniff Packets:

tcpdump -i eth0 -w filenametcpdump -nr

Network Stats:

netstat -s

Process Stats:

pidstat -t 1

specify devices on which paging and swapping are to take place:

swapon -s (if swapon enabled)

LOSF:

lsof -iTCP -sTCP:ESTABLISHED

No comments:

Post a Comment