Graphics card not showing in Nvidia X Server Settings Ubuntu

It can sometimes be quite a mission to get Nvidia graphics cards working correctly with Ubuntu/Linux. I recently encountered an issue where after installing the drivers (for the GTX 1060) using the software repositories and later manually, that the graphics card didn't show up in the Nvidia X Server settings. I solved this by issuing the following commands:

sudo apt purge nvidia-prime nvidia-settings
sudo apt install nvidia-prime nvidia-settings
sudo apt remove nvidia*
sudo reboot
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-390 nvidia-prime
sudo reboot