How Do You Use the screen Program in Linux?

Problem scenario
You would rather not create duplicate terminal windows in your Linux desktop or with PuTTy in Windows.  This may be an enforced security policy rather than a preference.  Some Linux systems only allow one log on session.  Perhaps you want the systems administrator to use the "who" or "w" command to see which users are logged in without seeing more than one session for your user.

How do you use the screen command to have different terminals simultaneously with the requirements above?

How do you allow a continually-streaming program wall or echo messages to the console while you have a separate session without a second log on session?

Solution
Use the screen utility.  It is extremely helpful with long-duration processes to manage different screens from one session.

1.  Optional step.  Run this command:  screen -list

2.  Enter this command:  screen

3.  Run commands as you desire.  To exit, use these two commands:  ctrl-a, ctrl-d

(Holding control tap "a" then holding control again tap "d".)

4.  Run commands from the original prompt.  You can use "screen -list" to view the different sessions.  You can create more than one screen session.  They will not register as new logon sessions on the Linux server.  If you want to return to a previous session, use this command (but replace 1234.gooserver with the left-most column value of the output resulting from a "screen list" command):

screen -r 1234.goodserver

Leave a comment

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