2010年9月27日 星期一

利用指令rename大量取代或更改檔名

rename可以用來大量取代檔案名稱的共同部分,使用起來也很簡單:
1rename IMG img IMG*
第一個參數是被替換掉的字串,
第二個參數是要替換成的字串,
第三個參數是要替換的檔案清單
這樣就會把所有大寫的IMG檔名替換成小寫的img了。
--

2010年9月23日 星期四

linux統計執行一段指令所需的時間

Ex:跑個程式,有辦法知道程式從執行到結束所花的時間~
這個時候可以使用time這個指令
--
time ./test.sh

執行完後畫面如下
real 0m0.374s
user 0m0.004s
sys 0m0.032s
--
man time
These statistics consist of(i) the elapsed real time between invocation and termination,
(ii) the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2)),(iii) the system CPU time (the sum of the tms_stime and tms_cstime values in a struct tms as returned by times(2)).

參考來源:http://phorum.study-area.org/index.php?action=printpage;topic=55443.0