Tuxicity's source

February 28, 2007

How to get rid of having to type sudo all the time in Ubuntu

Filed under: Kubuntu, Tuxicity, Ubuntu, xubuntu — tuxicity @ 4:34 pm

One of the biggest pains in Ubuntu is having to type sudo all the time.

Sudo this, sudo that, for every command that requires root permissions, is boring and a strain on your precious rsi sensitive hands.

The best way to deal with this unneeded extra typing is the use of aliases.
In your personal home folder is a .bashrc file (mind the dot) where you can make aliases for long, tedious, often used commands.
The .(dot) stands for “hidden file”, meaning it does not show up by default in your filemanager.

Lets say you want to shorten “sudo apt-get update” to “update”.

At the end of the .bashrc file you could fix that with :

alias update=’sudo apt-get update’

Thats how easy it is

In short:

gedit .bashrc

Add (As example) at the bottom:

alias update=’sudo apt-get update’
alias upgrade=’sudo apt-get dist-upgrade’
alias install=’sudo apt-get install’
alias synaptic=’gksu synaptic’
alias su=’sudo -i’
#sudo -i creates a root terminal

Save and close gedit, restart your terminal and test your new shortened commands.
Of course you can also change, and/or add other aliases if you like.

This also works in Kubuntu and Xubuntu, just use your favorite editor to add the aliases
to your .bashrc.

1 Comment »

  1. sweet! using your tip, i’ve reduced a rather lengthy nfs mount command involving ip addresses and mount points to one word!

    genius!

    Comment by groggyboy — February 28, 2007 @ 7:44 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: