util-linux is a collection of system utilities maintained as an independent upstream project. It supplies interfaces for block devices, mounts, terminals, sessions, namespaces, resource control, and data formatting. Distributions can split utilities into separate packages, so installed commands depend on packaging policy.
Operational Boundaries #
Commands that modify partitions, mounts, swap, device state, process credentials, or namespaces require suitable privileges. Inspect state before changing it, identify devices through stable attributes such as UUID or /dev/disk/by-id, and confirm a target is not mounted or in active use.
The project spans several kernel interfaces:
lsblk,blkid,blockdev,fdisk, andwipefsinspect sysfs, device nodes, ioctls, and on-disk signatures;mount,umount,findmnt, andfsfreezeoperate on the VFS mount API and/proc/self/mountinfo;unshare,nsenter,setpriv,prlimit,taskset, andchrtconfigure process namespaces, credentials, resource limits, affinity, and schedulers;agetty,script,setterm, andwalloperate on terminals and login records.
The exact command set depends on the util-linux build configuration and
distribution packaging. Use command --help, the command’s man page, and
the distribution’s package metadata or an individual command’s --version
output before depending on a recent option.
Command Reference #
| Command | Purpose |
|---|---|
addpart | add a partition to a kernel-recognized disk table |
agetty | open a terminal line and start login |
blkdiscard | discard sectors on a block device |
blkid | locate or print block-device attributes |
blkpr | manage block-device persistent reservations |
blkzone | manage zoned block-device zones |
blockdev | issue block-device ioctl operations |
cal | display a calendar |
cfdisk | interactive partition-table editor |
chcpu | configure CPU state where the architecture supports it |
chfn | change a user finger-information field |
chmem | configure memory state where the architecture supports it |
choom | display or adjust out-of-memory killer scores |
chrt | inspect or set scheduling policy and priority |
chsh | change a user login shell |
col | filter reverse line feeds |
colcrt | filter nroff overstrikes |
colrm | remove selected columns from lines |
column | format input into columns or tables |
ctrlaltdel | set Ctrl-Alt-Del handling |
delpart | remove a partition from the kernel |
dmesg | print or control the kernel ring buffer |
eject | eject or close removable-media devices |
enosys | return an unimplemented-system-call error |
exch | exchange two files atomically |
fadvise | predeclare file-access patterns |
fallocate | allocate file space |
fdisk | manipulate partition tables |
fincore | count cached pages in files |
findfs | find a block device by label or UUID |
findmnt | list mounted filesystems |
flock | acquire an advisory file lock |
fsck | check and repair a filesystem |
fsck.cramfs | check a cramfs filesystem |
fsck.minix | check a Minix filesystem |
fsfreeze | freeze or unfreeze a filesystem |
fstrim | discard unused filesystem blocks |
getopt | parse command-line options in shell scripts |
hardlink | find or replace duplicate files with hard links |
hexdump | display file contents in hexadecimal |
hwclock | query or set the hardware clock |
i386 | run a program with i386 personality |
ionice | get or set I/O scheduling priority |
ipcmk | create System V IPC objects |
ipcrm | remove System V IPC objects |
ipcs | show System V IPC status |
irqtop | display interrupt usage |
isosize | report an ISO-9660 image size |
kill | send a signal to processes |
last | show login history from wtmp |
lastb | show failed-login history from btmp |
lastlog2 | query or update the lastlog2 database |
ldattach | attach a line discipline to a serial device |
linux32 | run a program with 32-bit personality |
linux64 | run a program with 64-bit personality |
logger | write a message to the system log |
login | begin a user login session |
look | display lines beginning with a string |
losetup | manage loop devices |
lsblk | list block devices |
lsclocks | list available clocks |
lscpu | display CPU architecture information |
lsfd | list open file descriptors |
lsipc | display System V IPC information |
lsirq | list interrupt information |
lslocks | list local system locks |
lslogins | display known users |
lsmem | list memory ranges |
lsns | list namespaces |
mcookie | generate a magic cookie |
mesg | control terminal write permission |
mkfs | build a filesystem |
mkfs.bfs | build a SCO BFS filesystem |
mkfs.cramfs | build a compressed ROM filesystem |
mkfs.minix | build a Minix filesystem |
mkswap | create a swap area |
more | page through text |
mount | attach a filesystem |
mountpoint | test whether a path is a mount point |
namei | resolve path components |
newgrp | start a shell with a different group |
nologin | refuse interactive logins |
nsenter | run a program in existing namespaces |
partx | tell the kernel about disk partitions |
pg | page through text |
pipesz | inspect or set pipe buffer size |
pivot_root | change the root filesystem |
prlimit | get or set process resource limits |
readprofile | read kernel profiling information |
rename | rename files using a substitution |
renice | alter process scheduling priority |
resizepart | resize a partition entry |
rev | reverse characters in each line |
rfkill | query or change radio-device state |
rtcwake | enter suspend using an RTC wake alarm |
runuser | run a command as another user |
script | record a subshell terminal session |
scriptlive | stream a recorded terminal session |
scriptreplay | replay a recorded terminal session |
setarch | change execution personality |
setpgid | set a process group identifier |
setpriv | run a program with selected privileges |
setsid | run a program in a new session |
setterm | control terminal attributes |
sfdisk | scriptable partition-table editor |
su | run a shell as another user |
sulogin | single-user-mode login |
swaplabel | print or change swap labels |
swapoff | disable swap devices or files |
swapon | enable swap devices or files |
switch_root | switch to a new root filesystem |
taskset | get or set CPU affinity |
tunelp | set parallel-port printer parameters |
uclampset | get or set utilization clamping |
ul | underline text with backspaces |
umount | detach mounted filesystems |
uname26 | run a program with a Linux 2.6 personality |
unshare | run a program with new namespaces |
utmpdump | dump utmp or wtmp records |
uuidd | run the UUID generation daemon |
uuidgen | generate UUIDs |
uuidparse | parse and print a UUID |
vigr | edit group or gshadow safely |
vipw | edit passwd or shadow safely |
waitpid | wait for a child process |
wall | write a message to logged-in users |
wdctl | show watchdog-device status |
whereis | locate binary source and manual files |
wipefs | erase filesystem or partition signatures |
write | send a message to another terminal |
x86_64 | run a program with x86-64 personality |
zramctl | set up compressed RAM block devices |
Common Workflows #
lsblk --fs, blkid, findmnt, and mountpoint inspect storage without
changing it:
lsblk --json --output NAME,PATH,SIZE,FSTYPE,UUID,MOUNTPOINTS
findmnt --json --output SOURCE,TARGET,FSTYPE,OPTIONS
blkid --probe --usages filesystem /dev/disk/by-id/exampleSpecify columns in scripts because default output changes as util-linux adds
information. Prefer --json, --pairs, or --raw where supported, and set
LC_ALL=C if parsing human-readable diagnostics. Never parse the aligned default
table as a stable interface.
fdisk, cfdisk, and sfdisk modify partition tables. Save the current layout
with sfdisk --dump and verify the device by size, model, serial, and stable path
before writing. partx asks the kernel to add or remove partition mappings after
an intended table change; it does not edit the on-disk table. mkswap prepares a
swap area, then swapon enables it and swapoff disables it.
unshare, nsenter, setpriv, runuser, setarch, and taskset affect execution context. A namespace or affinity change does not grant permissions; capabilities, user mappings, and cgroup policy still determine what the process can do.
unshare --user --map-root-user --mount-proc sh
nsenter --target "$pid" --mount --uts --ipc --net --pid
script --log-out session.typescript --log-timing session.timingnsenter joins the selected namespaces of an existing process and therefore
requires permission to inspect and enter them. unshare availability for
unprivileged user namespaces is controlled by the kernel and local security
policy.
script, scriptreplay, and scriptlive can capture terminal sessions. Recorded input may contain credentials or other secrets, so files require access controls appropriate to their contents.
Comments
Read or comment on GitHub (sign-in required to comment)