\1. Press oracleSID to query the IP address of the client connected to the database

netstat -anpT | grep oracleSID | awk '{print $5}' | grep -o -E  '1.*:' | awk -F ':' '{print $1}' | sort
Copy the code

\2. Query the IP address of the client connected to the database by listening port 1521

netstat -anpT | grep 1521 | awk '{print $5}' | grep -o -E  '1.*:' | awk -F ':' '{print $1}' | sort
Copy the code

\3. Kill the client process that connects to the database oracleSID on the database server

kill -9 `ps -ef | grep oracleSID | grep LOCAL=NO | grep -v grep | awk '{print $2}'`
Copy the code

\4. Delete all processes under user userA

pkill -9 -u userA
Copy the code

\5. Query the number of processes connected to port 1521

netstat -pan |grep 1521 |wc -l
Copy the code

\6. Query the number of processes connected to 192.168.21.15

Netstat - pan | grep 192.168.21.15 | wc -lCopy the code

\7. Sum up the number of connections for each client IP connected to port 1521

netstat -apnT|grep 1521 |awk  '{print $5}'|sort -u |grep -v 1521 |grep -v '*' |awk -F ':'  '{print $4}'|uniq -c |sort -nrnetstat -anpT|grep 1521 |awk  '{print $5}'|grep -o -E  '1.*:' |awk -F ':' '{print $1}' | sort |uniq -c |sort -nr
Copy the code

\8. Display the top 10 files or directories that occupy the most space

du -s * | sort -nr | head
Copy the code

\9. Count the total size of all files on a given day

ls --full-time `find ./* -name "log_*.bak"` | grep '2016-05-09' | awk '{print $9}' | xargs du -ck
Copy the code

\10. Delete files from a few days ago

find /mitac/mds/arch/ -ctime +150 -exec rm -rf {} \; Find /mitac/ MDS /arch/ -name '*836701255. DBF '-ctime +150 -exec rm -rf {} \; Delete files ending with 836701255. DBF that were modified 150 days agoCopy the code

\11. Top 10 PROCESSES with the most CPU usage:

ps auxw|head -1; ps auxw|sort -rn -k3|head -10Copy the code

\12. Top 10 memory consuming processes

ps auxw|head -1; ps auxw|sort -rn -k4|head -10Copy the code

\13. Top 10 processes with the most virtual memory usage

ps auxw|head -1; Ps auxw | sort - rn - k5 | head - 10 top press 1, you can see how many CPU, press shift + p is ordered by the CPU, press shift + m sort by memoryCopy the code

\ 14.vi replaces all strings, substituting 1 for 2 as follows

:%s/1/2/g
Copy the code

\15. Check the I/O information. The following information is displayed every second for three times (MB)

iostat -d -x -m 1 3
Copy the code

\16. Check how long it takes to cp a file file1 to /u01

time cp file1 /u01/
Copy the code

\17. Check the CPU usage between 7:00 and 9:00

sar -s 07:00:00 -e 10:00:00
Copy the code