跳轉到內容

Unix/命令/程序管理指南

來自華夏公益教科書,開放的書籍,開放的世界

nohup 允許您以一種忽略掛起訊號的方式執行程式。這可以用於在使用者登出後使程式繼續執行。程式的輸出將從標準輸出重定向到檔案 nohup.out。

示例

$ nohup wget http://foo.org/foo_list.gz
nohup: appending output to `nohup.out'
$

連結

ps 顯示當前程序及其屬性的列表。

示例

當前使用者擁有的程序

$ ps
  PID TTY          TIME CMD
17525 pts/0    00:00:00 su
17528 pts/0    00:00:00 bash
17590 pts/0    00:00:00 ps where pid is process id.

所有程序

$ ps -A

連結

kill 用於向程序傳送終止訊號。

示例

要向程序 ID 為 17525 的程序傳送 kill 訊號,

$ kill -9 17525

要向所有程序傳送 kill 訊號,

$ kill -9 -1

參見 Unix指南/命令/程序管理/Kill

連結

pgrep 搜尋和殺死系統程序

示例: 檢查 apache 伺服器是否正在執行。

$ pgrep -f apache
 5580
 5581
 5582
 5583
 5584
 5585
or
$ svcs -a | grep -i apache.

連結

使用 'pkill' 程式停止 xterm 程式

$ pkill -9 xterm

提示: 顯示使用者的所有程序

$ pgrep -l -u arky
894 bash
895 bash
897 bash
898 bash
899 bash
1045 links
1396 startx
1407 xinit
1411 openbox
1412 xterm
1413 xfaces
1414 xsetroot
1415 emacs

連結

pidof 顯示任務的程序 ID (PID)

示例: 顯示 emacs 程序的 PID

$ pidof emacs
1415

連結

  • pidof, manpages.ubuntu.com

killall 按名稱殺死程序

示例

殺死 'xfaces' 程式

$ killall xfaces

連結

華夏公益教科書