Command-Line

如果您從程序中 ^Z,它會“停止”。怎麼轉回來?

  • February 12, 2014

我不小心“停止”了我的telnet過程。現在我既不能“切換回”它,也不能殺死它(它不會響應kill 92929,其中 92929 是程序 ID。)

所以,我的問題是,如果你在 linux 命令行上有一個停止的程序,你如何切換回它,或者殺死它,而不必求助於它kill -9

最簡單的方法是執行將其帶到前台:fg

$ help fg
fg: fg [job_spec]
   Move job to the foreground.

   Place the job identified by JOB_SPEC in the foreground, making it the
   current job.  If JOB_SPEC is not present, the shell's notion of the
   current job is used.

   Exit Status:
   Status of command placed in foreground, or failure if an error occurs.

或者,您可以執行以使其在後台繼續執行:bg

$ help bg
bg: bg [job_spec ...]
   Move jobs to the background.

   Place the jobs identified by each JOB_SPEC in the background, as if they
   had been started with `&'.  If JOB_SPEC is not present, the shell's notion
   of the current job is used.

   Exit Status:
   Returns success unless job control is not enabled or an error occurs.

如果您剛剛點擊,那麼只需不帶參數Ctrl Z地執行即可恢復工作。fg

引用自:https://unix.stackexchange.com/questions/109536