Linux Common commands

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.