1 Answer
1

You can. You've just shown you can! You can even simplify it a little:

gnome-terminal -x bash -c "sudo apt-get update"

It needs a terminal because it's interactive (because of sudo). If you just want to suppress the password request, you could edit your /etc/sudoers file so it doesn't require a password for apt-get. In my opinion, this isn't great because it might be abused.

For this command there is another option: Aptdaemon. This is what the Software Centre and Update Manager now use for permissions (it uses PolicyKit and it's designed on PackageKit). To update apt, just run:

aptdcon -c

That shouldn't require a password and if it does, it should be able to pop up a PolicyKit box without needing a terminal to be spawned.

It feels like you didn't really answer his question, which I interpreted to mean, "Why do we have to wrap up commands with 'gnome-terminal ...'". Maybe it's just my interpretation, and he was really just interested in the sudo details. What actually interprets/runs the custom keyboard shortcuts anyway?
–
BlueBomberAug 8 '14 at 3:27