How am I supposed to use nvidia-prime?
You need to have both Nvidia proprietary drivers and nvidia-prime to get it working. This can be done by running
sudo apt-get install nvidia-346 nvidia-prime
for Ubuntu 14.04 and 15.04.
Then you will have Nvidia X Server Settings
in Dash. And there you can find PRIME profiles.
you can also do
sudo prime-select intel
(or nvidia or query)
Ubuntu 18.04.1 repositories have been updated with a partial backport of work from 18.10 which dramatically improves the Optimus experience. To call it a night and day difference doesn't do it justice.
But when you are in intel-only mode, the nvidia GUI control panel does not launch. This will fixed since it's not a problem in 18.10, but until then, use the command line approach. I suspect the fix won't arrive until 18.04.2