Linux Background Commands

Execute Background Tasks

You you can have a command execute in the background with one of two ways:

Execute a command with & at the end of the command, which will execute the process in the background.

nide -b &  

Execute a command, type Ctrl-z, and then run bg.

nide -b  
Ctrl-z  
bg  

Ctrl-z will suspend the currently running foreground process and return you to the prompt. The bg command will convert the suspended process to a background process and unsuspend it.

Listing Background Tasks

You can list out all background processes with jobs

bmancini@ubuntu:~/source/todo$ jobs  
[1]-  Running                 nide -b &
[2]+  Running                 node server &

Bring a Task to the Foreground

You can use the fg command to bring a task to the front by specifing the background id for that task.

fg 1  
comments powered by Disqus