Categories
Design

How to use linux’s screen command

screen command in Linux provides the ability to launch and use multiple shell sessions from a single ssh session. When a process is started with ‘screen’, the process can be detached from session & then can reattach the session at a later time. When the session is detached, the process that was originally started from the screen is still running and managed by the screen itself. The process can then re-attach the session at a later time, and the terminals are still there, the way it was left.

Syntax:

Options:

  • -a: It force all capabilities into each window’s termcap.
  • -A -[r|R]: It adapt all windows to the new display width & height.
  • -c file: It read configuration file instead of ‘.screenrc’.
  • -d (-r): It detach the elsewhere running screen (and reattach here).
  • -dmS name: It start as daemon: Screen session in detached mode.
  • -D (-r): It detach and logout remote (and reattach here).
  • -D -RR: It do whatever is needed to get a screen session.
  • -e xy: It change the command characters.
  • -f: It make the flow control on, -fn = off, -fa = auto.
  • -h lines: It set the size of the scrollback history buffer.
  • -i: It interrupt output sooner when flow control is on.
  • -l: It make the login mode on (update /var/run/utmp), -ln = off.
  • -ls [match]: It display all the attached screens.
  • -L: It turn on output logging.
  • -m: It ignore $STY variable, do create a new screen session.
  • -O: It choose optimal output rather than exact vt100 emulation.
  • -p window: It preselect the named window if it exists.
  • -q: It quiet startup. Exits with non-zero return code if unsuccessful.
  • -Q: It commands will send the response to the stdout of the querying process.
  • -r [session]: It reattach to a detached screen process.
  • -R: It reattach if possible, otherwise start a new session.
  • -S sockname: It name this session .sockname instead of …
  • -t title: It set title. (window’s name).
  • -T term: It use term as $TERM for windows, rather than “screen”.
  • -U: It tell screen to use UTF-8 encoding.
  • -v: It print “Screen version 4.06.02 (GNU) 23-Oct-17”.
  • -x: It attach to a not detached screen. (Multi display mode).
  • -X: It execute as a screen command in the specified session.

Shortcut keys Options:

  • Ctrl-a + c: It create a new windows.
  • Ctrl-a + w: It display the list of all the windows currently opened.
  • Ctrl-a + A: It rename the current windows. The name will appear when you will list the list of windows opened with Ctrl-a + w.
  • Ctrl-a + n: It go to the next windows.
  • Ctrl-a + p: It go to the previous windows.
  • Ctrl-a + Ctrl-a: It back to the last windows used.
  • Ctrl-a + k: It close the current windows (kill).
  • Ctrl-a + S: It split the current windows horizontally. To switch between the windows, do Ctrl-a + Tab.
  • Ctrl-a + |: It split the current windows vertically.
  • Ctrl-a + d: It detach a screen session without stopping it.
  • Ctrl-a + r: It reattach a detached screen session.
  • Ctrl-a + [: It start the copy mode.
  • Ctrl-a + ]: It paste the copied texte.

Examples:

    Installation of screen command: To install the screen command simply go to the terminal and type the following command:

How to use linux’s screen command
screen: It will start a new window within the screen.

How to use linux’s screen command
-S: It will start a new window within the screen and also gives a name to the window. It creates a session which is identified by that name. The name can be used to reattach screen at a later stage.

-ls: It is used to display the currently opened screens including those running in the background. It will list all the attached as well as detached screen sessions.

-d: It is used to detach a screen session so that it can be reattached in future. It can also be done with the help of shortcut key Ctrl-a + d

Here 1643 is the screen id we want to detach.

-r: It is used to reattach a screen session which was detached in past.

Note:

  • To check for the manual page of screen command, use the following command:
  • To check the help page of screen command, use the following command:

Linux screen provides users an option to open several separate terminal instances within a single terminal window manager. Screen also includes an enhanced command line, giving you extra features and functionality over a standard command line.

