Screen is an application that allows multiple use of terminal sessions within one window. This allows you to simulate multiple terminal windows where it may not be normally possible. For example, over an ssh connection. Screen acts as a manager and a container for other sessions created by it, much like how a window manager works. This article will walk you through the basic usage of screen on Ubuntu 14.04. This may also work on other versions of Ubuntu (12.04, 14.10) or different distributions of Linux (Debian, CentOS).
Installation of Screen
Install screen by running the following command:
apt-get install screen
To verify that screen has been installed, run
screen -v and you will see something similar to
Screen version 4.02.01 (GNU) 28-Apr-14. You can also run
which screen and it will show
To create a new screen session, run the command
screen. You can also assign a name to your session by running
screen -S sessionname replacing
sessionname with a name that you wish to have for your screen session. When you do, you may get greeted with a license page. Press "Return" or "Enter" to continue onward.
You will return back to your shell prompt as if nothing happened, but to be sure that you are within your screen session, press CTRL + A, followed by D and shortly after. Upon successfully detaching from screen, you will get a message within your terminal showing something similar to
[detached from 5747.pts-17.localhost]. To resume your session, type
screen -r. If you included a session name, type
screen -r sessionname replacing
sessionname with the name of your session. Note that once you resume a screen session, you will have to detach from it.
You can start a screen session by also running an application. This can be done by executing
screen /path/to/application. This will create a new session and spawn the process within it.
While within a screen session, you can create a new window by pressing CTRL + A, then C. Your old window will remain active and you can perform other tasks. To switch between windows, press CTRL + A, then N (for the next window) or CTRL + A, then P (For the previous window).
Within your session, press CTRL + A, then ? and it will display key bindings that you can use within your screen session. This is a great way to learn about the various features that your version of screen offers.
When you wish to terminate your screen, type
exit. This will end your current session. Alternatively, you can gracefully terminate a screen session with CTRL + A then \. If you have used screen to run a program, then you can press CTRL + C. When the program exits, the screen session will end.
Link - 淘实惠-使用采购网站
This article was created by DieDie
This work is licensed under a Creative Commons Attribution 4.0 International License.
This article source Using Screen on Ubuntu 14.04
Last Modified Mar 5, 2019 at 12:56 am