Linux關閉命令行正在執行的程序


  1. Ctrl + C 終止    是強制中斷程序的執行,,進程已經終止。
  2. Ctrl + Z   是將任務中止(暫停的意思),但是此任務並沒有結束,他仍然在進程中他只是維持掛起的狀態,用戶可以使用fg/bg操作繼續前台或后台的任務,fg命令重新啟動前台被中斷的任務,bg命令把被中斷的任務放在后台執行。
  3. Ctrl + S 掛起
  4. Ctrl + Q 解掛
  5. Ctrl + D 退出Shell

 

https://superuser.com/questions/262942/whats-different-between-ctrlz-and-ctrlc-in-unix-command-line

CTRL+Z stops (pauses) a job

CTRL+C terminates a job

with CTRL+C you cannot resume the process but with CTRL+Z the job can be resumed by just entering at the command promt:

fg %1

if you have multiple processes paused then you should do

jobs

to see the output and select the appropriate number to resume e.g.

fg %3

resumes the third job in the list. You can also have jobs running in the background with

bg %n

where n is the job number.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM