日期:2014-05-16  浏览次数:20612 次

Linux服务器管理常用命令

iptables屏蔽单个IP的命令是

?

iptables -I INPUT -s 124.115.0.199 -j DROP

?

?

查找大于100M的文件

?

find . -type f -size +1000000k

?

?

wget采集网站

?

wget -m -e robots=off -U "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6" "http://www.example.com/"

?

修改系统时间

?

date -s 15:27:30

clock -w

?

查看物理CPU个数

?

cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l

?

每个物理CPU中core的个数

?

cat /proc/cpuinfo | grep 'cpu cores' | uniq

?

逻辑CPU的个数

?

cat /proc/cpuinfo | grep "processor" | wc -l

?

逻辑CPU的个数=物理CPU×核数,如果不相等,表示服务器CPU支持超线程技术。

?

查看服务器型号

?

dmidecode |grep "Name"

?

?

查看系统是32位还是64位,有/lib64,表示系统为64位。无则表示系统为32位

?

ls -lF / | grep /$

?

查找PCI设置

?

lspci | grep Ether

?

查看特定端口的情况

?

losf -i:22

?

查看登录时间

?

查看系统启动信息

?

dmesg or dmesg | grep error

?

查看使用者登录时间

?

lastlog

?

查看设置系统服务

?

ntsysv, setup

?

删除某个时间以前文件,可以加到/etc/crontab

?

find /home/backup -type f -mtime +60 -exec rm -f {} \;

?

待增加.....