[Linux] Linux 個人常用指令
Linux指令實在沒辦法都記下來, 放在網誌上做紀錄, 以後方便查 How to find file by giving time range? find . -newermt "2014-09-30 12:00:00" ! -newermt "2014-09-30 15:00:00" How to output shell variable string length? # usage ${#variable} words="this is a test" echo ${#words} # result 14 length How to transfer mass files from one server to antoher(not SCP way) ssh $host 'cd $directory; find . -type f -name "some file name" | tar czvf - --files-from -' | tar zxvf - -C $path How many files in a directory? ls -1 $directory/ | grep -c "" Generate Password apg -n 1 -M NL -a 0 -m 10 -x 15 # Generate a random but human-readable password from 10 to 15 characters long made with only lower case letters and numbers Check OS port usage (may work with grep) netstat -tulnap Problem: Argument list too long 起因: exec() 這個會太長(相當多指令會call到這個Linux function) 判斷: getconf ARG_MAX 會顯示有多少限制, 這是字串長度, 所以並不是檔案個數, 而是argument的總字串長度 (所以ls /home/xxx/yyy/* 會比