Sei sulla pagina 1di 2

Basic Commands

All commands need to be executed only with support ID, except few commands under supervision of any
senior

CPU / Process

top -n1
mpstat
mpstat -P ALL
sar 1 3
sar -u 2 5
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -5 //To top 5 process
ps -eo pcpu,pid,user,args | sort -r -k1 | less
ps -auxf | sort -nr -k 3 | head -10 //Find Out top 10 CPU Consuming Process
ps -axuwww |sort -n +2 |tail -20
iostat
vmstat 1 5
top -n1
uptime
iostat //Average CPU Load, Disk Activity

Informati/status

ps-ef|grep catalina //To check the tomcat process


dmidecode //Reports information about your system's hardware as
described in your system BIOS according to the SMBIOS/DMI standard
uname a
more /etc/redhat-release

Disk Related

df h
du sh * /home //To details
du -ah | sort -n
du -shk * | sort -rn
du -sh dir1
df -h -T
du -ah | sort n
du -H --max-depth=1 /var | sort -n r //To sort directory by size of contents (Ex: /var)

Memory Related

free -t m // lays a line containing the totals memory in MB


grep MemTotal /proc/meminfo
watch cat /proc/meminfo //Use control+C to exit
dmesg | grep Memory
ps -auxf | sort -nr -k 4 | head -10 //Find Out The Top 10 Memory Consuming Process

Swap Related

cat /proc/swaps
swapoff /dev/sda3 //Ex: to disable swap
swapon /dev/sda3 //Ex: to enable swap

swapon/swapoff commands will be executed with root ID only and under supervision of seniors

Boot/Reboot related information

who b //last reboot time and date


last reboot | less //how many times reboot
last -x|grep shutdown //how many times shuttedwon
sar -n DEV | more //To see network counter
sar -n DEV -f /var/log/sa/sa24 | more //To display the network counters from the 24th:
sar 4 5 //To display real time usage
mpstat -P ALL //To display average CPU utilization per processor
pmap -d PID //display process memory information
grep "physical id" /proc/cpuinfo | sort -u |wc l //To check physical CPU on a system

cat /proc/cpuinfo //information about cpu


cat /proc/meminfo //information about memory
cat /proc/mounts //information about mountpoints
more /etc/resolve.conf //List DNS servers for internet domain name resolution
more /etc/hosts //Lists hosts to be resolved locally (not by DNS)
more /etc/sysconfig/network //Specify network configuration. eg. Static IP, DHCP, NIS, etc
and hostname.

netstat -punta //List externally connected processes


netstat nap //List all connected processes:
netstat s //Show network statistics
netstat nlpt | grep httpd //List opened http ports
netstat -autpn | grep :80
netstat -autpn | grep :3306
netstat -na
netstat -an|grep :80|sort|more
netstat -an|grep ESTABLISHED
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | more
ps ax | awk '$3 ~ /^D/ { print $0 }'
netstat -an | grep :80 | wc -l

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

ps aux | head -1; ps aux | sort -rn +2 | head -10 Displaying top CPU_consuming processes:
ps aux | head -1; ps aux | sort -rn +3 | head Displaying top 10 memory-consuming processes:
ps -eakl | head -1; ps -eakl | sort -rn +5 Displaying process in order of being penalized:
ps -eakl | sort -n +6 | head Displaying process in order of priority:
ps -eakl | sort -n +7 Displaying process in order of nice value
ps vx | head -1;ps vx | grep -v PID | sort -rn +3 | head -10 //Displaying the process in order of time
ps vx | head -1; ps vx | grep -v PID | sort -rn +6 | head -10 //Displaying the process in order of real
memory use

ps vx | head -1; ps vx | grep -v PID | sort -rn +4 | head -10 //Displaying the process in order of I/O
ps -a -o pid, user, class, pcpu, pmem, args //Displaying WLM classes
ps vg | head -1; ps vg | grep -w wait //Determinimg process ID of wait processes:
ps -mo THREAD -p <PID> //Wait process bound to CPU

Potrebbero piacerti anche