Background Linux Process, without Tmux

In the past, if I needed to move a process to the background I just used Tmux. Like if I’m on a remote server, I can just detach the process, log out, and it keeps running.

Tmux is great, but what can be annoying is when your keyboard hotkeys get into a conflict with Tmux. Sometimes you don’t want all the razzle dazzle complexity.

Reading these helpful Linux tips today, I found what looks like a basic alternative to Tmux for moving processes to the background.

I knew about Control-Z, but never tried this technique before. I’m writing this here, otherwise I’ll forget to try it ;-)

ctrl-z - move the current process to the background in a suspended state.

jobs -l - list the current background processes for the current tty session.

bg - tell the most recent background process to continue running in the background

fg - bring the most recent background process back to the foreground

disown -h - disown the most recent background job. This 
will remove it from your current tty session. It will 
not be able to be brought back to the foreground. You 
will have to control it either with kill or something 
else.

bg, fg, and disown can be used with the job number 
found in jobs -l. If you run jobs -l you will see the 
job number at the beginning of the line. If you want to 
bring the 2nd job to the foreground you run fg %2. If 
you want to disown the fourth job then you run disown 
-h %4, and so on.