Skip to main content
alaxkar
Staff
Staff
March 5, 2025

Technical Tip: How to use the screen command to run a command in the background

  • March 5, 2025
  • 0 replies
  • 447 views
Description This article describes how to run a command in the background while using PuTTY or any SSH session on Linux, use the screen command, which allows to run processes that will continue running even if the session is disconnected.
Scope FortiSIEM.
Solution

Step 1. Start a Screen Session with the below command:

 

screen

 

Note:

If it is the return command not found run the below command:

 

yum install -y screen 

 

Step 2: Run commands that need to execute and want to run continue. 

 

Step 3: Detach from the Screen Session. To detach from the screen command session (so that it keeps running in the background even after disconnect), press:

Ctrl + A, then D

This will detach from the session but leave the command running.

 

Step 4: Reattach to the Screen Session . To reconnect to the screen session later, use the following command:

screen -r

If there are multiple sessions, use:

screen -r <session_id>

List all screen sessions with:

screen -ls

This is how the screen command can be used to terminate the Putty session and the command needs to be run continually.