2016年5月17日 星期二

[Ubuntu] Linux 指令筆記


  • 將使用者加入Sudoer檔
  • #sudo adduser sudo

  • 使用指定的使用者執行程式
  • #su -c '${program_name}' ${username}
    example:
    #su -c 'php test.php' www-data

  • 針對某Program發Signal
  • #ps -aux | grep ${program_name} | grep "grep" -v | awk '{print $2}' | xargs kill -${signal_num}
    example:
    #ps -aux | grep test.php | grep "grep" -v | awk '{print $2}' | xargs kill -15

  • 找尋大於某Size的檔案
  • #find . -type f -size -4096c
    Parameter:
    `b' for 512-byte blocks (this is the default if no suffix is used)
    `c' for bytes
    `w' for two-byte words
    `k' for Kilobytes (units of 1024 bytes)
    `M' for Megabytes (units of 1048576 bytes)
    `G' for Gigabytes (units of 1073741824 bytes)

  • 查詢硬體與系統設定的關係
    #lshw

    // 查詢網路卡
    #lshw -class network

沒有留言:

張貼留言