🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 33 (from laksa006)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
CRAWLED
5 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.2 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.putorius.net/linux-screen-command.html
Last Crawled2026-04-11 18:56:28 (5 days ago)
First Indexed2019-09-16 17:13:02 (6 years ago)
HTTP Status Code200
Meta TitleScreen Command - Beginners Guide to Terminal Multiplexing - Putorius
Meta DescriptionLearn how to use Linux Screen to detach and reattach terminal sessions, create split screen terminal sessions and the basics of terminal multiplexing.
Meta Canonicalnull
Boilerpipe Text
The Linux Screen utility allows you to run several login sessions inside a single terminal display. There are many benefits to using screen like the ability to detach and reattach sessions, and allowing remote processes to continue after you have disconnected from a system. This is known as terminal multiplexing. A terminal multiplexer is a software application that can be used to multiplex several separate pseudoterminal-based login sessions inside a single terminal display, terminal emulator window, PC/workstation system console, or remote login session, or to detach and reattach sessions from a terminal. -Wikipedia In this tutorial we will introduce you to multiplexing by showing you how to install and use GNU Screen. The GNU Screen utility was first introduced in 1987 and is widely available on most modern Linux distributions. It is fairly simple to use (says the guy who loves vi) and with a few minutes of reading you can be up and running. There is a plethora of options, configurations and control commands available to screen. Although we cannot show you them all, we will show you the most common uses and options. Table of Contents Installing Screen Starting the Linux Screen Utility Screen Utility Control Commands Creating Windows Creating Split Screen Sessions with The Screen Command Splitting the Terminal Screen Horizontally Splitting the Terminal Screen Vertically Switching Between Windows Detaching From Screen Reattach to Screen Logging Your Screen Output Getting Alerts Stopping Screen Control Command Shortcuts Shortcut Keys: Conclusion Resources and Links Installing Screen There is a high possibility that Screen is already on your system. On most of the Linux varieties such as RedHat and CentOS distributions, you can find Linux screen in /usr/bin/screen. To see if “screen” is in your PATH , you can use the which command: [savona@putorius ~]$ which screen /usr/bin/screen If you do not have Screen, then you can install it easily from any package manager. For example, on CentOS and RedHat you can install Screen using yum:                sudo yum install screen With DNF on Fedora: sudo dnf install screen To install it on Ubuntu, Debian or similar: sudo apt-get update sudo apt-get install screen Now that you know how to install the screen command, let’s move ahead to explore it’s usage and options. Starting the Linux Screen Utility Screen is started from the command line just like any other command:   [savona@putorius ~]# screen Running the above command line will drop you inside of a window within Screen. This functions just like a normal shell except for a few special key combinations called control commands. Screen Utility Control Commands When you enter the screen utility, you can do all your work as you would in a normal environment. But since the screen is an application, it has command or parameters. The Screen command uses the command “Ctrl+a” which is the combination of the control key (Ctrl) and a lowercase “a” as a signal to send commands to screen instead of the shell. For example, “Ctrl+a” then “?” without the quotes. You should now have the screen help page. Key bindings are the commands that Screen accepts after you hit “Ctrl+a”. You can reconfigure these keys to your taste using a .screenrc file, but the defaults are a good starting point. Creating Windows To create a new window, you just use “Ctrl+a” “c”. This will create a new window for you with your default prompt.  This will look like a completely new terminal window, but it is in fact a second session controlled by the screen utility. Both terminals are still fully function and commands ran inside of them will continue to run in the background regardless of which window you are currently in. Let’s try a simple experiment. On your system open a terminal window and enter screen. [savona@putor ~]$ screen This drops you into the first screen session. Now let’s run a continual command, something that will not stop until we send a signal. A good choice is the watch command . Enter the watch command followed by the date command. [savona@putor ~]$ watch date Now that we have a continuous command running, let’s hit “Ctrl+a” “c” to create a new screen session. This gives you a new prompt, but the old session is still running in the background. You can get back to the old session and prove this by hitting “Ctrl+a” “p” for previous. We will talk more about switching between sessions later in the article. Here is an animation of how the experiment should look: Creating Split Screen Sessions with The Screen Command A really neat feature of the screen command is the ability to use split screen. This comes in handy when tailing logs or debugging scripts. Splitting the Terminal Screen Horizontally To split the screen horizontally, enter screen then use “Ctrl+a” “|” . This will split your terminal windows evenly down the center. But it will NOT create the second session. In order to create a session in the second region you will have to use “Ctrl+a” “Tab” to switch regions. Once in the empty region hit the command sequence to create a window, which we already learned is “Ctrl+a” “c”. Splitting the Terminal Screen Vertically Creating a vertical split is done by using the “Ctrl+a” “S” (Capitol S) control commands. You can create a session in the new region the same way we did when splitting horizontally (see above). Switching Between Windows The Screen allows you to move forward and back. For example, you could use “Ctrl+a” “n” to go to the next window. The windows work as a carousel and will loop back around to your first window if repeated. You can create several windows and toggle through them with “Ctrl+a” “n” for the next window or “Ctrl+a” “p” for the previous window. Each process will keep running until you kill that window. Detaching From Screen It is astounding to know that you can detach a part of screen and reattach later. Detaching is the one of the most powerful features of the screen utility in my opinion. As a Linux System Administrator this allows me to work on many different systems without having a thousand terminal windows open cluttering my screen and making it hard to find the session I need. It is important to understand that if your network connection fails, screen will automatically detach your session. Other factors like SSH session timeouts could also end your sessions to remote systems. You can detach from the window using “Ctrl-a” then “d”. This will drop you back on your shell. All screen windows will continue to run and you can re-attach to them later. This is great when you are using rsync or some other long running command. Reattach to Screen If you have detached from a screen, you can reattach by just running: [savona@putor ~]$ screen -r This will re-attach to your screen. If you have multiple screen windows, you will see a list of detached screen windows which are available to reattachment. [savona@putor ~]$ screen -r There are several suitable screens on: 8671.pts-14.putor (Detached) 8606.pts-14.putor (Detached) 31428.pts-5.putor (Attached) Type "screen [-d] -r [pid.]tty.host" to resume one of them. To attach to a screen from the list, you just need to supply the name of the screen like so: [savona@putor ~]$ screen -r 8671.pts-14.putor NOTE: Tab completion can be used to complete the name after just a few characters. Logging Your Screen Output There may come a time when you want to log everything that happens in your terminal window. Fortunately, Screen makes this easy. Using “Ctrl-a” “H” will create a running log of the current window. After you send the above control commands a file named “screenlog.0” is created in your current directory. The Screen utility will keep appending data to the file until you end the session. Using the log function is very useful for capturing what you have done, especially if you are making a lot of changes. If something goes awry, you can look back through your logs. Getting Alerts The Screen command has the ability to monitor a window for activity or inactivity. This is great if you are downloading large files, compiling, or waiting for output. If you are waiting for output from a long-running program, you can use “Ctrl-a” “M” to monitor the window for activity. Screen will then flash an alert at the bottom of the page when output is registered on that screen. This is of great use when running a command that takes a long time to return data. You can just use the command, switch to another window and not have reasons to keep switching back to check the status. You can also monitor for inactivity. Why is it important? If you are copying a large about of data with rsync or compiling a program, you can be notified when there is no more output. This is a great signal to when that job is done. To monitor for silence or no output use the control command “Ctrl-a” “_”. By default the Screen command will alert after 30 seconds of silence. Stopping Screen To stop the screen utility you can just type exit just as you normally would to close a shell. It is compulsory to close all Screen windows to terminate the session or stopping Screen. You should get a message about Screen being terminated once you close all windows. [screen is terminating] Alternatively, you can use “Ctrl-a” “k” to kill a specific window.  You should get a message asking you to confirm if you want to kill the screen. Control Command Shortcuts After having a good understanding of the syntax used in screen, it is good that you also know the shortcuts being used so as to increase your efficiency. Here is a list of some of the most important control command combinations. Shortcut Keys: Ctrl-a + c: It creates a new window. Ctrl-a + w: It displays the list of all the windows currently opened. Ctrl-a + A: It renames the current windows. The name will appear when you will list the list of windows opened with Ctrl-a + w. Ctrl-a + n: It goes to the next windows. Ctrl-a + p: It goes to the previous windows. Ctrl-a + Ctrl-a: It backs to the last windows used. Ctrl-a + k: It closes the current windows (kill). Ctrl-a + S: It splits the current windows horizontally. To switch between the windows, do Ctrl-a + Tab. Ctrl-a + |: It splits the current windows vertically. Ctrl-a + d: It detaches a screen session without stopping it. Ctrl-a + r: It reattaches a detached screen session. Ctrl-a + [: It starts the copy mode. Ctrl-a + ]: It pastes the copied text. Conclusion As we said in the introduction, there are too many options to cover in this tutorial. We covered the basics like detaching and reattaching terminal sessions, and also how to use split screen terminal windows. Using screen takes some practice, but once you get used to the control commands it can greatly increase your productivity. There are plenty of other terminal multiplexers our there. Use the comments below to tell use what multiplexer you have used in the past and why it may or may not be better than screen. Resources and Links GNU Screen User’s Manual Terminal Multiplexer on WikiPedia GNU Screen History on Wikipedia
Markdown
Manage Consent To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions. Functional Functional Always active The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network. Preferences Preferences The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user. Statistics Statistics The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you. Marketing Marketing The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes. - [Manage options](https://www.putorius.net/opt-out-preferences#cmplz-manage-consent-container) - [Manage services](https://www.putorius.net/opt-out-preferences#cmplz-cookies-overview) - [Manage {vendor\_count} vendors](https://www.putorius.net/opt-out-preferences#cmplz-tcf-wrapper) - [Read more about these purposes](https://cookiedatabase.org/tcf/purposes/) Accept Deny View preferences Save preferences [View preferences](https://www.putorius.net/opt-out-preferences#cmplz-manage-consent-container) - [Opt-out preferences](https://www.putorius.net/opt-out-preferences) - [Privacy Policy](https://www.putorius.net/privacy-policy) - [{title}](https://www.putorius.net/linux-screen-command.html) ##### Sign Up For Our Newsletter [![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp)](https://www.putorius.net/) - [Home](https://www.putorius.net/) - [Search](https://www.putorius.net/search) - [Contact](https://www.putorius.net/contact-us) - [Newsletter](https://www.putorius.net/newsletter) - [Videos](https://www.putorius.net/videos) - [![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp) ![Putorius](https://www.putorius.net/wp-content/uploads/2019/10/site-logo-small.png.webp)](https://www.putorius.net/) - [Home](https://www.putorius.net/) - [Search](https://www.putorius.net/search) - [Contact](https://www.putorius.net/contact-us) - [Newsletter](https://www.putorius.net/newsletter) - [Videos](https://www.putorius.net/videos) [Linux Tutorials](https://www.putorius.net/category/linux-tutorials) [Screen Command – Beginners Guide to Terminal Multiplexing]() [Marco Cherisi](https://www.putorius.net/author/mcherisi), [September 10, 2019](https://www.putorius.net/linux-screen-command.html) ![Screen Command – Beginners Guide to Terminal Multiplexing](https://www.putorius.net/wp-content/uploads/2019/09/Screen-Command-min-1200x675.png.webp) ![Screen Command – Beginners Guide to Terminal Multiplexing](https://www.putorius.net/wp-content/uploads/2019/09/Screen-Command-min-1200x675.png.webp) The Linux Screen utility allows you to run several login sessions inside a single terminal display. There are many benefits to using screen like the ability to detach and reattach sessions, and allowing remote processes to continue after you have disconnected from a system. This is known as terminal multiplexing. > A terminal multiplexer is a software application that can be used to multiplex several separate pseudoterminal-based login sessions inside a single terminal display, terminal emulator window, PC/workstation system console, or remote login session, or to detach and reattach sessions from a terminal. > > \-Wikipedia In this tutorial we will introduce you to multiplexing by showing you how to install and use GNU Screen. The GNU Screen utility was first introduced in 1987 and is widely available on most modern Linux distributions. It is fairly simple to use (says the guy who loves vi) and with a few minutes of reading you can be up and running. There is a plethora of options, configurations and control commands available to screen. Although we cannot show you them all, we will show you the most common uses and options. Table of Contents - [Installing Screen](https://www.putorius.net/linux-screen-command.html#installing-screen) - [Starting the Linux Screen Utility](https://www.putorius.net/linux-screen-command.html#starting-the-linux-screen-utility) - [Screen Utility Control Commands](https://www.putorius.net/linux-screen-command.html#screen-utility-control-commands) - [Creating Windows](https://www.putorius.net/linux-screen-command.html#creating-windows) - [Creating Split Screen Sessions with The Screen Command](https://www.putorius.net/linux-screen-command.html#creating-split-screen-sessions-with-the-screen-command) - [Splitting the Terminal Screen Horizontally](https://www.putorius.net/linux-screen-command.html#splitting-the-terminal-screen-horizontally) - [Splitting the Terminal Screen Vertically](https://www.putorius.net/linux-screen-command.html#splitting-the-terminal-screen-vertically) - [Switching Between Windows](https://www.putorius.net/linux-screen-command.html#switching-between-windows) - [Detaching From Screen](https://www.putorius.net/linux-screen-command.html#detaching-from-screen) - [Reattach to Screen](https://www.putorius.net/linux-screen-command.html#reattach-to-screen) - [Logging Your Screen Output](https://www.putorius.net/linux-screen-command.html#logging-your-screen-output) - [Getting Alerts](https://www.putorius.net/linux-screen-command.html#getting-alerts) - [Stopping Screen](https://www.putorius.net/linux-screen-command.html#stopping-screen) - [Control Command Shortcuts](https://www.putorius.net/linux-screen-command.html#control-command-shortcuts) - [Shortcut Keys:](https://www.putorius.net/linux-screen-command.html#shortcut-keys) - [Conclusion](https://www.putorius.net/linux-screen-command.html#conclusion) - [Resources and Links](https://www.putorius.net/linux-screen-command.html#resources-and-links) ## Installing Screen There is a high possibility that Screen is already on your system. On most of the Linux varieties such as RedHat and CentOS distributions, you can find Linux screen in /usr/bin/screen. To see if “screen” is in your [PATH](https://www.putorius.net/set-path-variable-linux.html), you can use the which command: ``` [savona@putorius ~]$ which screen /usr/bin/screen ``` If you do not have Screen, then you can install it easily from any package manager. For example, on CentOS and RedHat you can install Screen using yum: ``` sudo yum install screen ``` With DNF on Fedora: ``` sudo dnf install screen ``` To install it on Ubuntu, Debian or similar: ``` sudo apt-get update sudo apt-get install screen ``` Now that you know how to install the screen command, let’s move ahead to explore it’s usage and options. ## Starting the Linux Screen Utility Screen is started from the command line just like any other command: ``` [savona@putorius ~]# screen ``` Running the above command line will drop you inside of a window within Screen. This functions just like a normal shell except for a few special key combinations called control commands. ## Screen Utility Control Commands When you enter the screen utility, you can do all your work as you would in a normal environment. But since the screen is an application, it has command or parameters. The Screen command uses the command “Ctrl+a” which is the combination of the control key (Ctrl) and a lowercase “a” as a signal to send commands to screen instead of the shell. For example, “Ctrl+a” then “?”without the quotes. You should now have the screen help page. ![](https://www.putorius.net/wp-content/uploads/2019/09/screen-command-ss1-min.png.webp) ![](https://www.putorius.net/wp-content/uploads/2019/09/screen-command-ss1-min.png.webp) Key bindings are the commands that Screen accepts after you hit “Ctrl+a”. You can reconfigure these keys to your taste using a .screenrc file, but the defaults are a good starting point. ## Creating Windows To create a new window, you just use “Ctrl+a” “c”. This will create a new window for you with your default prompt. This will look like a completely new terminal window, but it is in fact a second session controlled by the screen utility. Both terminals are still fully function and commands ran inside of them will continue to run in the background regardless of which window you are currently in. Let’s try a simple experiment. On your system open a terminal window and enter screen. ``` [savona@putor ~]$ screen ``` This drops you into the first screen session. Now let’s run a continual command, something that will not stop until we send a signal. A good choice is the [watch command](https://www.putorius.net/run-command-at-regular-intervals.html). Enter the watch command followed by the date command. ``` [savona@putor ~]$ watch date ``` Now that we have a continuous command running, let’s hit “Ctrl+a” “c” to create a new screen session. This gives you a new prompt, but the old session is still running in the background. You can get back to the old session and prove this by hitting “Ctrl+a” “p” for previous. We will talk more about switching between sessions later in the article. Here is an animation of how the experiment should look: [![Animation showing the basic usage of the Linux screen command](https://www.putorius.net/wp-content/uploads/2019/09/screen-g2-min.gif.webp)![Animation showing the basic usage of the Linux screen command](https://www.putorius.net/wp-content/uploads/2019/09/screen-g2-min.gif.webp)](https://www.putorius.net/wp-content/uploads/2019/09/screen-g2-min.gif.webp) ## Creating Split Screen Sessions with The Screen Command A really neat feature of the screen command is the ability to use split screen. This comes in handy when [tailing logs](https://www.putorius.net/linux-tail-command.html) or debugging scripts. ![](https://www.putorius.net/wp-content/uploads/2019/09/screen-command-ss2-min.png.webp) ![](https://www.putorius.net/wp-content/uploads/2019/09/screen-command-ss2-min.png.webp) ### Splitting the Terminal Screen Horizontally To split the screen horizontally, enter screen then use “Ctrl+a” “\|” . This will split your terminal windows evenly down the center. But it will NOT create the second session. In order to create a session in the second region you will have to use “Ctrl+a” “Tab” to switch regions. Once in the empty region hit the command sequence to create a window, which we already learned is “Ctrl+a” “c”. ### Splitting the Terminal Screen Vertically Creating a vertical split is done by using the “Ctrl+a” “S” (Capitol S) control commands. You can create a session in the new region the same way we did when splitting horizontally (see above). ## Switching Between Windows The Screen allows you to move forward and back. For example, you could use “Ctrl+a” “n” to go to the next window. The windows work as a carousel and will loop back around to your first window if repeated. You can create several windows and toggle through them with “Ctrl+a” “n” for the next window or “Ctrl+a” “p” for the previous window. Each process will keep running until you kill that window. ## Detaching From Screen It is astounding to know that you can detach a part of screen and reattach later. Detaching is the one of the most powerful features of the screen utility in my opinion. As a Linux System Administrator this allows me to work on many different systems without having a thousand terminal windows open cluttering my screen and making it hard to find the session I need. It is important to understand that if your network connection fails, screen will automatically detach your session. Other factors like [SSH session timeouts](https://www.putorius.net/how-to-stop-your-ssh-session-from.html) could also end your sessions to remote systems. You can detach from the window using “Ctrl-a” then“d”. This will drop you back on your shell. All screen windows will continue to run and you can re-attach to them later. This is great when you are using [rsync](https://www.putorius.net/using-rsync-to-synchronize-directories.html) or some other long running command. ## Reattach to Screen If you have detached from a screen, you can reattach by just running: ``` [savona@putor ~]$ screen -r ``` This will re-attach to your screen. If you have multiple screen windows, you will see a list of detached screen windows which are available to reattachment. ``` [savona@putor ~]$ screen -r There are several suitable screens on: 8671.pts-14.putor (Detached) 8606.pts-14.putor (Detached) 31428.pts-5.putor (Attached) Type "screen [-d] -r [pid.]tty.host" to resume one of them. ``` To attach to a screen from the list, you just need to supply the name of the screen like so: ``` [savona@putor ~]$ screen -r 8671.pts-14.putor ``` NOTE: Tab completion can be used to complete the name after just a few characters. ## Logging Your Screen Output There may come a time when you want to log everything that happens in your terminal window. Fortunately, Screen makes this easy. Using “Ctrl-a” “H” will create a running log of the current window. After you send the above control commands a file named “screenlog.0” is created in your current directory. The Screen utility will keep appending data to the file until you end the session. Using the log function is very useful for capturing what you have done, especially if you are making a lot of changes. If something goes awry, you can look back through your logs. ## Getting Alerts The Screen command has the ability to monitor a window for activity or inactivity. This is great if you are downloading large files, compiling, or waiting for output. If you are waiting for output from a long-running program, you can use “Ctrl-a” “M” to monitor the window for activity. Screen will then flash an alert at the bottom of the page when output is registered on that screen. This is of great use when running a command that takes a long time to return data. You can just use the command, switch to another window and not have reasons to keep switching back to check the status. You can also monitor for inactivity. Why is it important? If you are copying a large about of data with rsync or compiling a program, you can be notified when there is no more output. This is a great signal to when that job is done. To monitor for silence or no output use the control command “Ctrl-a” “\_”. By default the Screen command will alert after 30 seconds of silence. ## Stopping Screen To stop the screen utility you can just type exit just as you normally would to close a shell. It is compulsory to close all Screen windows to terminate the session or stopping Screen. You should get a message about Screen being terminated once you close all windows. ``` [screen is terminating] ``` Alternatively, you can use “Ctrl-a” “k” to kill a specific window. You should get a message asking you to confirm if you want to kill the screen. ## Control Command Shortcuts After having a good understanding of the syntax used in screen, it is good that you also know the shortcuts being used so as to increase your efficiency. Here is a list of some of the most important control command combinations. ### Shortcut Keys: - Ctrl-a + c: It creates a new window. - Ctrl-a + w: It displays the list of all the windows currently opened. - Ctrl-a + A: It renames the current windows. The name will appear when you will list the list of windows opened with Ctrl-a + w. - Ctrl-a + n: It goes to the next windows. - Ctrl-a + p: It goes to the previous windows. - Ctrl-a + Ctrl-a: It backs to the last windows used. - Ctrl-a + k: It closes the current windows (kill). - Ctrl-a + S: It splits the current windows horizontally. To switch between the windows, do Ctrl-a + Tab. - Ctrl-a + \|: It splits the current windows vertically. - Ctrl-a + d: It detaches a screen session without stopping it. - Ctrl-a + r: It reattaches a detached screen session. - Ctrl-a + \[: It starts the copy mode. - Ctrl-a + \]: It pastes the copied text. ## Conclusion As we said in the introduction, there are too many options to cover in this tutorial. We covered the basics like detaching and reattaching terminal sessions, and also how to use split screen terminal windows. Using screen takes some practice, but once you get used to the control commands it can greatly increase your productivity. There are plenty of other terminal multiplexers our there. Use the comments below to tell use what multiplexer you have used in the past and why it may or may not be better than screen. ## Resources and Links - [GNU Screen User’s Manual](https://www.gnu.org/software/screen/manual/screen.html) - [Terminal Multiplexer on WikiPedia](https://en.wikipedia.org/wiki/Terminal_multiplexer) - [GNU Screen History on Wikipedia](https://en.wikipedia.org/wiki/GNU_Screen) [Tags]() [\#command](https://www.putorius.net/tag/command) [\#command line](https://www.putorius.net/tag/command-line) [\#guide](https://www.putorius.net/tag/guide) [\#linux](https://www.putorius.net/tag/linux) [\#linux commands](https://www.putorius.net/tag/linux-commands) [\#multiplexer](https://www.putorius.net/tag/multiplexer) [\#screen](https://www.putorius.net/tag/screen) [\#shortcut](https://www.putorius.net/tag/shortcut) [\#syntax](https://www.putorius.net/tag/syntax) [Previous How to Disable SELinux - Temporary or Permanent](https://www.putorius.net/disable-selinux.html) [Next Exec Command - Process Replacement & Redirection in Bash](https://www.putorius.net/exec-command.html) ### Leave a Reply [Cancel reply](https://www.putorius.net/linux-screen-command.html#respond) This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/) ### ## 5 Comments 1. ###### jota sn I started using Screen last week, because I wanted to have text reflow in XTerm when scrolling back.. After installing, ricing and learning Screen a bit i was amazed at the power of Screen\! Now, you probably should mention that the more you use Screen, the better it gets. It is frustrating to start a process only to wish you had started it from Screen… Put Screen in your .profile or .bash\_profile and then change shortcuts for your default terminal launchers in X to execute Screen. Instead of a launcher “uxterm”, you modify to “uxterm -e screen” To kill all detached sessions: \$ screen -ls \| grep Detached \| cut -d. -f1 \| awk ‘{print \$1}’ \| xargs kill [7 years ago](https://www.putorius.net/linux-screen-command.html#comment-526) [Reply](https://www.putorius.net/linux-screen-command.html#comment-526) 2. ###### jota sn Censored… So much for hypertext! Go study Ted Nelson [7 years ago](https://www.putorius.net/linux-screen-command.html#comment-527) [Reply](https://www.putorius.net/linux-screen-command.html#comment-527) 1. ###### Steven Vona Links are blocked from the comments because of past issues. Sorry for this inconvenience. [7 years ago](https://www.putorius.net/linux-screen-command.html#comment-528) [Reply](https://www.putorius.net/linux-screen-command.html#comment-528) 1. ###### js neto It is not inconvenience. It is censorship. Also, you can click the links and check for yourself if there is any harm. The fact that I abstracted from that webpage i referenced but which ref you deleted, makes people think that \*me\* had those great ideas, but that is not true! I did not explicitly name the author of whom ideas I borrowed in this first post because I thought I would have referenced them properly.. So it is not inconvenience at all for you, but you did destroy referencing, as though all these ideas you wrote in the article were yours! We know they are not and you should have referenced them, too! Wikipedia? Oh gezz, i should stop commenting [7 years ago](https://www.putorius.net/linux-screen-command.html#comment-529) [Reply](https://www.putorius.net/linux-screen-command.html#comment-529) 1. ###### Steven Vona The fact that someone is writing how to use a tool doesn’t make the idea theirs. It is simply relaying the information in a more digestible format than a man page. Unless your link was to the creator of screens web page or the official documentation (which I do reference) chances are it was not their original “idea” either. I am sorry you feel this way. If you think you have a good reference that I should add to the article please use the contact form and I will look into it as time permits. [7 years ago](https://www.putorius.net/linux-screen-command.html#comment-530) [Reply](https://www.putorius.net/linux-screen-command.html#comment-530) ### Join Our Newsletter ### Categories - [Bash Scripting17](https://www.putorius.net/category/bash-scripting) (17) - [Basic Commands51](https://www.putorius.net/category/basic-commands) (51) - [Featured7](https://www.putorius.net/category/featured) (7) - [Just for Fun5](https://www.putorius.net/category/just-for-fun) (5) - [Linux Quick Tips98](https://www.putorius.net/category/linux-quick-tips) (98) - [Linux Tutorials65](https://www.putorius.net/category/linux-tutorials) (65) - [Miscellaneous15](https://www.putorius.net/category/misc-tech) (15) - [Network Tools6](https://www.putorius.net/category/network-tools) (6) - [Reviews2](https://www.putorius.net/category/reviews) (2) - [Security32](https://www.putorius.net/category/security) (32) - [Smart Home1](https://www.putorius.net/category/smart-home) (1) Show All © 2010-2020 Putorius - All Rights Reserved - [HOME](https://www.putorius.net/) - [Privacy Policy](https://www.putorius.net/privacy-policy) - [About](https://www.putorius.net/about-putorius) - [CONTACT](https://www.putorius.net/contact-us) - [SEARCH](https://www.putorius.net/search) - [Newsletter](https://www.putorius.net/newsletter) - [Videos](https://www.putorius.net/videos) - [Linux Command Glossary](https://www.putorius.net/linux-commands) - [Opt-out preferences](https://www.putorius.net/opt-out-preferences) - [Login]() - [Register]() Registration is closed. Manage consent
Readable Markdown
The Linux Screen utility allows you to run several login sessions inside a single terminal display. There are many benefits to using screen like the ability to detach and reattach sessions, and allowing remote processes to continue after you have disconnected from a system. This is known as terminal multiplexing. > A terminal multiplexer is a software application that can be used to multiplex several separate pseudoterminal-based login sessions inside a single terminal display, terminal emulator window, PC/workstation system console, or remote login session, or to detach and reattach sessions from a terminal. > > \-Wikipedia In this tutorial we will introduce you to multiplexing by showing you how to install and use GNU Screen. The GNU Screen utility was first introduced in 1987 and is widely available on most modern Linux distributions. It is fairly simple to use (says the guy who loves vi) and with a few minutes of reading you can be up and running. There is a plethora of options, configurations and control commands available to screen. Although we cannot show you them all, we will show you the most common uses and options. Table of Contents - [Installing Screen](https://www.putorius.net/linux-screen-command.html#installing-screen) - [Starting the Linux Screen Utility](https://www.putorius.net/linux-screen-command.html#starting-the-linux-screen-utility) - [Screen Utility Control Commands](https://www.putorius.net/linux-screen-command.html#screen-utility-control-commands) - [Creating Windows](https://www.putorius.net/linux-screen-command.html#creating-windows) - [Creating Split Screen Sessions with The Screen Command](https://www.putorius.net/linux-screen-command.html#creating-split-screen-sessions-with-the-screen-command) - [Splitting the Terminal Screen Horizontally](https://www.putorius.net/linux-screen-command.html#splitting-the-terminal-screen-horizontally) - [Splitting the Terminal Screen Vertically](https://www.putorius.net/linux-screen-command.html#splitting-the-terminal-screen-vertically) - [Switching Between Windows](https://www.putorius.net/linux-screen-command.html#switching-between-windows) - [Detaching From Screen](https://www.putorius.net/linux-screen-command.html#detaching-from-screen) - [Reattach to Screen](https://www.putorius.net/linux-screen-command.html#reattach-to-screen) - [Logging Your Screen Output](https://www.putorius.net/linux-screen-command.html#logging-your-screen-output) - [Getting Alerts](https://www.putorius.net/linux-screen-command.html#getting-alerts) - [Stopping Screen](https://www.putorius.net/linux-screen-command.html#stopping-screen) - [Control Command Shortcuts](https://www.putorius.net/linux-screen-command.html#control-command-shortcuts) - [Shortcut Keys:](https://www.putorius.net/linux-screen-command.html#shortcut-keys) - [Conclusion](https://www.putorius.net/linux-screen-command.html#conclusion) - [Resources and Links](https://www.putorius.net/linux-screen-command.html#resources-and-links) ## Installing Screen There is a high possibility that Screen is already on your system. On most of the Linux varieties such as RedHat and CentOS distributions, you can find Linux screen in /usr/bin/screen. To see if “screen” is in your [PATH](https://www.putorius.net/set-path-variable-linux.html), you can use the which command: ``` [savona@putorius ~]$ which screen /usr/bin/screen ``` If you do not have Screen, then you can install it easily from any package manager. For example, on CentOS and RedHat you can install Screen using yum: ``` sudo yum install screen ``` With DNF on Fedora: ``` sudo dnf install screen ``` To install it on Ubuntu, Debian or similar: ``` sudo apt-get update sudo apt-get install screen ``` Now that you know how to install the screen command, let’s move ahead to explore it’s usage and options. ## Starting the Linux Screen Utility Screen is started from the command line just like any other command: ``` [savona@putorius ~]# screen ``` Running the above command line will drop you inside of a window within Screen. This functions just like a normal shell except for a few special key combinations called control commands. ## Screen Utility Control Commands When you enter the screen utility, you can do all your work as you would in a normal environment. But since the screen is an application, it has command or parameters. The Screen command uses the command “Ctrl+a” which is the combination of the control key (Ctrl) and a lowercase “a” as a signal to send commands to screen instead of the shell. For example, “Ctrl+a” then “?”without the quotes. You should now have the screen help page. ![](https://www.putorius.net/wp-content/uploads/2019/09/screen-command-ss1-min.png.webp) Key bindings are the commands that Screen accepts after you hit “Ctrl+a”. You can reconfigure these keys to your taste using a .screenrc file, but the defaults are a good starting point. ## Creating Windows To create a new window, you just use “Ctrl+a” “c”. This will create a new window for you with your default prompt. This will look like a completely new terminal window, but it is in fact a second session controlled by the screen utility. Both terminals are still fully function and commands ran inside of them will continue to run in the background regardless of which window you are currently in. Let’s try a simple experiment. On your system open a terminal window and enter screen. ``` [savona@putor ~]$ screen ``` This drops you into the first screen session. Now let’s run a continual command, something that will not stop until we send a signal. A good choice is the [watch command](https://www.putorius.net/run-command-at-regular-intervals.html). Enter the watch command followed by the date command. ``` [savona@putor ~]$ watch date ``` Now that we have a continuous command running, let’s hit “Ctrl+a” “c” to create a new screen session. This gives you a new prompt, but the old session is still running in the background. You can get back to the old session and prove this by hitting “Ctrl+a” “p” for previous. We will talk more about switching between sessions later in the article. Here is an animation of how the experiment should look: [![Animation showing the basic usage of the Linux screen command](https://www.putorius.net/wp-content/uploads/2019/09/screen-g2-min.gif.webp)](https://www.putorius.net/wp-content/uploads/2019/09/screen-g2-min.gif.webp) ## Creating Split Screen Sessions with The Screen Command A really neat feature of the screen command is the ability to use split screen. This comes in handy when [tailing logs](https://www.putorius.net/linux-tail-command.html) or debugging scripts. ![](https://www.putorius.net/wp-content/uploads/2019/09/screen-command-ss2-min.png.webp) ### Splitting the Terminal Screen Horizontally To split the screen horizontally, enter screen then use “Ctrl+a” “\|” . This will split your terminal windows evenly down the center. But it will NOT create the second session. In order to create a session in the second region you will have to use “Ctrl+a” “Tab” to switch regions. Once in the empty region hit the command sequence to create a window, which we already learned is “Ctrl+a” “c”. ### Splitting the Terminal Screen Vertically Creating a vertical split is done by using the “Ctrl+a” “S” (Capitol S) control commands. You can create a session in the new region the same way we did when splitting horizontally (see above). ## Switching Between Windows The Screen allows you to move forward and back. For example, you could use “Ctrl+a” “n” to go to the next window. The windows work as a carousel and will loop back around to your first window if repeated. You can create several windows and toggle through them with “Ctrl+a” “n” for the next window or “Ctrl+a” “p” for the previous window. Each process will keep running until you kill that window. ## Detaching From Screen It is astounding to know that you can detach a part of screen and reattach later. Detaching is the one of the most powerful features of the screen utility in my opinion. As a Linux System Administrator this allows me to work on many different systems without having a thousand terminal windows open cluttering my screen and making it hard to find the session I need. It is important to understand that if your network connection fails, screen will automatically detach your session. Other factors like [SSH session timeouts](https://www.putorius.net/how-to-stop-your-ssh-session-from.html) could also end your sessions to remote systems. You can detach from the window using “Ctrl-a” then“d”. This will drop you back on your shell. All screen windows will continue to run and you can re-attach to them later. This is great when you are using [rsync](https://www.putorius.net/using-rsync-to-synchronize-directories.html) or some other long running command. ## Reattach to Screen If you have detached from a screen, you can reattach by just running: ``` [savona@putor ~]$ screen -r ``` This will re-attach to your screen. If you have multiple screen windows, you will see a list of detached screen windows which are available to reattachment. ``` [savona@putor ~]$ screen -r There are several suitable screens on: 8671.pts-14.putor (Detached) 8606.pts-14.putor (Detached) 31428.pts-5.putor (Attached) Type "screen [-d] -r [pid.]tty.host" to resume one of them. ``` To attach to a screen from the list, you just need to supply the name of the screen like so: ``` [savona@putor ~]$ screen -r 8671.pts-14.putor ``` NOTE: Tab completion can be used to complete the name after just a few characters. ## Logging Your Screen Output There may come a time when you want to log everything that happens in your terminal window. Fortunately, Screen makes this easy. Using “Ctrl-a” “H” will create a running log of the current window. After you send the above control commands a file named “screenlog.0” is created in your current directory. The Screen utility will keep appending data to the file until you end the session. Using the log function is very useful for capturing what you have done, especially if you are making a lot of changes. If something goes awry, you can look back through your logs. ## Getting Alerts The Screen command has the ability to monitor a window for activity or inactivity. This is great if you are downloading large files, compiling, or waiting for output. If you are waiting for output from a long-running program, you can use “Ctrl-a” “M” to monitor the window for activity. Screen will then flash an alert at the bottom of the page when output is registered on that screen. This is of great use when running a command that takes a long time to return data. You can just use the command, switch to another window and not have reasons to keep switching back to check the status. You can also monitor for inactivity. Why is it important? If you are copying a large about of data with rsync or compiling a program, you can be notified when there is no more output. This is a great signal to when that job is done. To monitor for silence or no output use the control command “Ctrl-a” “\_”. By default the Screen command will alert after 30 seconds of silence. ## Stopping Screen To stop the screen utility you can just type exit just as you normally would to close a shell. It is compulsory to close all Screen windows to terminate the session or stopping Screen. You should get a message about Screen being terminated once you close all windows. ``` [screen is terminating] ``` Alternatively, you can use “Ctrl-a” “k” to kill a specific window. You should get a message asking you to confirm if you want to kill the screen. ## Control Command Shortcuts After having a good understanding of the syntax used in screen, it is good that you also know the shortcuts being used so as to increase your efficiency. Here is a list of some of the most important control command combinations. ### Shortcut Keys: - Ctrl-a + c: It creates a new window. - Ctrl-a + w: It displays the list of all the windows currently opened. - Ctrl-a + A: It renames the current windows. The name will appear when you will list the list of windows opened with Ctrl-a + w. - Ctrl-a + n: It goes to the next windows. - Ctrl-a + p: It goes to the previous windows. - Ctrl-a + Ctrl-a: It backs to the last windows used. - Ctrl-a + k: It closes the current windows (kill). - Ctrl-a + S: It splits the current windows horizontally. To switch between the windows, do Ctrl-a + Tab. - Ctrl-a + \|: It splits the current windows vertically. - Ctrl-a + d: It detaches a screen session without stopping it. - Ctrl-a + r: It reattaches a detached screen session. - Ctrl-a + \[: It starts the copy mode. - Ctrl-a + \]: It pastes the copied text. ## Conclusion As we said in the introduction, there are too many options to cover in this tutorial. We covered the basics like detaching and reattaching terminal sessions, and also how to use split screen terminal windows. Using screen takes some practice, but once you get used to the control commands it can greatly increase your productivity. There are plenty of other terminal multiplexers our there. Use the comments below to tell use what multiplexer you have used in the past and why it may or may not be better than screen. ## Resources and Links - [GNU Screen User’s Manual](https://www.gnu.org/software/screen/manual/screen.html) - [Terminal Multiplexer on WikiPedia](https://en.wikipedia.org/wiki/Terminal_multiplexer) - [GNU Screen History on Wikipedia](https://en.wikipedia.org/wiki/GNU_Screen)
Shard33 (laksa)
Root Hash1129651453102430433
Unparsed URLnet,putorius!www,/linux-screen-command.html s443