5

I would like to be able to install stuff straight from apps.ubuntu.com, but the software center takes a long time to load up and install stuff. Is there a way to set "apt" URIs to open up in the terminal as "sudo apt-get install X

EDIT: I am using chrome. Is there some kind of extension that can do this?

1 Answers1

5

Assuming you are using Firefox, you can create a simple shell script to do this. There may be a similar mechanism for other browsers, but I am not familiar with those.

  1. Open GEdit (or any other editor) and enter the following:

    #! /bin/bash
    
    aptInstall="$@"
    aptInstall=${aptInstall#*:}
    gnome-terminal -e "sudo apt-get install $aptInstall"
    
  2. Save this script. I will refer to it as ~/apt_terminal.sh.

  3. Open the terminal and run chmod a+x ~/apt_terminal.sh. This will make the script executable.
  4. Now open Firefox's Preferences and go to the "Applications" section. Find the "apt" content type.
  5. Select "Use other" under the "Action" heading for the "apt" content type and browse to the location of the script you just created.

Now apt:// URLs should open up in the terminal by prompting you for your password.