列出目录下大于多少的文件列表
时间:2008-05-07 来源:jordanfang
列出目录下大于多少的文件列表
#/bin/sh
DIR=/root/soft
cd $DIR
if [ $? -ne 0 ];then
echo "the directory is not existed"
else
RESULT=`ls -l | awk '{if ($5>1988306) print $9}'`
if [ -n "$RESULT" ];then
echo $RESULT
else
echo "All is ok"
fi
fi
[root@work_monitor ~]# ll
total 2468
-rwxr-xr-x 1 root root 282 May 7 20:09 check_largefile_sh
[root@work_monitor ~]# lsof
cupsd 2126 root txt REG 8,1 376844 196331 /usr/sbin/cupsd
如果是lsof的话
条件则是$7 再print $9
#/bin/sh
DIR=/root/soft
cd $DIR
if [ $? -ne 0 ];then
echo "the directory is not existed"
else
RESULT=`ls -l | awk '{if ($5>1988306) print $9}'`
if [ -n "$RESULT" ];then
echo $RESULT
else
echo "All is ok"
fi
fi
[root@work_monitor ~]# ll
total 2468
-rwxr-xr-x 1 root root 282 May 7 20:09 check_largefile_sh
[root@work_monitor ~]# lsof
cupsd 2126 root txt REG 8,1 376844 196331 /usr/sbin/cupsd
如果是lsof的话
条件则是$7 再print $9
相关阅读 更多 +