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


  • 相关阅读:
    数据结构(三)栈与递归
    机器学习(二)------ 回归
    数据结构(二)线性表
    数据结构(一)数据结构基础
    机器学习 (一)------分类
    操作系统概述
    NumPy函数库基础
    总线与输入输出子系统
    FT VIEW SE高效开发之全局对象
    STUDIO 5000 V32新CRACK和新功能
  • 原文地址:https://www.cnblogs.com/james1207/p/3268669.html
Copyright © 2011-2022 走看看