Switching jobs within a terminal
November 21st, 2006 toydi Posted in Common, fg, jobs | Hits: 10771 |
While writing a script in a text editor, suddenly, I sense a strong desire to refer the bash manual. To stop the current job and return to shell prompt, press Ctrl+z, and here’s what I see:
Use "fg" to return to nano.
[1]+ Stopped nano lotr.sh
$
I type man bash and start reading. To switch back to the text editor, again, I press Ctrl+z to stop the current job, and use fg - to resume (to the second previous job, notice the extra minus ‘-’ sign):
[2]+ Stopped man bash
$ fg -
Why the second previous job? When I Ctrl+z out from man bash, man bash has become my previous job. I may use fg or fg + to resume it. But that’s not what I want, so I use fg -, it means to resume to the job before the previous job.
Confusing? ;-) Ha, it will be crystal clear when you list ‘em out and try it yourself:
$ jobs
[1]- Stopped nano lotr.sh
[2]+ Stopped man bash
Live Chat!







November 21st, 2006 at 1:32 pm
Haha its time for you to learn up vim, vim have build in function key bind to look for manuals, move your cursor to the desire word and press shift k.
Refers to http://lne.blogdns.com/lbe/archives/10/searching-man-page-inside-vi-editor/
December 7th, 2006 at 9:23 pm
there have another way to resume the jobs you want:
if you have a lot of jobs in background, you able to use this
to resume any jobs ‘n’ in background.
June 28th, 2007 at 2:55 am
[...] 5 is the starting point and 7 is the string length for sub string. Related Posts Switching jobs within a terminal While writing a script in a text editor, suddenly, I sense a strong desire to refer the bash manual. To stop the current… [...]