Learning Academy

The Cure of Ignorance is to Question. MUHAMMAD (PBUH)

Ubuntu

How to use screen utility to maintain your ssh session without worrying about disconnection

ubuntuProblem: How to use screen utility to maintain your ssh session without worrying about failures or network disconnection?

Solutions:

login via SSH

1
 shaukat@shaukat-desktop:~/cloud-v0.8.5$ </span>screen

(press enter)

#it will create a screen session
# start your process work or script. and if want to disconnect without killing ssh session

press CTRL+A and then CTRL+D

# you will be detached from your screen session.
# so now you can easily logout or disconnect without killing your working processes.

Login again via ssh and enter

1
 shaukat@shaukat-desktop:~/cloud-v0.8.5$ screen -r

(press enter)

#It will automatically resume your screen session. it is very safe to do the work in background with being worried about disconnection.
#To ee the list of screen session use command screen -ls

1
shaukat@shaukat-desktop:~/cloud-v0.8.5$ screen -ls

There is a screen on:
4312.pts-0.shaukat-desktop   (12/25/2013 05:51:17 PM)        (Detached)
1 Socket in /var/run/screen/S-shaukat.

1
shaukat@shaukat-desktop:~/cloud-v0.8.5$ screen -r

# It will automatically attach your detacched session

# If you have multiple screen session you can selectively join one of them by

# if for example there are two
123.pts-1
456.pts-2

1
 shaukat@shaukat-desktop:~/cloud-v0.8.5$ screen -dr pts-2

That’s it. Enjoy.

Muhammad Shaukat

Content Developer at LearnAcad.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest