Linux?????????????
???????????? ???????[ 2014/9/10 11:07:16 ] ?????????????? Linux
????1??????????????????.tar??β????????????????????
????find . -name “*.tar” -exec mv {} ./backup/ ;
????????????30?????????100M??LOG??????????
????find . -name "*.log" –mtime +30 –type f –size +100M |xargs rm –rf {} ;
????д??????????????????3??????????*.log????????????
????find . -mtime +3 -name "*.log" |xargs rm -rf {} ;
????д????????????′???100k??????????/tmp???
????find . -size +100k -exec mv {} /tmp ;
????2??????????????????.zip??β??????????????????
????for i in `find . –name “*.zip” –type f `
????do
????unzip –d $i /data/www/img/
????done
????3??sed???????????test.txt??????
???????????????.???: sed -i 's/^.//g' test.txt
????????????????a???: sed 's/^/a/g' test.txt
????????β??????a???: sed 's/$/a/' tets.txt
??????????к???????c???: sed '/wuguangke/ac' test.txt
????????????????c???: sed '/wuguangke/ic' test.txt
????4??????ж???????????????????????????????????????
????if
????[ ! –d /data/backup/ ];then
????Mkdir –p /data/backup/
????else
????echo "The Directory already exists??please exit"
????fi
???????if …;then …else ..fi???if???????!?????????“??????“??-d????????
????5?????linux?????????????????????????????90%???????????Linux SA
????(1)?????????????С
????df -h |sed -n '//$/p'|awk '{print $5}'|awk –F ”%” '{print $1}'
????(2)??if?????ж???С??????90?????????90???????????
????while sleep 5m
????do
????for i in `df -h |sed -n '//$/p' |awk '{print $5}' |sed 's/%//g'`
????do
????echo $i
????if [ $i -ge 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
????done
????6?????Nginx????????????????????20 ?? ip?????
????cat access.log |awk '{print $1}'|sort|uniq -c |sort -nr |head -20
????7??sed????????÷????????У???????????к?????????
????sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
????Sede???? sed -i ‘s:/tmp:/tmp/abc/:g’test.txt??????/tmp???/tmp/abc/??
????11???????????????????С???
????cat a.txt |sort -nr|awk ‘{}END{print} NR==1′
????cat a.txt |sort -nr |awk ‘END{print} NR==1′
?????????????????????С???sed ‘s/ / /g’ a.txt |sort -nr|sed -n ’1p;$p’
????13????????????jk??β???滻??yz??
????sed -e ‘s/jk$/yz/g’ b.txt
????14???????????tcpdump
????tcpdump -nn host 192.168.56.7 and port 80 ??56.7???80????????????
????tcpdump -nn host 192.168.56.7 or ! host 192.168.0.22 and port 80 ???0.22 80????
????16??????????20??????
????cat .bash_history |grep -v ^# |awk ‘{print $1}’ |sort |uniq -c |sort -nr |head -20
????19??д???????????y?????????????????????????80????
????iptables -F
????iptables -X
????iptables -A INPUT -p tcp --dport 80 -j accept
????iptables -A INPUT -p tcp -j REJECT
????????
????iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
????20??д??????????nginx??????????????ip????10??(nginx???·????/home/logs/nginx/default/access.log)??
????cd /home/logs.nginx/default
????sort -m -k 4 -o access.logok access.1 access.2 access.3 .....
????cat access.logok |awk '{print $1}'|sort -n|uniq -c|sort -nr |head -10
????21.д??????????????
??????1??MaxKeepAliveRequests 100 ????????????
??????2??Options FollowSymLinks ????192.168.1.1????????
????Order Deny Allow
????Deny from all
????Allow from 192.168.1.1
????22.?滻????е???
????sed 's:/user/local:/tmp:g' ??test.txt
????????
????sed -i 's//usr/local//tmp/g' test.txt
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11