linux background code example

Example 1: run screen on background linux terminal

# Install screen
yum install screen

# Initiate a Screen
screen -S <screen name> <command to execute>

# Detach from the screen
CTRL + A, D

# List all the screen currently working
screen -ls

# Reattach to a screen
screen -r <screen name>

# Kill specific screen
screen -X -S <screen name> quit

# Kill all screens
pkill screen

Example 2: background script linux

$ nohup serve -s build -l 8080 &