Screen
Shortcuts
Use ctrl+a
, then:
c to create a window with shell
" list all windows
0 switch to window 0
S split horizontal
| split vertical
tab to switch next region
Q Close all regions but the current one
X Close current region
escape+up-arrow scroll up
escape+down-arrow scroll down
enter or return to select text (type again to copy in buffer)
] paste the buffer (different buffer than ctrl+insert)
:focus left to focus on left region
d detach the screen
:resize -10 to reduce the size by 10
:resize 10%
list the screen
screen -ls
resume screen session
screen -r
kill session by name
screen -X -S NAME_OR_ID quit
Logging
When you're looking for logging the output from a detached screen, you have to specify -L
option, but also a config file if you do not want that your logfile is truncated or incomplete due to unexpected behavior source.
conf.log
logfile result.log
logfile flush 1
log on
logtstamp after 60
logtstamp string "[ %t: %Y-%m-%d %c:%s ]\012"
logtstamp on
Run example:
screen -c ./log.conf -L -dmS test python3 benchmark.py
Alternative
Create a screen screen -S test
, then attach current terminal to the created screen screen -x test
, then run your command inside