Originally I wanted to make a live CD with this... However I gave up on that.

So Is there a way to do this, have ubuntu figure out which card is loaded, before loading a driver. Or... How could I create a script to load at boot to "| grep pci... etc" and print for variable to run "activate_AMD.sh" or "activate_NV.sh" etc...


1 Answer 1


Ubuntu automatically detects which GPU is installed in your machine. If you want a script to switch between Nvida and Intel drivers I've found one you can modify here: bauca/graphics-switcher

It will require the program glxinfo which you can get by installing:

sudo apt install mesa-utils

One key function in the bash script that will interest you is this one:

function CheckForCurrentVideoCardInUse {
    local _VIDEO_CARD=`glxinfo|egrep "OpenGL vendor|OpenGL renderer*"`
    if [[ $_VIDEO_CARD == *"NVIDIA"* && $_VIDEO_CARD == *"GeForce"* ]]; then
    elif [[ $_VIDEO_CARD == *"Intel"* ]]; then
  • Doesn't seem to handle AMD unfortunately. Aug 13, 2018 at 14:08
  • Sorry I dont get on this site often enough - But useful information; However, Seems I must clarify. # Not your fault tho.
    – TardisGuy
    Oct 21, 2018 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.