A running Screen session often needs a one-off command without editing a screenrc file or sending a command from another shell. The colon prompt opens Screen's command reader inside the attached display, so session commands can list windows, change the current title, or test a setting against the session already on screen.
The default prompt key sequence is C-a :. The prompt accepts Screen command lines, not shell commands, so type command names such as windows or title admin without a leading shell prompt. The same command language is used by screenrc files and screen -X, but the interactive prompt runs from the selected window or display unless the command itself targets another object.
The prompt is modal and appears on Screen's message line. Use a read-only command such as windows first, then change one visible value such as the current window title when checking syntax in a shared or long-running session.
Related: How to rename a window in Screen
Related: How to reload the Screen config
Steps to use the Screen command prompt:
- Attach to the Screen session that should receive the command.
$ screen -r work
Use the session name from screen -ls when more than one session exists.
Related: How to attach to a Screen session
- Open the Screen command prompt from inside the session.
C-a :
C-a is the default command character. Use the configured prefix when the session changed it. The colon prompt is Screen's command reader, so do not enter a shell $ prompt there.
Related: How to change the Screen prefix key
- List the Screen windows from the prompt.
windows 0* sh
Press Enter after the command. The windows output marks the current window with *.
- Open the command prompt again before changing a visible value.
C-a :
- Change the current window title from the prompt.
title admin
The title command changes Screen's label for the current window. It does not rename the shell process running inside that window.
Related: How to rename a window in Screen
- Verify the title through the command prompt.
windows 0* admin
The updated title in the windows output confirms that Screen accepted the command typed at the colon prompt for the current window.
- Repeat the last Screen message from the attached session when it disappears before you finish reading it.
C-a m
The default lastmsg binding replays the most recent Screen message line.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.