Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

everyone. I'm new to Ubuntu Gnome, and I just wanted to know if it's possible to create a shortcut such as CTRL+1, and have the terminal popup and run a command such as 'sudo apt-get upgrade'.

Is this possible, and if so how can it be done?

Thank you!

share|improve this question
    
possible duplicate of Apply icons to bash scripts –  bodhi.zazen Feb 12 '13 at 23:29
1  
@bodhi.zazen This isn't a duplicate. The OP wants a keyboard shortcut to run an update. –  Seth Feb 13 '13 at 0:03
    
    
@bodhi.zazen That's quite helpful, but far broader than this. What the OP wants to do here is useful in a variety of circumstances and is now answered; I see no reason not to just keep this open. –  Eliah Kagan Feb 13 '13 at 0:28

1 Answer 1

Yes, this can be done.

Install xbindkeys:

sudo apt-get install xbindkeys  

And create the config file:

touch .xbindkeysrc 

And now edit the file:

gedit .xbindkeysrc

Add this to the file:

"gnome-terminal -e 'sudo apt-get upgrade'"
Control+1

Save the file.

Now you need to add xbindkeys to "Startup Application". That is addressed near the bottom of this answer on remapping keys.

The only problem with this solution is, if there aren't any prompts, the terminal will only stay open long enough to get your password and ask if you want to run the upgrade. I don't know of a way to keep the terminal open, but maybe someone else will.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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