DEV Community

Connor Bode
Connor Bode

Posted on

Jobs in Linux

I've recently switched to VIM as my full-time editor. I now have, more or less, two tools I use: the terminal, and the web browser.

One trick I've found essential to using VIM full-time is being able to pause it, run a bash command, then jump back into VIM.

Here's a concrete example:

  1. I create a new file in VIM
  2. I realize I named the file file.css when I meant to name is file.scss
  3. I jump out of VIM, into a shell, and run mv file.css file.scss

This leads into the topic of this article: how can we run multiple processes in one shell?

Jobs in Linux

This ends up being quite simple:

  • To pause the current program (for example, vim): Ctrl+Z
  • To list all paused programs: jobs
  • To jump back into a paused program: fg <job_number> (or just fg if you have only one job)
  • To run a paused program in the background: bg <job_number>

Hope you found this tip useful!


If you're interested in Linux, VIM, Django, Python, React/RN and just tech in general, follow me on dev.to or on Twitter @connorbode!

You can also find me on the web at matix.io.

Top comments (4)

Collapse
 
miniscruff profile image
miniscruff •

I use need tree to move and rename files. Running commands you can do :! and then a command to run straight from vim. Like ":! echo cool".

Also :term will open a terminal as a buffer if you have a vim 8 or neovim.

Collapse
 
connorbode profile image
Connor Bode •

People love NerdTree! I'm trying to avoid it as I want to be proficient without having to install any plugins for VIM.

:! <cmd> and :term are excellent ideas, thank you!

Collapse
 
chsanch profile image
Christian Sánchez •

Another approach could be to use Tmux or Screen.

Collapse
 
connorbode profile image
Connor Bode •

Yes, absolutely, there are many methods for running multiple processes in a single shell!