Overview
screen-info provides useful metadata such as the current Screen window number, name, hostname, and current time. This command is an essential element for personalizing your terminal environment by leveraging Screen's powerful customization features.
Key Features
- Outputs information about the current Screen window
- Used for dynamic updates of the Screen status bar
- Extracts Screen session information in scripts
Main Options
The `screen-info` command itself does not have separate command-line options. This command outputs information about the active window in the current Screen session in a fixed format. The information is mainly used in conjunction with the `backtick` command in the `.screenrc` file to dynamically update Screen's status bar.
Information Output
Generated command:
Try combining the commands.
Description:
`screen-info` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
screen-info is typically executed directly within a Screen session or invoked externally via the `screen -X` command.
Executing within a Screen Session
Ctrl+a : screen-info
Within a Screen session, press `Ctrl+a :` and then type `screen-info` to check the current window information.
Sending Command to Screen Session from External Shell
screen -X screen-info
Send the `screen-info` command to the currently connected Screen session to retrieve information. (If only one session exists)
Usage in .screenrc File
backtick 1 0 1 screen-info
# Add %1` to statusline to display information
Use with the `backtick` command in the `.screenrc` file to dynamically display information on the Screen status bar. The example below executes `screen-info` every second to update the status bar.
Installation
`screen-info` is part of the GNU Screen package, so if Screen is not installed, you must install Screen first. Most Linux distributions have it installed by default or it can be easily installed via a package manager.
Debian/Ubuntu
sudo apt update
sudo apt install screen
CentOS/RHEL/Fedora
sudo yum install screen
# or sudo dnf install screen (Fedora 22+)
Tips & Notes
Here are some tips and notes for effectively using `screen-info`.
Usage Tips
- You can use it with the `backtick` command in the `.screenrc` file to display the current window number, name, hostname, etc., in real-time on the Screen status bar.
- When using the `screen -X` command, ensure only one Screen session is running, or specify a particular session using the `-S` option.
- Unlike `screen -ls`, `screen-info` provides detailed information about the *currently active window* of a specific session.
Notes
`screen-info` is only valid when a Screen session is running. If Screen is not running, the command may fail or return no information.