1. Use the command to check the 10 processes using Memory Ps-aux | Sort-k4nr | Head-n 10 2. You can use the command to check the 10 processes with the most CPU Ps-aux | Sort-k3nr | Head-n 10 3. Change the file user group and user chown-r admin.admin/xxx 4. change user rights chmod +x xxx 5. See if the port is occupied Netstat-an | grep Port number 7. View Java process Idjstack <pid> 8 with JPS. View disk consumption (Du view directory size, DF View disk usage) Df-h du-sh./* 9. Nginx Log Cutting #!/bin/bash
# # 0 Points Execute the script
# # The directory where Nginx log files are located
Logs_path1=/export/servers/nginx/logs/x.ppad5.paipai.com
Logs_path2=/export/servers/nginx/logs/c.ppad5.paipai.com
# # Get yesterday's YYYY-MM-DD
yesterday=$ (date-d "Yesterday" +%y-%m-%d)
# # Move Files
logs_name1= (x.ppad5.paipai.com_np x.ppad5.paipai.com_pv x.ppad5.paipai.com_access x.ppad5.paipai.com_error)
Logs_name2= (C.PPAD5.PAIPAI.COM_NC c.ppad5.paipai.com_access c.ppad5.paipai.com_error)
For ((i=0;i<${#logs_name1 [@]};i++));d o mv ${logs_path1}/${logs_name1[i]}.log ${logs_path1}/${logs_name1[i]}_${ Yesterday}.log;done
For ((i=0;i<${#logs_name2 [@]};i++));d o mv ${logs_path2}/${logs_name2[i]}.log ${logs_path2}/${logs_name2[i]}_${ Yesterday}.log;done
# # sends the USR1 signal to the Nginx main process. USR1 signal is re-opened log file KILL-USR1 $ (cat/export/servers/nginx/run/nginx.pid)
Linux Common commands