We are starting a new concept in our Privacy Library. We will call it “tea break”. The idea is to learn something new in less than 5 minutes. The topic of the tea break #1 is How to run commands in background Linux.
We have all faced this annoying thing when installation over SSH has been interrupted by a sudden connection issue. Most of the times we had to re-start the script after we noticed that terminal session was aborted. This could be avoided if the install script was running in the background.
screen allows to run a background session within your current session. You can connect to screen, run the install screen and disconnect from screen. You can run multiple screen sessions at a time.
sudo apt-get install screen
- start a new screen session: #screen
- exit current screen session: Ctrl+a+d
- list current sessions: #screen -ls
- reconnect to a session: #screen -r “session ID”
(for example, #screen -r 107699)
Enjoy your tea!