GNU Screen is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.

Start screen


Detach from Session

CTRL+a , d

Attach to Session

screen -r -S <name>


screen -r -S postalcodes

Start Application in screen Session

screen -dmS postalcodes bash -c "cd /opt/postalcodes && exec java -jar postalcode.jar server config.yml"

This starts a screen session with the name postalcodes, changes the current directory to /opt/postalcodes and starts the Dropwizard server application postalcodes with the parameters server and config.yml.

This is useful for applications which tend to output things on stdout or stderr because the terminal session is not ended by leaving because you can detach from and attach to the session.