zoukankan      html  css  js  c++  java
  • find big file

    #!/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


  • 相关阅读:
    ecos 编译时无法找到 tclConfig.sh 和 tkConfig.sh
    gcc 的宏替换 __stringify
    CentOS 静态IP配置
    光照
    CUnit 安装
    git push not configured with USE_CURL_MULTI
    在VC中用FreeImage显示图片的简单方法
    vanilla kernel
    Eclipse CDT 对 Doxygen 型注释的支持
    己所不欲,人欲取之
  • 原文地址:https://www.cnblogs.com/james1207/p/3268669.html
Copyright © 2011-2022 走看看