Skip to content

Instantly share code, notes, and snippets.

@emadehsan
Created April 18, 2018 11:52
Show Gist options
  • Select an option

  • Save emadehsan/ad6e81ca595e99045abb391844f45346 to your computer and use it in GitHub Desktop.

Select an option

Save emadehsan/ad6e81ca595e99045abb391844f45346 to your computer and use it in GitHub Desktop.

Revisions

  1. emadehsan created this gist Apr 18, 2018.
    89 changes: 89 additions & 0 deletions Screen Unix Cheat Sheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,89 @@
    Install Screen

    $ sudo apt install screen

    Enter a new Screen Session

    $ screen

    Detach from current screen session

    Ctrl + a + d

    List screen sessions

    $ screen -ls

    List the processes

    $ ps -e | grep PID_OF_SCREEN_SESSION

    Enter a new screen session & giving it the name newScreenSession

    $ screen -S newScreenSession

    Reattach to a screen session

    $ screen -r PID_OF_SCREEN_SESSION

    Execute a command in a screen session (quit command in this case)

    $ screen -X -S PID_OF_SCREEN_SESSION quit

    Kill a session from within it

    Ctrl + a + k

    It is actually for killing windows from within screen sessions.

    New Windows Session from within screen

    Ctrl + a + c

    List all windows in a session

    Ctrl + a + w

    Ctrl a "

    Ctrl a n: move to next window

    Ctrl a p: move to previous window

    Kill all windows & session

    Ctrl a \

    Divide in the panes

    Ctrl a |

    Move to sibling pane

    Ctrl a tab

    Divide in the panes Horisontal

    Ctrl a S

    Remove a pane

    Ctrl a X

    Lock a session with a password

    Ctrl a x

    Run a command in a screen

    $ screen -d -m python script.py

    Screen bindings / help

    Ctrl a ?

    Type a screen binding command

    Ctrl a :

    Reference: https://www.youtube.com/watch?v=I4xVn6Io5Nw