linux常用的命令

#查看硬盘使用空间
df -h
#挂载路径      查看挂载硬盘的硬盘读取速度
hdparm -t 
#这是查找小于100k的文件
$find /etc -size  -1000000c  -print 
#这是查找大于50k的文件,
$find /etc -size  +50000c  -print 
#查找当前目录下 大于1M的文件
find . -maxdepth 3 -size +1000000c;   

find /etc -size -100k -size +50k -exec ls -ldh {} \;

#如何查找指定日期创建的文件或文本文件里有特定内容的文件?
#用find
#找到当前目录下7天以前的文件
find . -type f -mtime +7 -print 
#查找当前目录下包含keyword
find . -type f -print -exec grep <keyword>; {} \; 


#递归查找某个目录下包含的某个字符串的并有指定后缀的文件
find /tmp/ -type f -name "*.t" -exec grep -l "jin" {} \;

#如何查找指定日期创建的文件或文本文件里有特定内容的文件?
#n天前那天改过的文件
find . -mtime n -print       
#n天以前改过的文件 
find . -mtime +n -print      
#n天前至今改过的文件
find . -mtime -n -print       

#查询指定目录下 1天以内被修改过的php文件
find /home/chinawolong.com/public_html -mtime -1 -type f -name \*.php

grep -r --include=*.php  '[^a-z]eval($_POST' . > grep.txt
grep -r --include=*.php  'set_time_limit(999999)' . > grep.txt

grep word_u_know ./*

iptables -I INPUT -s 219.140.48.190 -j DROP
iptables -I INPUT -s 122.228.208.11 -j DROP

/etc/rc.d/init.d/iptables save
service iptables restart
#这是查找小于100k的文件
$find /etc -size  -1000000c  -print 
#这是查找大于50k的文件,
$find /etc -size  +50000c  -print 
#查找当前目录下 大于1M的文件
find . -maxdepth 3 -size +1000000c;   

find /etc -size -100k -size +50k -exec ls -ldh {} \;

#查找当前目录下 以下3层 大于1M的以tar结尾的文件 并删除
find . -maxdepth 3 -name "*.tar" |xargs rm -rf;

#如何查找指定日期创建的文件或文本文件里有特定内容的文件?
#用find
#找到当前目录下7天以前的文件
find . -type f -mtime +7 -print 
#查找当前目录下包含keyword的文件
find . -type f -print -exec grep <keyword>; {} \;

#如何查找指定日期创建的文件或文本文件里有特定内容的文件?
#n天前那天改过的文件
find . -mtime n -print        
#n天以前改过的文件
find . -mtime +n -print      
#n天前至今改过的文件
find . -mtime -n -print       

grep word_u_know ./*

iptables -I INPUT -s 219.140.48.190 -j DROP
iptables -I INPUT -s 122.228.208.11 -j DROP
#查看磁盘文件最大
du -sh /*                    
#查看磁盘剩余
df -lh                      

find . -name "plus" -maxdepth 3 | xargs rm -rf

find . -name "member" -maxdepth 3 | xargs rm -rf

find . -name "install" -maxdepth 3 | xargs rm -rf

find . -name "plus"| xargs rm -rf

find . -name "oaqcgood.php"| xargs rm -rf

/etc/rc.d/init.d/iptables save
service iptables restart

#批量替换文件内容
sed -i "s/$dbuser= 'root'/$dbuser= 'jtcm'/g" /home/*/public_html/ak/configs/config.inc.php
#批量替换 config.inc.php 文件中 把 dbuser= 'root'   替换为 dbuser= 'jtcm'
#查看路由
traceroute www.baidu.com

标签: none

添加新评论