1. Tea//break

(Tea//break #1) How to run commands in background Linux

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.

Problem

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.

Solution: “screen”

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.

Installation

sudo apt-get install screen

Usage

  • start a new screen session: #screen
  • exit current screen session: Ctrl+a+d
  • list current sessions: #screen -ls
    screen sessions
  • reconnect to a session: #screen -r “session ID”
    (for example, #screen -r 107699)

Enjoy your tea!

Comments to: (Tea//break #1) How to run commands in background Linux

Your email address will not be published. Required fields are marked *