#!/bin/bash
#command usage description
function usage()
{
echo -e "Usage:nt$0 DIR_NAME"
exit
}
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to use it!!!"
exit 1
fi
#judge the argv
if [ $# -ne 1 ]
then
echo "the usage of the command is ERROR!!!"
usage
fi
dir_name=$1
i=0
if [ ! -d $dir_name ]
then
echo "the argv is not a direction!!!"
usage
else
cd $dir_name
echo "pwd: " `pwd`
du -ahS | sort -nr |
while read line
do
myline=`echo $line | awk '{print $2}'`
if [ -f $myline ] && [ $i -lt 5 ]
then
echo $line
let i++
fi
done
fi
#!/bin/bash
#command usage description
function usage()
{
echo -e "Usage:nt$0 DIR_NAME"
exit
}
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to use it!!!"
exit 1
fi
#judge the argv
if [ $# -ne 1 ]
then
echo "the usage of the command is ERROR!!!"
usage
fi
dir_name=$1
i=0
if [ ! -d $dir_name ]
then
echo "the argv is not a direction!!!"
usage
else
cd $dir_name
echo "pwd: " `pwd`
du -ahS | sort -nr |
while read line
do
myline=`echo $line | awk '{print $2}'`
if [ -f $myline ] && [ $i -lt 5 ]
then
echo $line
let i++
fi
done
fi
find big file
最新推荐文章于 2024-01-31 19:47:06 发布