screen command usage
Introduction | screen is a very useful command that provides the ability to use multiple shell windows (sessions) from a single SSH session. When the session is detached or the network is interrupted, processes started in the screen session will still run, and you can reconnect to the screen session at any time |
screen is a very useful command that provides the ability to use multiple shell windows (sessions) from a single SSH session. When the session is detached or the network is interrupted, processes started in the screen session will still run, and you can reconnect to the screen session at any time. This is also convenient if you want to run a persistent process or connect to a shell session from multiple locations.
In this article, we will show you the basics of installing and using screen on Linux.
How to install screenscreen
Already pre-installed on some popular distributions. You can check if it is installed on your server using the command below.
screen -v Screen version 4.00.03 (FAU)
If you don't have screen in Linux yet, you can easily install it using the package manager provided by your system.
CentOS/RedHat/Fedora
yum -y install screen
Ubuntu/Debian
apt-get -y install screen
You can start it by typing screen at the command line, and a screen session will start that looks the same as the command line prompt.
screen
It is a good practice to start a screen session with a descriptive name so that you can easily remember what processes are running in the session. To create a new session using the session name, run the following command:
screen -S name
Replace "name" with a name that is meaningful to your session.
Detach from screen sessionTo detach from the current screen session, you can press Ctrl-A and d. All screen sessions will still be active and you can reconnect at any time later.
Reconnect to screen sessionIf you detach from a session, or for some reason your connection is interrupted, you can reconnect using the following command:
screen -r
If you have multiple screen sessions, you can list them with the ls parameter.
screen -ls There are screens on: 7880.session (Detached) 7934.session2 (Detached) 7907.session1 (Detached) 3 Sockets in /var/run/screen/S-root.
In our example, we have three active screen sessions. So if you want to restore the "session2" session you can do:
screen -r 7934
Or use screen name.
screen -r -S session2
There are several ways to terminate a screen session. You can press Ctrl d or use the exit command from the command line.
To see all the useful functions of the screen command, you can view the man manual of screen.
man screen NAME screen - screen manager with VT100/ANSI terminal emulation SYNOPSIS screen [ -options ] [ cmd [ args ] ] screen -r [[pid.]tty[.host]] screen -r sessionowner/[[pid.]tty[.host]]
By the way, if you like this article, please share it with your friends on social networks or leave a comment in the comment section. Thanks.
The above is the detailed content of screen command usage. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)
