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 contentscp— copy files and directoriesmv— move or renamerm— remove files or directoriesmkdir/rmdir— create and remove directoriesln— create hard and symbolic linkstouch— change file timestamps or create empty filesinstall— copy files and set attributes (used heavily in Makefiles)shred— overwrite a file to hide its contentstruncate— shrink or extend the size of a file
File information¶
ls— with-l,-a,-h,-Retc.stat— display file or filesystem status (inode, permissions, timestamps, size)file— determine file type (actually not coreutils — this is a separatefilepackage)du— disk usage of files and directoriesdf— report filesystem disk space usagedircolors— color setup forlsreadlink— print resolved symbolic linksrealpath— print the resolved absolute pathpathchk— check whether file names are valid or portablebasename/dirname— strip directory or suffix from filenames
Text operations¶
cat— concatenate and print filestac— reverse of cat, last line firsthead/tail— output first or last part of filessort— sort lines of textuniq— report or filter out repeated linescut— remove sections from each linepaste— merge lines of filesjoin— join lines of two files on a common fieldcomm— compare two sorted files line by linediff— not coreutils (GNU diffutils is a separate package)tr— translate or delete characterswc— print line, word, and byte countsgrep— not coreutils (GNU grep is a separate package)fold— wrap each input line to fit a specified widthfmt— simple optimal text formatternl— number lines of filespr— convert text files for printingod— dump files in octal and other formatsbase64— encode/decode base64base32— encode/decode base32expand/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 failureyes— output a string repeatedly until killedsleep— delay for a specified timeenv— run a program in a modified environmentnohup— run a command immune to hangupsxargs— not coreutils (part of GNU findutils)tee— read from stdin and write to stdout and files simultaneouslyexpr— 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 unitsuptime— how long the system has been runninguname— print system information (also in util-linux)who/w/whoami— show who is logged onid— print real and effective user and group IDsgroups— print group membershipslogname— print the user's login nameusers— print the usernames of users currently logged inpinky— lightweight finger
Permissions and ownership¶
chmod— change file mode bitschown— change file owner and groupchgrp— change group ownershipumask— set file creation mask
Numeric and checksum¶
factor— print prime factorsnumfmt— reformat numbers (human-readable conversions)seq— print a sequence of numbersshuf— generate random permutationsmd5sum/sha1sum/sha256sum/sha512sum/b2sum— compute and check message digestscksum— checksum and count the bytes in a filesum— checksum and count the blocks in a file
Archiving and linking¶
link/unlink— call the link/unlink system calls directlysync— flush filesystem buffers
Terminal¶
stty— change and print terminal line settingstty— print the file name of the terminal connected to stdinclear— 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.