If for some reason you are asking about a command line only operating system such as a ubuntu server you would
sudo vim /etc/systemd/logind.conf
Replace #HandleLidSwitch=suspend
With HandleLidSwitch=ignore
Save the file and restart the service by issuing
sudo restart systemd-logind