Grep time command output

后端 未结 5 1134
长情又很酷
长情又很酷 2021-02-02 06:38

Using time ls, I have the following output:

$ time ls -l 
total 2
-rwx------+ 1 FRIENDS None 97 Jun 23 08:59 location.txt
-rw-r--r--+ 1 FRIENDS None         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-02 07:32

    Look out.. bash has a built-in "time" command. Here are some of the differences..

    # GNU time command (can also use $TIMEFORMAT variable instead of -f)
    bash> /usr/bin/time -f%e ls >/dev/null
    0.00
    
    
    # BASH built-in time command (can also use $TIME variable instead of -f)
    bash> time -f%e ls >/dev/null
    -f%e: command not found
    
    real    0m0.005s
    user    0m0.004s
    sys     0m0.000s
    

提交回复
热议问题