Новости и статьи

Среда разработки встроенных систем или дистрибутивов на основе GNU/Linux. Здесь вы можете найти новости проекта, статьи и заметки, касающиеся разработки дистрибутива Radix cross Linux.

Screen a must for ssh

4 ноября 2015 г.

If you've ever used SSH to connect to a server, you'll know its limitations: if you want to open a new window, you'll need to create a second SSH connection to the server. And if the connection breaks during the SSH tunnel, you've lost your progress. This is where Screen comes in.



Screen? A must for ssh.

Screen, which calls itself a "full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells)." is a usefull tool to use 1 SSH connection, but use multiple screens to work in. So you can have 1 screen to write some scripts in, another to tail a logfile and a third to check your IRC messages.

Screen is installed by default on most installations, you can verify this by running the which screen command.


You can start screen by typing:

$ screen

Once you've opened screen, you can see a command list by typing "CTRL + A", followed by "?" (the question mark). By typing "CTRL + A" you state that the next signal is to be sent to the program screen, in stead of to the Shell (like you would in a normal shell). You'll see a list of all bindings known to screen.

To detach the session use "CTRL + A d" or jast break the session connection.

To list the existing sessions:

$ screen -ls
There is a screen on:
        6378.pts-1.nettop       (Detached)
1 Socket in /home/kx/.screen.

To connect to the already existing session:

$ screen -r 6378.pts-1.nettop

To terminate the current session type "exit" (like you would in a normal shell):

$ exit
[screen is terminating]

This will cause you to fall back to the previous monitor you opened, or to your main prompt where you started screen, showing you a message such as [screen is terminating] so you'll know you've hit the main shell.

If the screen dead, use:

$ screen -wipe