涵盖很多命令
查看当前外网的IP地址
#w3m -no-cookie http://www.77cn.com.cn|grep-o‘[0-9]"{1,3"}".[0-9]"{1,3"}".[0-9]"{1,3"}".[0-9]"{1,3"}’
#w3m -no-cookie http://www.77cn.com.cn|grep-o’[0-9]"{1,3"}".[0-9]"{1,3"}".[0-9]"{1,3"}".[0-9]"{1,3"}’
#w3m -no-cookie -dump http://www.77cn.com.cn|grep -o’[0-9]"{1,3"}".[0-9]"{1,3"}".[0-9]"{1,3"}".[0-9]"{1,3"}’
查看当前监听80端口的程序
#lsof -i :80
查看当前网卡的物理地址
#arp -a | awk ‘{print $4}’ ifconfig eth0 | head -1 | awk ‘{print $5}’
立即让网络支持nat
#sudo echo 1 > /proc/sys/net/ipv4/ip_forward
#sudo iptables -t nat -I POSTROUTING -j MASQUERADE
查看路由信息
#netstat -rn sudo route -n
手工增加删除一条路由
#sudo route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
#sudo route del -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
修改网卡MAC地址的方法
#sudo ifconfig eth0 down 关闭网卡
#sudo ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE 然后改地址
#sudo ifconfig eth0 up 然后启动网卡
统计当前IP连接的个数
#netstat -na|grep ESTABLISHED|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq -c|sort -r -n
#netstat -na|grep SYN|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq -c|sort -r -n
统计当前20000个IP包中大于100个IP包的IP地址
#tcpdump -tnn -c 20000 -i eth0 | awk -F “.” ‘{print $1″.”$2″.”$3″.”$4}’ | sort | uniq -c | sort -nr | awk ‘ $1 > 100 ‘
屏蔽IPV6
#echo “blacklist ipv6″ | sudo tee /etc/modprobe.d/blacklist-ipv6
服务
添加一个服务
#sudo update-rc.d 服务名 defaults 99
删除一个服务
#sudo update-rc.d 服务名 remove
临时重启一个服务
#/etc/init.d/服务名 restart
临时关闭一个服务
#/etc/init.d/服务名 stop
临时启动一个服务
#/etc/init.d/服务名 start
设置
配置默认Java使用哪个
#sudo update-alternatives –config java
修改用户资料
#sudo chfn userid
给apt设置代理
#export http_proxy=http://xx.xx.xx.xx:xxx
修改系统登录信息
#sudo vim /etc/motd
中文
转换文件名由GBK为UTF8
#sudo apt-get install convmv convmv -r -f cp936 -t utf8 –notest –nosmart *
批量转换src目录下的所有文件内容由GBK到UTF8
#find src -type d -exec mkdir -p utf8/{} "; find src -type f -exec iconv -f GBK -t UTF-8 {} -o utf8/{} "; mv utf8/* src rm -fr utf8
转换文件内容由GBK到UTF8
#iconv -f gbk -t utf8 $i > newfile
转换 mp3 标签编码
#sudo apt-get install python-mutagen find . -iname “*.mp3” -execdir mid3iconv -e GBK {} ";
控制台下显示中文
#sudo apt-get install zhcon 使用时,输入zhcon即可
文件
快速查找某个文件
#whereis filename
#find 目录 -na
me 文件名
查看文件类型
#file filename
显示xxx文件倒数6行的内容
#tail -n 6 xxx
让tail不停地读地最新的内容
#tail -n 10 -f /var/log/apache2/access.log
查看文件中间的第五行(
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库ubuntu命令大全(2)在线全文阅读。
相关推荐: