10.24. Util-linux-2.24.2

The Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.

10.24.1. FHS compliance notes

The FHS recommends using the /var/lib/hwclock directory instead of the usual /etc directory as the location for the adjtime file. To make the hwclock program FHS-compliant, run the following:

sed -i -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
    $(grep -rl '/etc/adjtime' .)
mkdir -pv /var/lib/hwclock

10.24.2. Installation of Util-linux

[Note]

Note

findmnt, and lsblk can utilize libudev for WWN and serial number information. If this is desired, rebuild Util-linux after Section 10.63, “Eudev-1.7”

Prepare Util-linux for compilation:

./configure --enable-write --docdir=/usr/share/doc/util-linux-2.24.2

The meaning of the configure options:

--enable-write

This option allows the write program to be installed.

Compile the package:

make

To test the results, issue:

chown -Rv nobody . &&
su nobody -s /bin/bash -c "PATH=$PATH make -k check"

Install the package:

make install

Move the logger binary to /bin as it is needed by the CLFS Bootscripts package:

mv -v /usr/bin/logger /bin

10.24.3. Contents of Util-linux

Installed programs: addpart, agetty, blkdiscard, blkid, blockdev, cal, cfdisk, chcpu, chrt, col, colcrt, colrm, column, ctrlaltdel, cytune, delpart, dmesg, eject, fallocate, fdformat, fdisk, findfs, findmnt, flock, fsck, fsck.cramfs, fsck.minix, fsfreeze, fstrim, getopt, hexdump, hwclock, ionice, ipcmk, ipcrm, ipcs, isosize, kill, last, lastb (link to last), ldattach, logger, look, losetup, lsblk, lscpu, lslocks, mcookie, mesg, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap, more, mount, mountpoint, namei, nologin, nsenter, partx, pg, pivot_root, prlimit, raw, readprofile, rename, renice, resizepart, rev, rtcwake, script, scriptreplay, setarch, setsid, setterm, sfdisk, sulogin, swaplabel, swapoff, swapon, switch_root, tailf, taskset, ul, umount, unshare, utmpdump, uuidd, uuidgen, wall, wdctl, whereis, wipefs, write
Installed libraries: libblkid.[a,so], libmount.[a,so], libuuid.[a,so]
Installed directories: /usr/include/blkid, /usr/include/libmount, /usr/include/uuid, /usr/share/bash-completion, /usr/share/doc/util-linux-2.24.2/getopt, /var/lib/hwclock

Short Descriptions

addpart

Informs the kernel of a new partition

agetty

Opens a tty port, prompts for a login name, and then invokes the login program

blkdiscard

Discards sectors on a device

blkid

A command line utility to locate and print block device attributes

blockdev

Allows users to call block device ioctls from the command line

cal

Displays a simple calendar

cfdisk

Manipulates the partition table of the given device

chcpu

Utility to configure CPUs

chrt

Manipulates real-time attributes of a process

col

Filters out reverse line feeds

colcrt

Filters nroff output for terminals that lack some capabilities, such as overstriking and half-lines

colrm

Filters out the given columns

column

Formats a given file into multiple columns

ctrlaltdel

Sets the function of the Ctrl+Alt+Del key combination to a hard or a soft reset

cytune

Tunes the parameters of the serial line drivers for Cyclades cards

delpart

Asks the kernel to remove a partition

dmesg

Dumps the kernel boot messages

eject

Eject removable media

fallocate

Preallocates space to a file

fdformat

Low-level formats a floppy disk

fdisk

Manipulates the partition table of the given device

findfs

Finds a file system by label or Universally Unique Identifier (UUID)

findmnt

Lists mounted filesystems or searches for a filesystem

flock

Acquires a file lock and then executes a command with the lock held

fsck

Is used to check, and optionally repair, file systems

fsck.cramfs

Performs a consistency check on the Cramfs file system on the given device

fsck.minix

Performs a consistency check on the Minix file system on the given device

fsfreeze

Suspends and resumes access to a filesystem

fstrim

Discards unused blocks on a mounted filesystem

getopt

Parses options in the given command line

hexdump

Dumps the given file in hexadecimal or in another given format

