首页 > 代码库 > linux 常用命令。。。持续更新
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`
for i in $str
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 常用命令。。。持续更新