This tutorial will show you how to install and use Screen on a Linux system.

How to use linux’s screen command

  • A user account with sudo privileges
  • Access to a command line / terminal window (Ctrl+Alt+T/Ctrl+Alt+F2)

How to Install Screen on Linux

If you’re running a recent version of Linux, like Ubuntu 18.04 or CentOS 7, you probably already have Screen installed.

To verity if screen is installed, check the version with the command:

Installing Screen on CentOS

To install Screen on Red Hat / CentOS, enter the command:

Installing Screen on Debian or Ubuntu

To install screen on Debian/Ubuntu, enter the following:

Commands to Start Screen

To launch Screen, enter the following at a command line:

The tool will launch and give you a brief license agreement. Press the spacebar or Enter to continue to the Screen shell. The system will drop out to a command line that looks just like a regular terminal window.

How to use linux’s screen command

Screen works using command keystrokes. These are usually Ctrl-a plus another key.

To display a list of available commands, enter the following:

How to use linux’s screen command

When you launch the Screen application, it’s helpful to name the session. This helps you keep track of different instances.

To name a session with the –S option:

To exit Screen, use the following command:

Note: Press and release the ctrl-a key combination, then hold the shift key and press the ? key.

Basic Commands in Screen to Manage Windows

When Screen is first launched, it creates one window inside of the Screen session. New windows can be created and switched using command keystrokes.

To open a new Screen window, use the following keystroke:

The original window is labeled 0 bash, unless you name it something different. Each new Screen window gets a number, up to 9.

Here is a list of useful commands for managing Screen windows:

Create a new window

List all open windows

0 – Switch to window #0 (or any other numbered window)

Rename the current window

Split the screen horizontally, with the current window on top

– (pipe) Split the screen vertically, with the current window to the left

Switch between areas of the split screen (usually used along with

to run different windows side-by-side)

Switch between current and previous windows

– Switch to the next window

– switch to the previous window

Quit all other windows except the current one

Lock the current window

– Create a running log of the session

Monitor a window for output (Screen will flash a notification when that window has activity)

– (underscore) Watch the window for the absence of output (such as when a file finishes downloading, or a compiler finishes)

kill the Screen session (or you can type exit)

Detaching From Screen

You can leave a process working in Screen, and exit the interface. This is the equivalent of minimizing an application in a graphical operating system.

To detach from screen (and leave the window running in the background):

Reattach to Screen

Screen helps preserve your work if your remote SSH connection drops.

To reconnect to the server, use the screen –ls command.

If you have multiple sessions running, you may need to find the screen session ID

To list different Screen sessions from a standard command line with:

This only lists sessions that are created with the screen command. Windows inside a session won’t be listed. If you have multiple different Screen instances running, each will have a different session ID.

This command lists all the Screen sessions that kept running after you disconnected.

You can then reattach to that Screen using the screen –r [sessionID]command.

To reattach to a running Screen instance:

Note: If you only have one Screen instance, you don’t need to enter the session ID. If you have more than one, you’ll need to specify which session ID you want to reconnect to.

Customizing Screen

Like many Linux applications, Screen uses a customizable configuration file. Find the system-wide configuration file at /etc/screenrc. The user’s configuration file is located at

Open the file for editing:

How to use linux’s screen command

