Andrew Mercer

GNU Coreutils is the set of basic file, shell, and text manipulation utilities that form the floor of any GNU/Linux userspace. If util-linux owns the kernel-facing plumbing, coreutils owns the day-to-day building blocks every script and interactive session depends on.


What it is

Coreutils is maintained by the GNU Project and developed primarily by Jim Meyering, Pádraig Brady, and a small core team. It consolidates what were historically three separate GNU packages — fileutils, textutils, and shellutils — which were merged into a single package in 2002. Nearly every line of shell script ever written calls into coreutils dozens of times.

It is not the same as util-linux (kernel/device/filesystem facing), bash builtins (which shadow some coreutils tools for performance), or BusyBox (a single-binary reimplementation used in embedded/Alpine environments that provides coreutils-compatible but not always identical behavior).


Utilities by category

File operations

  • ls — list directory contents
  • cp — copy files and directories
  • mv — move or rename
  • rm — remove files or directories
  • mkdir / rmdir — create and remove directories
  • ln — create hard and symbolic links
  • touch — change file timestamps or create empty files
  • install — copy files and set attributes (used heavily in Makefiles)
  • shred — overwrite a file to hide its contents
  • truncate — shrink or extend the size of a file

File information

  • ls — with -l, -a, -h, -R etc.
  • stat — display file or filesystem status (inode, permissions, timestamps, size)
  • file — determine file type (actually not coreutils — this is a separate file package)
  • du — disk usage of files and directories
  • df — report filesystem disk space usage
  • dircolors — color setup for ls
  • readlink — print resolved symbolic links
  • realpath — print the resolved absolute path
  • pathchk — check whether file names are valid or portable
  • basename / dirname — strip directory or suffix from filenames

Text operations

  • cat — concatenate and print files
  • tac — reverse of cat, last line first
  • head / tail — output first or last part of files
  • sort — sort lines of text
  • uniq — report or filter out repeated lines
  • cut — remove sections from each line
  • paste — merge lines of files
  • join — join lines of two files on a common field
  • comm — compare two sorted files line by line
  • diff — not coreutils (GNU diffutils is a separate package)
  • tr — translate or delete characters
  • wc — print line, word, and byte counts
  • grep — not coreutils (GNU grep is a separate package)
  • fold — wrap each input line to fit a specified width
  • fmt — simple optimal text formatter
  • nl — number lines of files
  • pr — convert text files for printing
  • od — dump files in octal and other formats
  • base64 — encode/decode base64
  • base32 — encode/decode base32
  • expand / unexpand — convert tabs to spaces and back

