[...] But that doesn't seem to make sense, since I'm always having to input sudo, whether I'm managing packages, editing config files, installing a program from source, or what have you. [...]
The implied adjective related to all these is that they are system-wide or
global changes. You must consider the origins of Unix as a multi-user system1 where several users would use the same installation
remotely. It wouldn't make sense for one layman user to allow to change the
global settings for all users. It was the sysadmin's, the root's, privilege and
responsibility.
In a multi-user setting you have the preinstalled software and their
system-wide configuration under /usr
and /etc
respectively. Touching these
locations would require root permissions. But because Unix software is written
with multi-users in mind, you can compile and install software under $HOME
directory2, and have your own configuration files under your home,
where you can edit the files freely without being a super user.
In addition to installing your own software under home, most system-wide
software will read user-specific configuration from $HOME
right after they
first read configuration from /etc
. This allows you to customize most
anything without ever going root
.
With a home PC, in a single main user setting, you can use sudo
and root your
way to things you like. But it's customary to not to touch application
configuration in /etc
but instead always provide user-specific config in home.
That way you can allow your package manager to reset system-wide configs on
upgrades. Installing new software system-wide is pretty OK in single-user
setting; distro packages don't assume the alternatives so it's a easy way out.
I'll let my package manager install stuff globally but any
compiled-from-sources and self-made stuff I leave under $HOME
. And I don't
have to sudo for any of that.
If you have data files, storage outside your $HOME
, feel free to chown
or
chgrp
the directories to your name so you can access the files without
sudo
.
[1] (slightly ironical as Unix was meant to be a 'single user' version of the Multics operating system)
[2] (if the system allows this by not mounting home partitions as noexec)
sudo
to do anything involving changing the system, if you're just operating on your own files/desktop you aren't affecting anyone else so don't need elevated privileges. If you're executing privileged commands without sudo, you're probably already a super user (i.e., root) and that's usually less advisable than using sudo for the specific system-wide taskssudo
when you shouldn't? A normal Unix user's commands should consist mostly ofcd
,ls
, moving, copying, removing, and editing files they have access to. If your usual commands don't consist of this, you probably aren't a regular Unix user.sudo !!
to re-run the last command you typed with sudo in front.