> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the screen program

> Discover how to use the screen program in Linux with this concise guide featuring code snippets, step-by-step instructions, and related links.

This article describes how to use the screen program.

## When to use Linux screen

Have you ever been working at the command line over a SSH connection and the connection drops? Alternatively, have you ever wanted to run multiple programs from the command line without opening a separate SSH connection to run each command?

The screen program can handle these scenarios and more. You can use screen to maintain an open terminal session, even if the connection drops. Likewise, you can open multiple text windows and run multiple commands from within a single SSH session.

## How to use screen

To start screen, log in to your hosting.com account using SSH, and then type the following command:

```bash theme={null}
screen
```

<Note>
  If you receive an error message, please see the **Troubleshooting screen** section below.
</Note>

You can obtain a list of active screen sessions by typing the following command:

```bash theme={null}
screen -ls
```

You should see output similar to the following text:

```
There is a screen on:
        231102.pts-2.sr10       (Attached)
1 Socket in /home/username/.screen.
```

This output shows that you currently have one attached screen session. You can type commands and work in the shell as you normally would.

* To open a new text window, press **Ctrl-a** and then type `c`. A new window opens where you can type commands.

* To move between windows, press **Ctrl-a** and then type `n`. This command takes you to the next window.

* To close a window or screen session, type `exit`.

* You can view online help for the screen application by pressing **Ctrl-a** and then **?**. You can also use the following command:

```bash theme={null}
man screen
```

You may also want to create a customized status bar to make it easier to see which window you are currently using. To do this, create a *\~/.screenrc* file. For example, to display the server hostname and window name at the bottom of the screen, add the following line to the *\~/.screenrc* file:

```
hardstatus alwayslastline "[%H] %w "
```

<Warning>
  **Important**

  Please do not leave idle screen sessions open for long periods of time. Also, make sure you do not violate our Terms of Service. For example, do not leave CPU-intensive processes running for a long time. For more information, please see our [Terms of Service](https://hosting.com/about/policies/).
</Warning>

## Troubleshooting screen

By default, some types of accounts (such as shared hosting accounts) may not be able to use the screen program. For screen to work, the bash shell must be enabled on your account. To determine your current shell environment, log in to your account using SSH and type the following command:

```bash theme={null}
echo $SHELL
```

If your shell is set to jailshell, the screen program will not work. If you want to use screen, open a support ticket at  [https://my.hosting.com](https://my.hosting.com) and request that the bash shell be enabled for your account.

However, even if the bash shell is enabled for your account, you may receive an error similar to the following message when you try to start screen:

```
Directory '/var/run/screen' must have mode 775.
```

If you receive this error message, type the following command:

```bash theme={null}
mkdir ~/.screen && chmod 700 ~/.screen
```

Then add the following line to your *\~/.bashrc* file:

```
export SCREENDIR=$HOME/.screen
```

Log out of SSH, and then log back in. Screen should now work.

## Related articles

* [Using SSH (Secure Shell)](/docs/using-ssh-secure-shell)

* [Using SSH keys](/docs/using-ssh-keys)