Most of the settings can be toggled by removing the comment (#) sign at the beginning of the line.

This tutorial showed you how to install Linux screen as well as the basic commands for using it.

Once you have mastered using the screen interface, you can navigate through multiple terminals, multitask and work more efficiently.

Next, You Should Also Read:

When you are using ssh command, it provides you only one screen (terminal). If you lose that screen, you lose all you were doing on the remote computer. Sometimes it happens when a network glitch breaks the ssh connection and you lose what you were doing and you have to reconnect the remote server again. That can be very bad if you were in the middle of something important. For example, if you want to do three things at once like ‘vi httpd.conf’ , ‘tail -f /var/log/messages’, and ‘service httpd reload’, you need to open three separate ssh sessions.

The GNU screen utility is a terminal multiplexer. If you are a system administrator working on remote servers, screen is a great tool for managing a remote computer with only a command-line interface available. It lets you disconnect from it, and then reconnect to that same screen session later.

It is installed by default in Ubuntu, for RHEL based system, you can install screen with the help of yum command

To use screen simply type the following command:

You might see a welcome message if it’s there, and then see a regular bash prompt in the window. To control screen, press the Ctrl+a key combo, followed by another keystroke.

For example, Ctrl+a followed by ? (noted as Ctrl+a, ?) displays the help screen.

Here are some commands and control keys you can use to operate screen.

Screen Control Keys

The screen session shown above resulted in two windows (each running a bash shell) being created. You can create as many as you like and name them as you choose. Also, instead of detaching from the screen session, you could have just closed it by exiting the shell in each open window (type exit or Ctrl+d).

Reconnecting to a Screen Session

When the screen session is detached, you are returned to the shell that was opened when you first logged into the server. You can return to that screen again later (even after you log out and disconnect from the server). To reconnect when only one screen is running, type the following:

If there are several screen sessions running, screen -r won’t work. For example, this shows what happens when two detached screen sessions are running:

Naming screen Sessions

Instead of using the default names, you can create more descriptive names for your screen sessions when you start screen.

Sharing screen Sessions

This is very important stuff for system administrators. The screen command also allows the sharing of screens. This feature is great for tech support because each person connected to the session can both type into and watch the current session. Creating a named screen, as in the preceding section, makes this easier. Then another person on a different computer can ssh to the server (using the same user name) and type the following:

Just as with screen -r , if there’s only one screen running, you don’t need to specify which screen you’re connecting to:

What tool do you use for remote connection other than screen command? Please leave your comments

Screen command keep running terminal session alive in the background which can be detached and reconnect again. Screen is a Linux tool that is used to multiplexes a physical console between several process. This is especially useful when you log in to the Linux system remotely. You can start a screen, kick off a command, detach from the screen, and log out. You can then log in later and reattach to the screen and see the program running.

In this article I will show you can use screen command in Linux/UNIX system.

Find the below options are available with the screen command:

Start Screen Session

Follow the below command to start the screen session:

Now you can run the any command in screen session. If you execute the screen command a terminal launched in background.

Detach/Logout From the Screen Session

To detach and logout from the screen session press the Ctrl+a+d key in sequence. After pressing these keys you will get a message “detached” on the screen when session is detached.

You can also use –d option if you want to logout and detach the screen from another terminal.

You will need to specify the screen ID which can be obtained from screen –ls command.

Reattach to the Screen Session

Follow the below command to reattach the screen session.

List All Running Screen Session On The System

Follow the below command to list all running screen session with their status such as attached, detached on your system.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com . To become an author at Look Linux Submit Article . Stay connected to Facebook .

About the author

Santosh Prasad

Hi! I’m Santosh and I’m here to post some cool article for you. If you have any query and suggestion please comment in comment section.

How to use linux’s screen command

The screen or GNU screen is a terminal multiplexer. screen command in Linux provides the ability to launch and use multiple shell sessions from a single SSH session. When a process is started with screen, the process can be detached from session and then can reattach the session at a later time. When the session is detached, the process that was originally started from the screen is still running and managed by the screen itself. The process can then re-attach the session at a later time, and the terminals are still there, the way it was left.

Using screen you can run any number of console-based-applications, interactive command shells, course-based applications, etc.

The screen command allows us to:

  • Use multiple shell windows from just one SSH session
  • Keep a shell session active even when there are network disturbances
  • Manage connections to shell from multiple locations
  • Keep a long running session alive even after exiting a sell session

screen command lets you reattach to a previous session so that you can finish your task. This article focuses on this specific use of screen command.

How to install screen command

It is quite simple to install screen.

– On Debian, run the following command:

– For Fedora and CentOS:

How to use screen command

screen allows you to create one or more sessions in your current SSH terminal.

Run the following command to start it:

The above command will create a screen session or window (although you don’t see it as such) in your current SSH terminal.

Press Space or Return to get to the command prompt.

You’re left at the command prompt, and nothing much seems to have happened. However, you’re now running a shell inside a multiplexed terminal emulator.

Here are the most important screen commands that you need to control screen. All these start with CTRL a in order to to distinguish them from normal shell commands:

Ctrl a c – Creates a new screen session so that you can use more than one screen session at once
Ctrl a n – Switches to the next screen session
Ctrl a p – Switches to the previous screen session
Ctrl a d – Detaches a screen session (without killing the processes)

Ctrl a w – It display the list of all the windows currently opened.

Ctrl a A – It rename the current windows. The name will appear when you will list the list of windows opened with Ctrl-a + w.

Ctrl a Ctrl a – It back to the last windows used
Ctrl a k – It close the current windows (kill)
Ctrl a S – It split the current windows horizontally. To switch between the windows, do Ctrl-a + Tab
Ctrl a |- It split the current windows vertically

Ctrl a r – It reattach a detached screen session
Ctrl a [ – It start the copy mode
Ctrl a ] – It paste the copied text

In order to close a screen session where all tasks are finished you can type:

On your normal SSH terminal, you can run:

To get a list of your current screen sessions you can run:

To reconnect to one of these sessions, run:

where 2477.pts-0.server1 is the name of one of the sessions from the screen -ls output.

To leave and finish a screen session, finish all current tasks in it (top can be finished by typing q, tail -f /var/log/mail.log can be finished by typing CTRL c) and then type:

You will then fall back to another screen session (if you use more than one) or to the normal SSH terminal, if no more screen sessions are open.

If you want to learn more about screen, run:

Keep processes running despite a dropped connection. What can you do?

The screen command is most used for SSH session because it helps to continue your work after a disconnection without losing the current processes in progress. Once your connection is back up, log in to your system with SSH again and run:

From the results pick one session (e.g. 2477.pts-0.server1) and reattach to it:

If you picked the right session, you should find your kernel still compiling (if it hasn’t finished in the meantime) so that you can continue your work.

Sysadmins generally work using the Linux terminal. However, you can get even more out of it by implementing the Linux Screen in your workflow. It’s a long-running favorite among developers and is a must for anyone who wants to become an expert.

It might seem intimidating at first, but the Linux Screen is easy to learn while providing limitless possibilities. It’s a very efficient and resourceful utility, making it an irreplaceable tool.

With this in mind, we will teach you how to enable and use Linux Screen to increase the flexibility of the Linux terminal further.

What Is Linux Screen?

A Linux Screen is a terminal application developed by the GNU project. Often official documentation calls it a GNU Screen and is used for terminal multiplexing.

In other words, Screen divides a physical terminal into multiple virtual sessions, stops and summarizes the activity in them.

Screen works like this – if you work on a terminal session while using Screen, once you’re finished with your work and turn off the computer, it will save at that point. When the terminal is reaccessed, the terminal will return to the very same screen you worked on before shutting down.

Linux Screen might be basic in its structure, but every Linux user should know how to use it.

How to Install and Use Linux Screen?

Screen is usually installed by default on all major Linux distributions. If your system doesn’t have it preinstalled, don’t worry, the installation process is easy.

First, we need to connect to our server using the SSH command. Open up your terminal and type:

In the case of Debian, Ubuntu or Linux Mint and its derivatives, you can execute the following command:

If you are using CentOS 7, you can install it using the following:

Or if the user can’t run sudo commands, we need to run it as a root user.

At the end of the installation, we can check the current version of Screen, using the following command line:

Congratulations, now you can finally use Screen.

Using Linux Screen on Any Linux Distribution

To run Linux screen, we just have to type the word in our terminal session:

How to use linux’s screen command

After pressing the Space key, you will see the terminal again. Do not be worried, we have already started a new Screen session. To check it, just type exit in and press Enter.

So, we need to rerun the command by typing screen again.

We can also start a session and give it a name by using the -S variable. For example:

We recommend you give the session a descriptive name and you will have no problem identifying it.

Screen uses commands to perform terminal multiplexing and the commands are easy to learn. They all follow a Ctrl+* * structure, where * are the variables.

IMPORTANT: Take note of the lowercase and uppercase keys when performing commands.

How to use linux’s screen command

Working in a New Session

Once we have started a new session it is necessary to learn how to use it. These are the main commands you’ll be using:

Commands Description
Ctrl+a c Create a new window
Ctrl+a ” List all the created windows
Ctrl+a a Delete a Ctrl+a, which useful if you made a mistake
Ctrl+a Ctrl+d Leave the session running

It is also possible to split the terminal screen. For example, using Ctrl+a S splits the terminal horizontally:

How to use linux’s screen command

To change to the next terminal, we press CTRL+a TAB. To close it, CTRL+a X.

How to Manage Multiple Sessions Using Linux Screen

One of the great qualities of Screen is the ability to perform actions and leave them in the background so that when we return to them they’re still there. This is especially great for server administrators.

For this example, I will use htop. We can install it on Debian, Ubuntu, Linux Mint and its derivatives with the following command:

You can run htop by simply typing the following command in your terminal:

How to use linux’s screen command

Next, we will use both CTRL+a and CTRL+d commands to detach the execution from the terminal. From here you can work on something else, while the previous window will run in the background. If you want to open up the same htop terminal, first type in the following command:

It will show all of your saved sessions. To reopen htop, enter the following:

How to use linux’s screen command

In this case, our process_number is 11520

Conclusion

It is really important to learn how to install and use Linux Screen, especially if you work as a server administrator. It’s a really handy tool that can greatly improve your overall workflow. Here you have learned how to both install Screen on your server and how to use its basic commands.

We hope you found this Linux tutorial helpful. Good luck!

The Author

How to use linux’s screen command

Edward is Hostinger’s copywriter. He’s an expert communicator with years of experience in IT as a writer, marketer, and Linux enthusiast. IT is a core pillar of his life, personal and professional. Edward’s goal is to encourage millions to achieve an impactful online presence. He also really loves dogs, guitars, and everything related to space.

Screen Command: Set Baud Rate

The syntax is:
screen /dev/ttySX baud_rate,cs8|cs7,ixon|-ixon,ixoff|-ixoff,istrip|-istrip
screen /dev/ 115200
Where,

  • /dev/ttySX : Linux serial port (e.g., /dev/ttyS0 [COM1] )
  • baud_rate : Usually 300, 1200, 9600 (default), 19200, or 115200. This affects transmission as well as receive speed.
  • cs8 or cs7 : Specify the transmission of eight (or seven) bits per byte.
  • ixon or -ixon : Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending data.
  • ixoff or -ixoff : Enables (or disables) software flow-control for receiving data.
  • istrip or -istrip : Clear (or keep) the eight bit in each received byte.

How to list serial ports under Linux

We use the dmesg command as follows:
$ dmesg | grep tty ## use grep command/egrep command as filter ##
$ sudo setserial -g /dev/ttyS[0123]

Installing screen

Before we can use screen to connect to the serial console install it as per your version of Linux/Unix system:
## Debian/Ubuntu use apt command/apt-get command: ##
$ sudo apt install screen
## RHEL/CentOS/Oracle Linux users use the yum command ##
$ sudo yum install screen
## Fedora Linux users try the dnf command ##
$ sudo dnf install screen

Setting up baud rate with screen command on Linux or Unix

In this example, I’m connecting to my Soekris based embedded router using /dev/ttyS0 with 19200 baud rate and cs8:
$ screen /dev/ttyS0 19200,cs8
Sample outputs:

Fig.01: Screen command in action

Using screen to connect to the serial console with 300 baud rate

We set a differnet baud rate as follows:
$ creen /dev/ttyS1 300

How Do I See My Serial Port Status and Info?

Simply type CTRL + A + i

Fig.02: Getting terminal info

How Do I Exit From the Screen Session?

To close the screen session after you finish the router / switch configuration, press CTRL + A + k . To kill all screen session press CTRL + A + \ . See our quick screen command tutorial for more information.

Conclusion

You learned how to use screen command to set up baud rate and other settings for serial communication with routers and other devices. See

  • See how to install and use minicom which is a communication program that runs under most unices.
  • How to setup a serial console under Debian, FreeBSD or OpenBSD.

screen command in Linux provides the ability to launch and use multiple shell sessions from a single ssh session. It also allows you to share your sessions with other users and detach/attach terminal sessions.

In other words, it means that you can start a screen session and then open any number of windows (virtual terminals) inside that session. Processes running in Screen will continue to run even when their window is not visible and even if you get disconnected.

How to use linux’s screen commandscreen command

Installing screen

The screen package is pre-installed on most Linux distributions. You can check if it is installed on your system by using the following command:

Then you should the version of screen package that is currently installed in your system. If not then you can install the screen with the following command.

Install Linux Screen on Debian and Ubuntu

Install Linux Screen on CentOS and Fedora

How to use screen command in Linux

Now let’s get to the part on how to use the screen command in Linux, to start a screen session in Linux, just type screen in your command prompt.

You can also assign a name to screen session, named sessions are useful when you run multiple screen sessions. To create a named session, run the screen command with the following arguments:

Then the screen will show with an interface exactly the same as usual command prompt. You can also have multiple screen sessions or screen inside screen running at any point in time.

Any point in time you want to see all the screen command options that you want to know about, just type Ctrl+A and ? . Then you will see all commands or parameters on screen.

To create a new screen session, you can use the following command

Following are some of the most common commands for managing the screen sessions

  • Ctrl+A c – Create a new screen session
  • Ctrl+A ” – List all active screen sessions
  • Ctrl+A 0 – Switch to screen window 0 (by number )
  • Ctrl+A A – Rename the current screen session
  • Ctrl+A S – Split current region horizontally into two regions
  • Ctrl+A | – Split current region vertically into two regions
  • Ctrl+A tab – Switch the input focus to the next region
  • Ctrl+A Ctrl+A – Toggle between the current and previous region
  • Ctrl+A Q – Close all regions except the current one
  • Ctrl+A X – Close the current region

How to detach from Linux Screen Session

Let’s say you are in the middle of SSH-on your server doing a server upgrade or downloading a large file which you can’t interrupt but you want to locally run a command or open a new ssh session without interrupting whatever is currently running in the existing session, then we can screen to detach it.

You can use the following command

How to Reattach to a Linux Screen

Let’s see you have done some other stuff after detaching the screen session, now you want to get back to your original screen session which was upgrading a server or downloading the large file and you want to see the progress of it, then you can simply reattach and continue from where you left off.

You can use the following command to resume screen.

In case if you have more than 1 screen session, then you need to type the screen session ID to resume that particular session.

You can use screen -ls to see the list of the currently running screen sessions.

You will see a similar output like below

If you want to restore screen 5380.pts-0, then type this command.

In the next post, we see all other things like password protecting a screen session, customising the screen and logging all the events.

Need Hosting? Try ours, it’s fast, reliable and feature loaded with support you can depend on.

GNU Screen is a terminal multiplexer. You can have multiple sessions / terminal from single Screen instance. Using screen your process is not interrupted when your connection is disconnected.

You might want to compile an application or Linux kernel on remote machine and it takes quite some time to finish, the first option is to login to remote machine, start the compile and wait until the compilation has finished without disconnecting your remote SSH connection. Of course, if your internet connection is interrupted or your client machine crashes the process will be stopped on the server and you’ll have to start over.

The other option is to use Screen. You can login to the remote server, open Screen, do the complication, detach the server and you can disconnect your SSH connections. You can even go somewhere else and return to your SSH and return to the Screen you left before.

Another scenario is when you want to download large files on the server but you don’t want to put the download on background so you can start your download inside Screen instead.

Installing GNU Screen

Screen might already installed by default on your system. If it’s not installed yet you can use command mentioned in this section to install Screen

If you are using Ubuntu / Debian you can use command below to install screen :

If you are using Red Hat / CentOS / Fedora you can use command below to install screen :

Basic Screen Commands

To use screen, after connecting to your server, you can type screen on your terminal. It will open a new screen, the default will show the information screen. You can press space or return to close the information screen, it will get you back to terminal but this one is inside screen. To detach screen you can use ctrl+a+d command. Detaching screen means exit from screen but you can still resume the screen later. To resume screen you can use screen -r commmand from the terminal. you will get the screen where you left before. To exit from this screen you can use ctrl+d command or type exit on command line.

That is the most basic command to start, detach and exit from screen. Now let’s learn how to use screen further.

let’s check whether we have running screen or not :

No screen found. Let’s create new screen by simply typing :

The new screen window will be opened. On this window, press enter to close welcome screen and type top to run top monitoring utility Let’s navigate to the next window by pressing Ctrl+a n . It will show No other window notification on bottom left of your screen. Type Ctrl+a c to create new window. On the second window we will run command vmstat

Let’s have the third window by typing Ctrl+a c again. On the third window just type ls / , you can use another command of course, just make sure you can identify that it is the third window. Now when we type Ctrl+a n it will go to the first window where we run top. If we type Ctrl+a n one more time it will go to the second window where we run vmstat . From here if you type Ctrl+a p you will go back to the first window where we run top command, but if you type Ctrl+a n again you will go to the third window. As alternative you can also you Ctrl+a [N] where N is window number from 0 to 9. Let’s detach from the current screen by pressinng Ctrl+a d

When we list the screen again this time it will show the previously detached screen :

1 Socket in /var/run/screen/S-panji.

$ screen -ls There are screens on:

2 Sockets in /var/run/screen/S-panji.

$ screen -r There are several suitable screens on:

Type “screen [-d] -r [pid.]tty.host” to resume one of them.

$ mkpasswd secretpassword nErsv1b8.UpSU

$ screen -r Screen password:

$ ssh -t [email protected] screen

$ ssh -t u[email protected] screen -r

$ ssh -t [email protected] screen -r [email protected]’s password: There are several suitable screens on:

Type “screen [-d] -r [pid.]tty.host” to resume one of them. Connection to server closed.

$ ssh -t [email protected] screen -r 1752 “`

References

Screen Options

Inside Screen

  • Ctrl+a c Create new window
  • Ctrl+a [0-9] Navigate between screens, you can use this navigation up to 10 windows (0-9).
  • Ctrl+a x Lock your terminal window. you will be asked to enter and confirm a password and also enter a password to go back to the window.
  • Ctrl+a n Navigate to the next window.
  • Ctrl+a p Navigate to the previous window.
  • Ctrl+a k Kill current the window. A confirmation of y/n will be snowed before the window really killed.
  • Ctrl+a A Enter title for the window.
  • Ctrl+a d Detach the current screen.
  • Ctrl+a ? Show screen help pages that list all command available inside screen.

Conclusion

In this tutorial we learned how-to use GNU screen. You can now do basic navigation on screen, create new screen, move between screen, detach and resume screen. You have additional tool on your belt that you can use on Linux command line which will be useful in all sorts of situations over your server administration lifetime.