Screen allows us to separate our long running sessions such as FiveM and Teamspeak on a “screen”.
Your “screen” will stay running even after you have logged out.
Step 1. Installing Screen
sudo apt-get update
sudo apt-get install screen
Simple enough.
Step 2. Using Screen
screen -ls ( Shows available sessions, ids, and names )
screen -r sessionname ( Opens the session that you selected with sessionname )
screen -dr sessionname ( Opens the session directly even if it is currently open by one or more clients )
screen -dmS sessionname command ( creates new session )
Example of starting FiveM with screen :
screen -dmS fivemserver bash /root/fx-server/run.sh +exec server.cfg
Example output of screen -ls
To open the “fivemserver” session you do :
screen -r fivemserver
if “fivemserver” is “(Attached)”, this means there is currently someone already inside the session ( this happens if you improperly exit the session aswell ) screen -r will NOT work if the session is attached, so you must directly open it with
screen -dr fivemserver
You should also notice the ID assigned to the session, look to the left of fivemserver, see the 17190?, you can open a session with just that.
screen -r 17190
This should be used when there are multiple sessions running under the name of “fivemserver”, or else screen will not work.
notice how when you have multiple sessions using the name of “fivemserver” wont work, that is why we use the ID when there are multiple sessions using the same name.
MUST READ
To terminate a session, do [CNTRL]+[C] while it is open. To exit the session do [CNTRL]+[A]+[D]
You are welcome for this bad guide.