Sometimes we want to work in detached mode to prevent connection loss during long running processes.
The ‘screen‘ command detach a long running process/program/shell-script from a session and is re-attached at a later time.
The process that was initiated from the screen is running and managed by the screen even when the session is detached.
We can re-attach the session at a later time, and our terminals are still there, the way we have left them.

Screen Command Usage

  • To enter into screen mode use screen command.
  • Optionally, if we want to name this screen use -S e.g screen -S ‘Ashu is working’
  • Now do required work in screen mode.
  • To detach a screen use CTRL + a + d (Press CTRL + a followed by d to detach current running screen)
  • To list out running screen sesssions: screen -ls
  • To attach to a running screen user screen -r <Name_Of_Detached_Screen>

Summary:

  • screen # to enter into screen mode
  • ctrl + a + d # Detache from sreen mode but proces keep running
  • screen -ls # tells all program running via screen
  • screen -r 5363.pts-0.app999 # To resume process “5363.pts-0.app103” foune via screen -ls command

Use Cases,

  1. When we have access to only one terminal, then we can use screen command and multiplex the single terminal into multiple, to execute several independent commands in eache screen.
  2. When we are working on another machine (say team environment), we can start some process from other machine using screen command and detach it when we are done. Later when we get back to our place, we can login and attach the screen back to your terminal.

 

4 thoughts on “How to use screen command to work in detached mode”
  1. I am sure this piecᥱ of ѡriting Һas touched all the internet userѕ, іts reallү really plеasɑqnt
    paragraph on bᥙilding up new blog.

  2. Wow that wwas oԁd. Ι juѕt ѡrote an very ⅼong cpmment
    but after I clicked submitt my commеnt didn’t appеar.
    Grrrr… welⅼ I’m not writing all thgat over again. Regardless, ϳust wanted to say fantаtic blog!

  3. Greate post. Keep posting such kind of info on your site.

    Im really impressed by your blog.
    Hey there, You have done a fantastic job. I will
    certainly digg it and in my view recommend to my friends.

    I’m confident they’ll be benefited from this site.

Leave a Reply to Casino SBOBET Online Cancel reply

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