Using Screen on Ubuntu 14.04

  • Last Created On Dec 09, 2024
  • 7
0 0

Screen is an application that allows multiple use of terminal sessions within one window. This allows you to simulate multiple terminal windows where it may not be normally possible. For example, over an ssh connection. Screen acts as a manager and a container for other sessions created by it, much like how a window manager works. This article will walk you through the basic usage of screen on Ubuntu 14.04. This may also work on other versions of Ubuntu (12.04, 14.10) or different distributions of Linux (Debian, CentOS).

Installation of Screen

Install screen by running the following command:

apt-get install screen

To verify that screen has been installed, run screen -v and you will see something similar to Screen version 4.02.01 (GNU) 28-Apr-14. You can also run which screen and it will show /usr/bin/screen.

Usage

Basic Sessions

To create a new screen session, run the command screen. You can also assign a name to your session by running screen -S sessionname replacing sessionname with a name that you wish to have for your screen session. When you do, you may get greeted with a license page. Press “Return” or “Enter” to continue onward.

You will return back to your shell prompt as if nothing happened, but to be sure that you are within your screen session, press CTRL + A, followed by D and shortly after. Upon successfully detaching from screen, you will get a message within your terminal showing something similar to [detached from 5747.pts-17.localhost]. To resume your session, type screen -r. If you included a session name, type screen -r sessionname replacing sessionname with the name of your session. Note that once you resume a screen session, you will have to detach from it.

You can start a screen session by also running an application. This can be done by executing screen /path/to/application. This will create a new session and spawn the process within it.

Windows

While within a screen session, you can create a new window by pressing CTRL + A, then C. Your old window will remain active and you can perform other tasks. To switch between windows, press CTRL + A, then N (for the next window) or CTRL + A, then P (For the previous window).

Help Display

Within your session, press CTRL + A, then ? and it will display key bindings that you can use within your screen session. This is a great way to learn about the various features that your version of screen offers.

Terminating screen

When you wish to terminate your screen, type exit. This will end your current session. Alternatively, you can gracefully terminate a screen session with CTRL + A then \. If you have used screen to run a program, then you can press CTRL + C. When the program exits, the screen session will end.

Views: 7

Recent Articles

  • How to Install JAX with ROCm Acceleratio...
    96
  • Deploy a PyTorch Workspace on a Vultr Cl...
    71
  • Managing Backup Storage
    82
  • Automating FTP Backups in Windows Server
    71
  • Automating FTP Backups in Linux
    75

Popular Articles

  • Our General Terms & Conditions
    2631
  • Our Privacy Policy
    2477
  • Our Cookies Policy
    275
  • Our Terms of Use
    152
  • How to Install JAX with ROCm Acceleratio...
    96