abhishek@hp:~$ apt --installed list | grep nvidia
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
nvidia-364/xenial,now 364.19-0ubuntu0~gpu16.04.3 amd64 [installed]
nvidia-opencl-icd-364/xenial,now 364.19-0ubuntu0~gpu16.04.3 amd64 [installed,automatic]
nvidia-prime/xenial,xenial,now 0.8.2 amd64 [installed,automatic]
nvidia-settings/xenial,now 364.15-0ubuntu0~gpu16.04.2 amd64 [installed,automatic]
abhishek@hp:~$ sudo ubuntu-drivers devices
== cpu-microcode.py ==
driver : intel-microcode - distro non-free
== /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0 ==
model : GM108M [GeForce 940M]
modalias : pci:v000010DEd00001347sv0000103Csd000080A4bc03sc02i00
vendor : NVIDIA Corporation
driver : nvidia-358 - third-party free
driver : nvidia-361 - third-party free
driver : xserver-xorg-video-nouveau - distro free builtin
driver : nvidia-364 - third-party free
driver : nvidia-367 - third-party free recommended