CTRL+C Interrupting a Process
Many (but not all) command line programs can be interrupted by using CTRL+C.
$ xlogo # 运行 xlogo 后,shell 处于等待 xlogo 结束的状态,此时 Press CTRL+C^C$
& Putting a Process in the Background Immediately
$ xlogo &[1] 8108$
This message is part of a shell feature called job control. With this message, the shell is telling us that we have started job number 1 ([1]) and that it has PID 28236.
$ psPID TTY TIME CMD7288 pts/1 00:00:00 bash8180 pts/1 00:00:00 xlogo8120 pts/1 00:00:00 ps
jobs List Jobs
$ jobs[1]+ Running xlogo &
fg Returning a Process to the Foreground
**fg %jobspec**
If we have only one background job, the jobspec(job numer) is optional.
$ fg %1xlogo
CTRL+ZStopping (Pausing) a Process**CTRL+Z**does 2 things:Stop a process without ternimating it;
- Place the process in the background.
After stopping xlogo program, the xlogo window does not respond to window resizing.$ xlogo^Z[1]+ Stopped xlogo &
We may usebgPutting a Process in the Background Manuallybgto move a process from the foreground to the background If we launch a graphical program from the command line but forget to place it in the background by appending the trailing$.
- First, stop the program by pressing CTRL+Z;
- Second, run
bg %jobspec- As with the
fg, If we have only one background job, the jobspec(job numer) is optional.$ xlogo # forget the trailing $^Z[1]+ Stopped xlogo &$ bg %1$
- As with the