Shell and scripting utilities

  • echo — display a line of text (also a bash builtin; behavior differs slightly)
  • printf — format and print data (also a bash builtin)
  • test / [ — evaluate expressions (also builtins)
  • true / false — return success or failure
  • yes — output a string repeatedly until killed
  • sleep — delay for a specified time
  • env — run a program in a modified environment
  • nohup — run a command immune to hangups
  • xargs — not coreutils (part of GNU findutils)
  • tee — read from stdin and write to stdout and files simultaneously
  • expr — evaluate expressions (largely superseded by $(( )) in bash)

Process and system

  • kill — send signals to processes (also in util-linux; versions differ)
  • nproc — print the number of available processing units
  • uptime — how long the system has been running
  • uname — print system information (also in util-linux)
  • who / w / whoami — show who is logged on
  • id — print real and effective user and group IDs
  • groups — print group memberships
  • logname — print the user's login name
  • users — print the usernames of users currently logged in
  • pinky — lightweight finger

Permissions and ownership

  • chmod — change file mode bits
  • chown — change file owner and group
  • chgrp — change group ownership
  • umask — set file creation mask

Numeric and checksum

  • factor — print prime factors
  • numfmt — reformat numbers (human-readable conversions)
  • seq — print a sequence of numbers
  • shuf — generate random permutations
  • md5sum / sha1sum / sha256sum / sha512sum / b2sum — compute and check message digests
  • cksum — checksum and count the bytes in a file
  • sum — checksum and count the blocks in a file

Archiving and linking

  • link / unlink — call the link/unlink system calls directly
  • sync — flush filesystem buffers

Terminal

  • stty — change and print terminal line settings
  • tty — print the file name of the terminal connected to stdin
  • clear — not coreutils (part of ncurses)

Key behavioral distinctions

Coreutils vs bash builtins — bash reimplements echo, printf, test, kill, pwd, and others as builtins for performance. The builtin runs when you type the bare name; the coreutils version runs when you use the full path (/bin/echo) or call it from a non-bash context. Their behavior is not always identical — echo -e is the classic example where bash and coreutils behave differently depending on compile-time options.

Coreutils vs BusyBox — Alpine Linux and most Docker base images use BusyBox, which is a single binary that provides coreutils-compatible applets. BusyBox aims for compatibility but is not a complete implementation — some flags are missing, some edge cases differ. This is a frequent source of subtle bugs in Docker entrypoint scripts that work on Ubuntu and break on Alpine.

GNU vs BSD coreutils — macOS ships BSD userland, not GNU coreutils. sed, awk, tar, date, stat, and others have meaningfully different flags and behavior. brew install coreutils on macOS installs the GNU versions prefixed with g (gstat, gdate, etc.). This is why scripts written on Linux often break on macOS and vice versa.

POSIX compliance — coreutils aims to be a superset of POSIX. The POSIX-specified behavior is the portable baseline; GNU extensions (long options, additional flags) are on top of that. When writing portable scripts, sticking to POSIX-specified behavior avoids both the GNU/BSD split and the bash/dash split.


Versioning

Current stable is in the 9.x range. Check your version with:

ls --version
# or
cat --version

Distros lag behind upstream — RHEL 9 ships 8.32, Ubuntu 22.04 ships 8.32, Ubuntu 24.04 ships 9.4, Debian 12 ships 9.1.


Documentation sources

Primary / upstream
- GNU Coreutils manual (the definitive reference): https://www.gnu.org/software/coreutils/manual/
- Available in full as a single HTML page, PDF, or Info format
- Source repository (Savannah): https://git.savannah.gnu.org/gitweb/?p=coreutils.git
- GitHub mirror (read-only): https://github.com/coreutils/coreutils
- Mailing list archives: https://lists.gnu.org/archive/html/bug-coreutils/

Man pages

man coreutils      # overview man page listing all utilities
man ls
man stat
man sort
# etc.

Online: https://man7.org/linux/man-pages/ for the Linux-specific versions, or https://www.gnu.org/software/coreutils/manual/ for the GNU canonical versions.

Info pages — coreutils is one of the few packages where the Info documentation is genuinely more complete than the man pages:

info coreutils
info '(coreutils) ls invocation'

POSIX specification — for understanding what's portable vs GNU-specific:
- https://pubs.opengroup.org/onlinepubs/9699919799/ — The Open Group Base Specifications, Issue 7 (POSIX.1-2017)
- Utilities are documented under the "Shell & Utilities" volume

Distro-specific
- Arch Wiki: consistently the best practical Linux documentation, covers coreutils tools with real examples — https://wiki.archlinux.org
- Debian package tracker: https://packages.debian.org/coreutils

Books
- The Linux Command Line by William Shotts — practical, covers coreutils heavily, freely available at https://linuxcommand.org/tlcl.php
- Unix Power Tools by Shelley Powers et al. — O'Reilly, broader scope, good reference
- Classic Shell Scripting by Arnold Robbins and Nelson Beebe — focuses on portable POSIX scripting, highly relevant for understanding what coreutils guarantees vs what's GNU-specific

Quick reference
- tldr pages: https://tldr.sh — community-maintained practical examples for most coreutils tools, much faster than man pages when you just need the common invocation
- explainshell.com — paste a command and it annotates each part with the relevant man page excerpt


The GNU Coreutils manual at gnu.org is genuinely one of the better pieces of free software documentation — it explains not just what each flag does but why certain design decisions were made and what the POSIX requirements are. Worth bookmarking and reading sections of rather than just using as a lookup reference.