It is possible to run Linux commands in the background. You are able to disconnect from the Virtual Machine (VM) and connect later, and commands continue to run in the background. This is useful if you need to run code that takes a long time.
The tmux command on the Linux command-line allows you to do exactly this. Using tmux you can run commands on the VM, logout, and reconnect to your running programs later.
You can tell that you are running tmux by the green bar along the bottom of your Linux command-line window.
Creating a new session
This command will start a new tmux session. You will see a new Linux command line that is running inside tmux. Each tmux session has a name, so you can have different sessions, and reference them by their unique names.
tmux new -s example01
Leaving (detaching) a session
This leaves a session, but it will keep running so you can resume the session later. When you are in your tmux session, type:
Ctrl-b followed by d
You can have more than one tmux session. To see the list of running sessions, use this command:
Resuming (attaching) a session
When you want to reconnect to a session that you have already started, use this command:
tmux attach -t example01
Stopping (killing) a session
Once you are finished with a tmux session, you can get rid of it using this:
tmux kill-session -t example01
OR, type the Linux command exit inside your tmux session