In the shell (I'm using Bash), I frequently use Ctrl-Z and fg to suspend one job and foreground another. An example would be suspending a running instance of Vim and foregrounding a previously suspended REPL. I started Vim with an alias that resolves to /usr/local/bin/vim, and the output of jobs looks like:

$ jobs
[1]+  Stopped       /usr/local/bin/vim print1.hs
[2]   Stopped       stack ghci

I could use fg 2 to specify the stack ghci job-spec, but I prefer using tab-completion:

fg s<Tab>

Similarly, to tab-complete the Vim job-spec, I could fg /<Tab>, but it would feel more intuitive to do:

fg v<Tab>

I have a vague recollection of reading about "renaming" job-specs. Is such a thing possible?

  • 1
    You may want to consider using a more advanced shell like zsh which does that out of the box. – Stéphane Chazelas Sep 12 '17 at 19:59
  • @StéphaneChazelas Good to know. I've been intending to try zsh for a while now. Maybe it's time to finally get around to it. – ivan Sep 12 '17 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.