Coreutils#
GNU Coreutils is the package that ships the basic file, text,
and shell utilities every Linux box assumes are present. ls,
cp, mv, rm, cat, cut, sort, head,
tail, wc, id, uname, date, true, false,
and roughly a hundred of their siblings all live here. They are
the smallest pieces the operator combines into pipelines, scripts,
and one-liners.
Knowing which tool belongs to coreutils matters when the operator
is on a stripped-down host. A bare-metal install or a hardened
container often ships only what coreutils provides; anything richer
(rg, jq, fd) has to be brought in. The reverse case is
BusyBox on Alpine and most embedded boxes, where the same
command names exist but with a smaller flag set, so coreutils-only
options like ls --color=auto quietly do nothing.
The sections below walk the historical anatomy (fileutils, textutils, sh-utils), the tools in priority order, the constraints that bite when GNU extensions are not available, the on-disk layout, and the muscle-memory tasks the operator runs against coreutils on contact.
The three legacy packages merged in 2002. Today they are one binary set, but the category split is still how the manual is organized and how most operators carry the catalog in their head.
Category |
What it does |
Sample |
|---|---|---|
fileutils |
Manipulate files and directories on disk. |
|
textutils |
Read and reshape byte streams. |
|
sh-utils |
Shell glue, identity, environment, time. |
|
Fileutils#
Fileutils is the half of coreutils that touches the filesystem.
The operator reaches for it whenever the question is where does
this byte live and who can read it. Every utility here is
$PATH-resolved at /usr/bin, accepts -- to end flags, and
honors LC_COLLATE for any output it sorts.
Command |
Effect |
|---|---|
|
List directory contents |
|
Recursive copy that preserves mode, ownership, and timestamps |
|
Rename or move |
|
Recursive remove without prompts |
|
Create the full path, no error if it exists |
|
Make a symbolic link |
|
Mode, owner, group changes |
|
Block-level copy with explicit block size |
|
Free space on mounts, size of a tree |
|
Inode metadata, full |
Recursive copy with attributes preserved. cp -a is the
form the operator uses when the destination must look identical to
the source, useful for staging payloads or moving artifacts off a
target.
$ cp -a /etc/nginx /tmp/nginx.bak
(no output; success is silent)
Find the heaviest directories under the current tree. Sorted output, human-readable sizes, descending order.
$ du -sh */ 2>/dev/null | sort -rh | head
1.2G var/
430M home/
120M opt/
Textutils#
Textutils is the byte-stream half. Operators chain these tools into pipelines to slice logs, lift fields, count occurrences, and re-shape captured data without writing a script. Every tool in this category reads stdin when no file is given, which is what makes it composable.
Command |
Effect |
|---|---|
|
Concatenate to stdout |
|
|
|
First / last |
|
Follow appended writes, survive rotation |
|
Pick fields 1 and 3 from a CSV |
|
Line-by-line tabular merge |
|
Sort lexically, dedupe, sort by field |
|
Collapse adjacent duplicates with counts |
|
Translate or delete characters |
|
Count lines / bytes |
|
Number lines |
Top talkers from an access log. The standard frequency pipeline, useful when the operator inherits a noisy log and wants the loudest sources first.
$ cut -d' ' -f1 access.log | sort | uniq -c | sort -rn | head
4821 10.0.0.4
903 192.168.1.7
412 203.0.113.55
Tail a rotating log without losing the handle. -F reopens
the file when logrotate moves it.
$ tail -F /var/log/auth.log
Sh-utils#
Sh-utils covers the smallest moving parts: identity, environment,
clock, and the booleans every shell relies on. Most are one-shot
commands the operator drops into a pipeline or script. [ and
test are the same binary; true and false exist for
their exit codes alone.
Command |
Effect |
|---|---|
|
Write to stdout (prefer |
|
List or run with a modified environment |
|
Current UID, GID, group membership |
|
Kernel name, release, machine |
|
Now, in UTC, ISO-8601 |
|
Block for 5 seconds |
|
Infinite stream of |
|
File and string test predicates |
|
Run a command immune to |
|
Kill |
|
Run at adjusted CPU / I/O priority |
Constraints#
GNU long options (
--color=auto,--time=ctime,--block-size=1M) are GNU coreutils extensions. BSD coreutils (macOS) and BusyBox accept a smaller set; portable scripts stick to short flags and POSIX-defined behavior.ls --color=autoproduces ANSI escape sequences when stdout is a TTY. Pipelines and command substitutions disable the color on their own; redirecting to a file withls --color=alwaysdoes not.rmdoes not prompt by default;rm -rf /will run as far as the kernel lets it. GNUrmrefuses/itself only when--preserve-rootis set (the default since 8.0).cpandmvfollow symlinks at the source by default. Usecp -P/mv -P(orcp -a) when the operator needs the link preserved.ddis single-threaded, has no progress output withoutstatus=progress(GNU only), and silently truncates withof=if the operator forgetsconv=notrunc.sortuses$LC_ALLand$LC_COLLATEto pick the collation order.LC_ALL=C sortis the byte-wise sort most pipelines actually want.
Files#
Installed location#
Path |
Purpose |
|---|---|
|
The coreutils binaries on Debian, Ubuntu, Kali, RHEL, Arch. |
|
Symlink to |
|
One man page per utility ( |
|
The combined GNU info manual covering every utility. |
|
Package README, changelog, NEWS. |
Variables#
Locale#
Variable |
Purpose |
|---|---|
|
Overrides every other |
|
Collation order used by |
|
Decimal separator; |
Behavior#
Variable |
Purpose |
|---|---|
|
Force POSIX-conformant behavior, disabling GNU extensions. Useful when validating portable scripts. |
|
Default unit for |
|
Format |
|
Terminal width |
Common Tasks#
Identify which coreutils version is on the box.
$ ls --version | head -1
ls (GNU coreutils) 9.4
Tell coreutils apart from BusyBox.
$ readlink -f "$(command -v ls)"
/usr/bin/ls # GNU coreutils
/bin/busybox # BusyBox (Alpine, embedded)
List every coreutils binary on this host.
$ dpkg -L coreutils | grep '^/usr/bin/' # Debian/Ubuntu/Kali
$ rpm -ql coreutils | grep '^/usr/bin/' # RHEL/Fedora
$ pacman -Ql coreutils | awk '$2 ~ "/usr/bin/"' # Arch
Sort byte-wise, predictably, in any locale.
$ LC_ALL=C sort data.txt | uniq -c | sort -rn
Use the standalone GNU info manual for the full reference.
$ info coreutils
Run a command stripped of the operator’s environment.
$ env -i PATH=/usr/bin:/bin HOME="$HOME" bash
Time-bound a long-running command and capture both streams.
$ timeout 30s curl -fsSL https://target | tee body.html
References#
man 1 coreutils,man 7 coreutils-info(package overview).man 1 ls,man 1 cp,man 1 mv,man 1 rm,man 1 cat,man 1 cut,man 1 sort,man 1 uniq,man 1 head,man 1 tail,man 1 wc(the daily-driver utilities).info coreutils(the full GNU manual; richer than the man pages).The Terminal for the shell that drives these tools.
Standard I/O for the standard streams every coreutils binary reads or writes.
Filesystem for the on-disk surface fileutils operates on.
Linux for the command quick-reference.
BusyBox (the slimmer alternative the operator meets on Alpine and embedded targets).