I've followed a couple of tutorials on my RPi and a lot of commands start with sudo; what does it mean and what does it do?

  • Meta Question: meta.raspberrypi.stackexchange.com/questions/97/… Commented Jun 14, 2012 at 11:43
  • 7
    This is a great question, I can imagine a lot of beginners wanting information on this.
    – berry120
    Commented Jun 14, 2012 at 11:44
  • @berry120 yes but it would have been more suited to Unix/Linux SE because people run their Pi's on other OSes as well (I'm looking at you, RISC OS!)
    – evamvid
    Commented Apr 6, 2014 at 0:22
  • Whaaaat? Year-Old Question! make that 2 years!
    – evamvid
    Commented Apr 6, 2014 at 0:23
  • @evamvid This was one of the first example questions on RPi.SE... Commented Apr 6, 2014 at 10:13

2 Answers 2


sudo stands for Super User Do; it allows you to run as another user, usually the super user (root), to carry out administrative tasks, such as update the software, change filesystems, and start daemons.

root has the ultimate power and can run pretty much anything. It can, therefore, do a lot of damage to your system and in the worst case, you will have to start again.

You must always understand what a command is doing before you run it.

Why do we have sudo?

For security reasons, normal users can't do everything. It prevents you doing anything too bad by accident and prevents malicious users damaging the system.

Why don't we sign in as root when we want elevated permissions?

sudo allows administrators to control what commands each user can run as root. For example, your administrator may allow you to run apt-get as root, but nothing else. Furthermore, all commands run via sudo are logged in /var/log/auth.log.

Other Distributions

The default Debian image has sudo installed in advance, but others may not. You can often install it using the distributions package manager, or investigate other ways of gaining root permissions.


You can install sudo using pacman: run pacman -S sudo as root. You should then add a new user and disable the root account.


In Arch Linux (and other distributions that support it), you can use su (substitute user) command to assume the identity of any other user (including root). This means that all your future commands (in the current session) will have their permissions. However, you will require the their password and the commands you run won't, necessarily, be logged.

See also:

  • 1
    Do you think information on su might be useful to really complete the answer?
    – Alex L
    Commented Jun 14, 2012 at 14:38
  • Propose an edit under the Other Distributions heading? Commented Jun 14, 2012 at 14:41
  • Further to this, I tend to write "sudo bash" as soon as I load my pi to avoid having to type sudo all the time. This lets you run everything with super user privileges. This is obviously a little dangerous, but with the rpi there is little majorly bad that you can do.
    – phalt
    Commented Jun 14, 2012 at 15:50
  • 1
    This is a very bad habit to get into! Commented Jun 19, 2012 at 12:47
  • 1
    @phalt Why don't you just log in as root then?
    – Jivings
    Commented Jul 27, 2012 at 12:23

You usually use it to execute a particular command as root, rather than your current user. For security reasons the norm in the Linux world is for your main user to have limited privileges, and for you to switch to root whenever you need to do something you don't have privileges for (such as installing packages.)

Root is a bit like administrator in the Windows world - it's your ultimate "can-do-anything" user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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