start screen in linux code example

Example 1: bash how to use screen

# Note, screen is useful for continuing processes (e.g. downloads) on a
#	remote server without having to stay logged in to the server

# Basic syntax:
screen # This starts a new screen. 

# After starting a long process, e.g., a download, detach with:
CTRL+a d # To detach from screen, press CTRL+a, release, then press d

# To view active screens:
screen -ls # The first numbers by each screen indicate the screen_number

# To resume active screen:
screen -r # If there is only one active screen
screen -r screen_number # If there are multiple active screens

# To close a screen after detaching:
screen -X -S screen_number quit 

# View all CTRL+ commands available in screen:
CTRL+a ?

Example 2: linux screen shortcuts

# Shortcuts for Linux Screen program:

# Starting Linux Screen
screen
# Detach from Linux Screen Session
Ctrl+a d
# Reattach to a Linux Screen
screen -r [session id]
# Find the session ID
screen -ls

#common commands
Ctrl+a c		#Create a new window (with shell)
Ctrl+a "" 		#List all windows
Ctrl+a 0 		#Switch to window 0 (by number)
Ctrl+a A 		#Rename the current window
Ctrl+a S 		#Split current region horizontally into two regions
Ctrl+a | 		#Split current region vertically into two regions
Ctrl+a tab 		#Switch the input focus to the next region
Ctrl+a Ctrl+a 	#Toggle between the current and previous region
Ctrl+a Q		#Close all regions but the current one
Ctrl+a X 		#Close the current region

Tags:

Misc Example