linux 常用命令。。。持續更新
1、Linux掛載Winodws共享文件夾
mount -t cifs -o username=name,password=123 //172.16.3.56/d /guaizai
2、查看http的並發請求數及其TCP連接狀態:
netstat -an | awk ‘/^tcp/{s[$NF]++}END{for (a in s)print a,s[a]}‘
3、用tcpdump嗅探80端口的訪問看看誰最高
tcpdump -i eth0 -tnn dst port 80 -c 100 | awk -F"." ‘{print $1"."$2"."$3"."$4}‘ | sort | uniq -c |
4、查看當前系統每IP連接數
netstat -an | awk -F"[ :]+" ‘{s[$6]++}END{for (a in s) print s[a],a}‘ | sort -nr | head
5、shell下32位隨機密碼生成
head /dev/urandom | md5sum | head -c 30
6、統計出apache的access.log中訪問量最多的5個IP
awk ‘{s[$1]++}END{for (a in s)print a,s[a]}‘ access.log | sort -nr
7、找出TMP目錄中已txt結尾!並將重命名為*.sh
#!/bin/bash
str=`find /tmp/ -name \*.txt`
do
mv $i ${i%txt}sh
done
8、查看ssh惡意鏈接
cat /var/log/secure | grep "Failed password" | egrep -o "([0-9]{1,3}\.){3}[0-9]" | sort -nr | uniq -c
9、查看用root登陸失敗的ip
cat /var/log/secure |grep " Failed password for root"| egrep -o "([0-9]{1,3}\.){3}[0-9]"| sort -nr | uniq -
10、通過pid查看進程路徑
ll /proc/pid
本文出自 “紙炮團” 博客,請務必保留此出處http://qiaivheise.blog.51cto.com/7743217/1953346
linux 常用命令。。。持續更新