- Free Command:
-
free -h: Display memory usage in human-readable format (KB, MB, GB).free -h
-
free -g: Display memory usage in gigabytes.free -g
-
free -m: Display memory usage in megabytes.free -m
-
free -k: Display memory usage in kilobytes.free -k
-
-
Vmstat Command:
-
vmstat: Display basic system performance stats (memory, CPU, processes, etc.).vmstat
-
vmstat -a: Show active memory and swap usage.vmstat -a
-
vmstat -d: Display disk statistics.vmstat -d
-
vmstat -s: Display summary of memory, swap, and disk statistics.vmstat -s
-
vmstat 4 5: Display performance stats every 4 seconds for 5 iterations.vmstat 4 5
-
vmstat -s m 4 5: Display memory statistics every 4 seconds for 5 iterations.vmstat -s m 4 5
-
-
Iostat Command:
-
iostat: Display input/output statistics for devices and partitions.iostat
-
Install
iostatif not installed:yum install sysstat
-
iostat 4 5: Display I/O statistics every 4 seconds for 5 iterations.iostat 4 5
-
-
Listing Open Files with
lsof-
Install
lsofCommand (if not installed):yum install lsof
-
To list open files by the user
root:lsof -u root
-
To list network files (all types of network connections):
lsof -N -i
-
To list open UDP network connections:
lsof -n -i UDP
-
To list open TCP network connections:
lsof -n -i TCP
-
To list open TCP port 22 (usually SSH):
lsof -n -i TCP:22
-
To list open UDP ports 22, 443, and 90:
lsof -n -i UDP:22,443,90
-
To list open UDP ports in the range 80-220:
lsof -n -i UDP:80-220
-
To list open files for process ID 6029:
lsof -n -p 6029
-
To list open IPv4 network connections:
lsof -n -i 4
-
To list open IPv6 network connections:
lsof -n -i 6
-
To get process IDs (PIDs) of files opened by the user
Armour:lsof -t -u Armour
-
- To kill processes opened by the user
Armourusing the process IDs (PIDs) retrieved fromlsof:kill -9 $(lsof -t -u Armour)