Using Screen (Linux)

Last Updated: Feb. 17th 2022 at 10:08pm Tags: blog linux rsync screen tmux

Screen is a linux command line tool that allows you to store sessions and create windows without a GUI.

Screen is a linux command line tool that allows you to store sessions and create windows without a GUI.
This article is just a quick little “cheat sheet” for me to remember the screen key bindings, but you’re welcome to read.

Start screen for the first time by typing screen

screen

Once you are in screen you have to use Ctrl + A then the keyboard key of the command to send. Remember you press Ctrl + a then let go of them and press the command key. Here are the commands I use the most

New Window(screen): Ctrl + a then c
Next Window(screen): Ctrl + a then n
Drop Screen (but keep things running): Ctrl + a then d
Kill screen process: Ctrl + a then k (or just type exit)

You can start more than one screen sessions. If you have more than one screen session running you need to know which one it is before re-attaching. To do this you use the command:

screen -ls

You can re-attach to a session by using screen -r and the session name 24513.ttyp2.comp_name

#full session name
screen -r 24513.ttyp2.comp_name
#session id
screen -r 24513
#only have one session running
screen -r

Screen is great for running rsync or a wget or anything that takes a long time and you want to disconnect between the time you connect and the time the process takes to run.

Another option is tmux (it’s better). Anything more complicated than having a session for running commands that require a wait, use tmux.

Reference

Comments

You need to login to comment.