You need elevated privileges (obtained with
sudo) when you want to
- read a file that your user does not have the permission to read,
- write to a file that your user does not have the permission to write to, or
- execute a file that your user does not have the permission to execute.
In practice, it usually means changing files outside your user’s home directory, which are typically owned by the
root user and other users are not given permissions to modify, for security and system stability reasons. Often, however, you want to modify those files, either directly (for example, when changing some setting pertaining to the entire system), or indirectly, for example when updating software, and that’s when
sudo becomes quite useful.
As a general rule, everything that you can accomplish without
sudo you should do without
sudo. If in doubt, try it without
sudo first and if it works, it would have been a mistake to use
sudo. Another general rule, already mentioned, is to never run GUI applications with
And of course, when you type the command
sudo, that’s five additional key-presses of time for you to think about what you’re doing. Use that time and be aware of what you’re doing, think of it as a reminder to pay attention.