Custom Search

Monday, February 3, 2014

Linux Screen Commands For Developers

1)
List all screen sessions of current user
#screen -ls

2)
To see all screen sessions on a specific machine
#ls -laR /var/run/screen/

3)
To see all commands or parameters on screen.
Ctrl + a, Then Press ?

4)
Open a new screen session
#screen



5)
Detach/Exit from a screen session
Ctrl + a, Then Press d

6)
Kill a screen session
Ctrl + a, Then Press Shift + k

7)
Reattach to a screen session
#screen -r session_id_or_name

8)
How to create multiple screen window/tab in a screen session
Ctrl + a, Then Press c

9)
How to move to next screen window/tab in a screen session
Ctrl + a, Then Press n

10)
How to move to previous screen window/tab in a screen session
Ctrl + a, Then Press p

11)
How to goto n'th screen window/tab
Ctrl + a, Then Press '

12)
How to list name of all screen windows/tabs and select from there
Ctrl + a, Then Press Shift + '

13)
How to switch to screen window/tab 0 - 9
Ctrl + a, Then Press 0 -9

14)
How to Toggle  to  the  window/tab  displayed  previously
Ctrl + a, Then Ctrl + a again

15)
How to change the name of screen window/tab
Ctrl + a, Then Press Shift + a

16)
How to clear a screen window/tab
Ctrl + a, Then Press Shift + c

17)
How to Kill all windows and terminate screen
Ctrl + a, Then Press \
screen -ls

18)
How to lock a screen session
Ctrl + a, Then Press x

19)
How to log a screen session
You will find screenlog.0 file in your home directory.
Ctrl + a, Then Press Shift + h
or
#screen -L (Capital L)

20)
reattach to a specific window/tab in a screen session
#screen -r session_id_or_name -p tab_num_or_name

21)
If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user.
#screen -D -R

22)
How to create new screen session and specify a meaningful name for the session.
#screen -S session_name

23)
Howto Attach to a not detached screen session.
#screen -x

24)
How to split screen
a)
Split the Window
Horizontally
Ctrl + a, Then Press Shift + s
or
Vertically
Ctrl + a, Then Press Shift + \

b)
Switch between spilted windows
Ctrl + a, Then Press Tab
or
Ctrl + a, Then Type :focus
* Here :focus is a command

c)
In the spited window use following command to open existing session
Ctrl + a, Then Press 0-9
or
Ctrl + a, Then Press n or p
or
Ctrl + a, Then Press Shift + '
or
Ctrl + a, Then Presss c


d)
Resize a splitted window/region
Ctrl + a, Then Type :resize 25
* Here :resize is a command

e)
Remove current splitted window/region
Ctrl + a, Then Type :remove
* Here :remove is a command
or
Ctrl + a, Then Press Shift + x

f)
Remove all spiltted windows/regions except the current one.
Ctrl + a, Then Type :only
* Here :only is a command
or
Ctrl + a, Then Press Shift +q

g)
Change color of split bar (border)
http://michael-prokop.at/computer/config/.screenrc
#vim ~/.screenrc
sorendition 10 74

h)
Close the screen and all regions
Ctrl + a, Then Press \

25)
How to rename an existing session
screen -ls
screen -x old_session_name
Ctrl + a, Then Type :sessionname new_session_name
*Here :sessionname is a command

1 comment:

  1. http://fosshelp.blogspot.com/2014/06/linux-screen-create-rename-session-and.html

    ReplyDelete