hwclock

Reads or sets the system's hardware clock, also called the Real-Time Clock (RTC) or Basic Input-Output System (BIOS) clock

ionice

Gives and sets program I/O scheduling class and priority

ipcmk

Creates various IPC resources

ipcrm

Removes the given Inter-Process Communication (IPC) resource

ipcs

Provides IPC status information

isosize

Reports the size of an iso9660 file system

kill

Send a signal to a process

last

Shows which users last logged in (and out), searching back through the /var/log/wtmp file; it also shows system boots, shutdowns, and run-level changes

lastb

Shows the failed login attempts, as logged in /var/log/btmp

ldattach

Attaches a line discipline to a serial line

logger

Enters the given message into the system log

look

Displays lines that begin with the given string

losetup

Sets up and controls loop devices

lsblk

Prints information about block devices

lscpu

Prints CPU architecture information

lslocks

Lists local system locks

mcookie

Generates magic cookies (128-bit random hexadecimal numbers) for xauth

mesg

Controls whether other users can send messages to the current user's terminal

mkfs

Builds a file system on a device (usually a hard disk partition)

mkfs.bfs

Creates a Santa Cruz Operations (SCO) bfs file system

mkfs.cramfs

Creates a cramfs file system

mkfs.minix

Creates a Minix file system

mkswap

Initializes the given device or file to be used as a swap area

more

A filter for paging through text one screen at a time

mount

Attaches the file system on the given device to a specified directory in the file-system tree

mountpoint

Tells you whether or not a directory is a mount point.

namei

Shows the symbolic links in the given pathnames

nologin

Displays a message that an account is not available. Designed to be used as the default shell for accounts that have been disabled

nsenter

Runs a program with namespaces of other processes

partx

Tells the kernel about the presence and numbering of on-disk partitions

pg

Displays a text file one screen full at a time

pivot_root

Makes the given file system the new root file system of the current process

prlimit

Gets and sets a process' resource limits

raw

Binds a Linux raw character device to a block device

readprofile

Reads kernel profiling information

rename

Renames the given files, replacing a given string with another

renice

Alters the priority of running processes

resizepart

Asks the Linux kernel to resize a partition

rev

Reverses the lines of a given file

rtcwake

Enters a system sleep state until a specified wakeup time

script

Makes a typescript of a terminal session

scriptreplay

Plays back typescripts created by script

setarch

Changes reported architecture in new program environment and sets personality flags

setsid

Runs the given program in a new session

setterm

Sets terminal attributes

sfdisk

A disk partition table manipulator

sulogin

Allows root to log in; it is normally invoked by init when the system goes into single user mode

swaplabel

Prints or changes the label or UUID of a swap area

swapoff

Disables devices and files for paging and swapping

swapon

Enables devices and files for paging and swapping and lists the devices and files currently in use

switch_root

Switches to another filesystem as the root of the mount tree

tailf

Tracks the growth of a log file. Displays the last 10 lines of a log file, then continues displaying any new entries in the log file as they are created

taskset

Retrieves or sets a process's CPU affinity

ul

A filter for translating underscores into escape sequences indicating underlining for the terminal in use

umount

Disconnects a file system from the system's file tree

unshare

Runs a program with some namespaces unshared from parent

utmpdump

Displays the content of the given login file in a more user-friendly format

uuidd

A daemon used by the UUID library to generate time-based UUIDs in a secure and guranteed-unique fashion.

uuidgen

Creates new UUIDs. Each new UUID can reasonably be considered unique among all UUIDs created, on the local system and on other systems, in the past and in the future

wall

Writes a message to all logged-in users

wdctl

Show hardware watchdog status

whereis

Reports the location of the binary, source, and man page for the given command

wipefs

Wipes a filesystem signature from a device

write

Sends a message to the given user if that user has not disabled receipt of such messages

libblkid

Contains routines for device identification and token extraction

libmount

Contains routines for parsing the /etc/fstab, /etc/mtab, and /proc/self/mountinfo files, managing /etc/mtab, and configuring various mount options

libuuid

Contains routines for generating unique identifiers for objects that may be accessible beyond the local system