Skip to content

Instantly share code, notes, and snippets.

@samsammurphy
Last active May 15, 2019 22:01
Show Gist options
  • Save samsammurphy/4810b4117ebdafabd2cfd11421e97a79 to your computer and use it in GitHub Desktop.
Save samsammurphy/4810b4117ebdafabd2cfd11421e97a79 to your computer and use it in GitHub Desktop.
screen-advanced

An more advanced example of using screen.

sudo apt install screen

PART 1 Running a big process in the cloud

1) ssh into server (or practice locally first)

2) start screen

$ screen

# press return to get back to terminal

3) run a command

$ htop

4) create a new screen

Ctrl+a c

4) run another command

$ echo 'running my big process here..'

5) split the screen (vertically)

Ctrl+a |

6) move cursor between split screens

Ctrl+a Tab

7) move to next screen

Ctrl+a n

8) detach from screen and let commands keep running

Ctrl+a d

9) disconnect from server

exit

PART 2 Reconnecting to the process

1) re-connect by ssh

2) list screens

screen -ls

3) re-attach to screen

screen -r {id}

# {id} only required if you ran the screen command multiple times

4) check out your screens

Ctrl+a n

5) exit the screens

exit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment