screen

ways to continue run command after shell exit

  1. screen:
    screen -dmS <screen_name> <command>
    exit
  2. nohup:
    nohup <command> &
    exit
  3. at:
    echo "<command>" | at now
    exit
  4. disown:
    <command> &
    disown -h
    exit

Share screen session

  1. Start screen using the command:

    $ screen -S <SessionName>

    The -S switch gives the session a name, which makes multiple screen sessions easier to manage.

  2. Allow multiuser access in the screen session:

    CTRL-A
    :multiuser on

  3. Grant permission to the guest user to access the screen session:

    CTRL-A
    :acladd <guest_user>

  4. The guest user can now connect via:

    $ screen -x <host_user>/<SessionName>

Frequently used SCREEN reference commands

# open screen session
screen 

# list screen sessions
screen -ls 

# reattach to screen session
screen -r <name of screen session> 

# attach to a not detached session
screen -x <name of screen session> 

# detach from unattached session
screen -d 

Note: ^A = Ctrl-a (Press the "a" key while holding down Control key)

detach from screen session attached to
^A d 

# open another session
^A c 

list the screen windows
^A w 

# print screen and save a hardcopy
^A h 

# go to next window
^A n 

# go to previous window
^A p

# lock screen
^A x
Comment