run command in a named background session using (screen or tmux)

screen -d -S "sessionname"  -m "command"
start nodemon in a seperate screen in the background inside path /var/www/ and execute server.js

screen -d -S nodemon -m cd /var/www/ && nodemon server.js

Start a named Session

# within a running screen: Press CTRL+A, ":sessionname "
screen -S "sessionname"

# view running screen's: screen -ls
# connect: screen -xS "sessionname"

Rename a Session

´Press Ctrl+A.
:sessionname "new sessionname"
´Press Enter

Deatatch with STRG + A and then STRG + D

Leave a Reply

Your email address will not be published.