Very practical common Linux O & M commands and knowledge! 2

Source: Internet
Author: User

A collection of Common commands:

1. Search for all tar files and move them to the directory: Find. -name "*. tar "-exec MV {}. /backup/; 2. Search for I in 'Find. -name *. HTML | SED's /. // G' | SED's/html /. html/g''; do echo http: // 192.168.0.170: 8017 $ I; done

3. Remove the. character at the beginning of the line:
Find. -name *. HTML | SED's/^. // g'4. Find the file type and back up it to another directory: Find. -Name nginx. conf. tgz-exec CP {} DIR/; 5. Monitors Linux disk partitions. If the disk space exceeds 90%, send an email to Linux SA.
(1) print the root partition size
DF-H | sed-n' // $/P' | awk '{print $5}' | awk-F "%" '{print $1 }'
(2) The if condition determines whether the size is greater than 90. If the size is greater than 90, send an email alarm while sleep 5 m
Dofor I in 'df-H | sed-n' // $/P' | awk '{print $5}' | SED's/% // G''
Do
Echo $ IIF [$ I-GT 90]; then
Echo "more than 90% Linux of disk space, please Linux SA check Linux disk !" | Mail-s "Warn Linux/parts is $ I %" wugk@map.com
Fi
Done
Done6. Collect Apache access logs. The top 20 IP addresses are accessed: CAT access. log | awk '{print $1}' | sort | uniq-c | sort-Nr | head-207, add a http://img.map.com before all rows, and add/
Sed-E's/^/http://img.map.com/maplite/map/subway/1.1/'-E's/$ // 'a.txt
8. Find the current row and modify the parameters following the row:
Sed-I '/SELinux/S/disabled/enforcing/'/etc/SELinux/config
9. Find and modify the names of all folders in the directory:
Find.-Name "naviinfo.2010.12.0" | xargs rename naviinfo.2010.12.0 naviinfo.2010.12.1
10. view the number of Apache concurrent connections and related forwarding statuses:
Netstat-N | awk '/^ TCP/' | awk '{print $ NF}' | sort | uniq-c | sort-NR
Netstat-N | awk '/^ TCP/{++ s [$ NF]} end {for (a in S) print, s [a]} '11. Print the maximum and minimum values in a file:
Cat a.txt | sort-Nr | awk '{} end {print} Nr = 1 ′
Cat a.txt | sort-Nr | awk 'end {print} Nr = 1 ′
This is the true maximum and minimum values for printing: SED's // G' a.txt | sort-Nr | sed-N '1p; $ P' 12. Use snmpd to capture cacti data of version V2:
Snmpwalk-v2c-C public 192.168.0.241
13. Modify the text to replace JK with yz:
Sed-E's/JK $/YZ/G' B .txt
14. Network Packet Capture: tcpdump
Tcpdump-nn host 192.168.56.7 and port 80 capture packets 56.7 request through 80.
Tcpdump-nn host 192.168.56.7 or! Host 192.168.0.22 and port 80 exclude port 0.22 80!
TCP/IP Layer 7 protocol physical layer-data link layer-network layer-Transport Layer-Session Layer-presentation layer-application layer. 15. Configure group name for H3C: first, set the SNMP version as follows:
SNMP-Agent sys-Info version V1 v2c, and then set the group name: SNMP-Agent Community read public
16. display the 20 most commonly used commands:
Cat. bash_history | grep-V ^ # | awk '{print $1}' | sort | uniq-c | sort-Nr | head-20


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.