/sbin
administration commands→ usr/sbin/sbin holds the system administration commands. These are the programs that partition disks, configure the network and manage users. Anyone can usually look at them, but most of them only do their job when run as root.
The tools that change the system, kept apart from the everyday ones.
Why it exists
Every directory at the top of the tree is there for a reason. This is the problem /sbin solves.
Formatting a disk and listing a directory are not the same kind of act. Keeping the administration commands apart makes it clear which is which.
On some distributions /sbin is only on root’s PATH. A normal user who types fdisk may be told the command is not found, although it is installed.
What you find inside
Not everything, but the entries worth recognising. Each is marked as a directory, a file, a link or a device.
- ipfileShows and changes interfaces, addresses and routes.
- fdiskfileReads and edits a disk’s partition table.
- mkfsfileCreates a filesystem on a partition.
- useraddfileCreates a user account.
- rebootfileRestarts the machine.
- sshdfileThe SSH server program.
At the terminal
Four commands that show what this directory is doing on a real machine.
ls -ld /sbinShow that /sbin is a link, and where it points.
ls /usr/sbin | headList the first few administration commands installed.
sudo fdisk -lRun an administration command with root’s rights — here, list the disks.
which ipFind which directory an administration command lives in.
Handle with care
What goes wrong here, and what someone securing or attacking the machine looks at.
mkfs and fdisk do not ask twice. Check the device name before running anything that writes to a disk.
If an administration command seems to be missing, try it with sudo or by its full path before installing anything.