The first method is the easiest to perform and in most cases it is the recommended approach. First, detect the model of your nvidia graphic card and the recommended driver. To do so execute:
$ ubuntu-drivers devices == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == modalias : pci:v000010DEd00001180sv00001458sd0000353Cbc03sc00i00 vendor : NVIDIA Corporation model : GK104 [GeForce GTX 680] driver : nvidia-304 - distro non-free driver : nvidia-340 - distro non-free driver : nvidia-384 - distro non-free recommended driver : xserver-xorg-video-nouveau - distro free builtin == cpu-microcode.py == driver : intel-microcode - distro freeIf you agree with the recommendation feel free to use
ubuntu-drivers
command again to install all recommended drivers:$ sudo ubuntu-drivers autoinstallOnce the installation is concluded, reboot your system and you are done.