GNU Coreutils

Short Table of Contents

Table of Contents

Next: Introduction, Up: (dir)   [Contents][Index]

GNU Coreutils

This manual documents version 8.32 of the GNU core utilities, including the standard programs for text and file manipulation.

Copyright © 1994-2020 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document

under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.



Caveats, overview, and authors

Common options


Common options

Output of entire files


cat tac nl od base32 base64 basenc

Formatting file contents


fmt pr fold

Output of parts of files


head tail split csplit

Summarizing files


wc sum cksum b2sum md5sum sha1sum sha2

Operating on sorted files


sort shuf uniq comm ptx tsort

Operating on fields


cut paste join

Operating on characters


tr expand unexpand

Directory listing


ls dir vdir dircolors

Basic operations


cp dd install mv rm shred

Special file types


mkdir rmdir unlink mkfifo mknod ln link readlink

Changing file attributes


chgrp chmod chown touch

Disk usage


df du stat sync truncate

Printing text


echo printf yes



false true test expr




File name manipulation


dirname basename pathchk mktemp realpath

Working context


pwd stty printenv tty

User information


id logname whoami groups users who

System context


date arch nproc uname hostname hostid uptime

SELinux context


chcon runcon

Modified command invocation


chroot env nice nohup stdbuf timeout

Process control






Numeric operations


factor numfmt seq

File permissions


Access modes

File timestamps


File timestamp issues

Date input formats


Specifying date strings

Version sort ordering


Details on version-sort algorithm

Opening the software toolbox


The software tools philosophy

GNU Free Documentation License


Copying and sharing this manual

Concept index


General index

Exit status


Indicating program success or failure

Backup options


Backup options

Block size


Block size

Floating point


Floating point number representation

Signal specifications


Specifying signals

Disambiguating names and IDs


chgrp, chown, chroot, id: user and group syntax

Random sources


Sources of random data

Target directory


Target directory

Trailing slashes


Trailing slashes

Traversing symlinks


Traversing symlinks to directories

Treating / specially


Treating / specially

Standards conformance


Standards conformance

Multi-call invocation


Multi-call program invocation

cat invocation


Concatenate and write files

tac invocation


Concatenate and write files in reverse

nl invocation


Number lines and write files

od invocation


Write files in octal or other formats

base32 invocation


Transform data into printable data

base64 invocation


Transform data into printable data

basenc invocation


Transform data into printable data

fmt invocation


Reformat paragraph text

pr invocation


Paginate or columnate files for printing

fold invocation


Wrap input lines to fit in specified width

head invocation


Output the first part of files

tail invocation


Output the last part of files

split invocation


Split a file into fixed-size pieces

csplit invocation


Split a file into context-determined pieces

wc invocation


Print newline, word, and byte counts

sum invocation


Print checksum and block counts

cksum invocation


Print CRC checksum and byte counts

b2sum invocation


Print or check BLAKE2 digests

md5sum invocation


Print or check MD5 digests

sha1sum invocation


Print or check SHA-1 digests

sha2 utilities


Print or check SHA-2 digests

sort invocation


Sort text files

shuf invocation


Shuffle text files

uniq invocation


Uniquify files

comm invocation


Compare two sorted files line by line

ptx invocation


Produce a permuted index of file contents

tsort invocation


Topological sort

General options in ptx


Options which affect general program behavior

Charset selection in ptx


Underlying character set considerations

Input processing in ptx


Input fields, contexts, and keyword selection

Output formatting in ptx


Types of output format, and sizing the fields

Compatibility in ptx


The GNU extensions to ptx

cut invocation


Print selected parts of lines

paste invocation


Merge lines of files

join invocation


Join lines on a common field

tr invocation


Translate, squeeze, and/or delete characters

expand invocation


Convert tabs to spaces

unexpand invocation


Convert spaces to tabs

Character sets


Specifying sets of characters



Changing one set of characters to another

Squeezing and deleting


Removing characters

ls invocation


List directory contents

dir invocation


Briefly list directory contents

vdir invocation


Verbosely list directory contents

dircolors invocation


Color setup for ls

Which files are listed


Which files are listed

What information is listed


What information is listed

Sorting the output


Sorting the output

General output formatting


General output formatting

Formatting the file names


Formatting the file names

cp invocation


Copy files and directories

dd invocation


Convert and copy a file

install invocation


Copy files and set attributes

mv invocation


Move (rename) files

rm invocation


Remove files or directories

shred invocation


Remove files more securely

link invocation


Make a hard link via the link syscall

ln invocation


Make links between files

mkdir invocation


Make directories

mkfifo invocation


Make FIFOs (named pipes)

mknod invocation


Make block or character special files

readlink invocation


Print value of a symlink or canonical file name

rmdir invocation


Remove empty directories

unlink invocation


Remove files via unlink syscall

chown invocation


Change file owner and group

chgrp invocation


Change group ownership

chmod invocation


Change access permissions

touch invocation


Change file timestamps

df invocation


Report file system disk space usage

du invocation


Estimate file space usage

stat invocation


Report file or file system status

sync invocation


Synchronize cached writes to persistent storage

truncate invocation


Shrink or extend the size of a file

echo invocation


Print a line of text

printf invocation


Format and print data

yes invocation


Print a string until interrupted

false invocation


Do nothing, unsuccessfully

true invocation


Do nothing, successfully

test invocation


Check file types and compare values

expr invocation


Evaluate expressions

File type tests


File type tests

Access permission tests


Access permission tests

File characteristic tests


File characteristic tests

String tests


String tests

Numeric tests


Numeric tests

String expressions


+ : match substr index length

Numeric expressions


+ - * / %

Relations for expr


| & < <= = == != >= >

Examples of expr


Examples of using expr

tee invocation


Redirect output to multiple files or processes

basename invocation


Strip directory and suffix from a file name

dirname invocation


Strip last file name component

pathchk invocation


Check file name validity and portability

mktemp invocation


Create temporary file or directory

realpath invocation


Print resolved file names

pwd invocation


Print working directory

stty invocation


Print or change terminal characteristics

printenv invocation


Print all or some environment variables

tty invocation


Print file name of terminal on standard input



Control settings



Input settings



Output settings



Local settings



Combination settings



Special characters



Special settings

id invocation


Print user identity

logname invocation


Print current login name

whoami invocation


Print effective user ID

groups invocation


Print group names a user is in

users invocation


Print login names of users currently logged in

who invocation


Print who is currently logged in

arch invocation


Print machine hardware name

date invocation


Print or set system date and time

nproc invocation


Print the number of processors

uname invocation


Print system information

hostname invocation


Print or set system name

hostid invocation


Print numeric host identifier

uptime invocation


Print system uptime and load

Time conversion specifiers



Date conversion specifiers



Literal conversion specifiers



Padding and other flags


Pad with zeros, spaces, etc.

Setting the time


Changing the system clock

Options for date


Instead of the current time

Date input formats


Specifying date strings

Examples of date



chcon invocation


Change SELinux context of file

runcon invocation


Run a command in specified SELinux context

chroot invocation


Run a command with a different root directory

env invocation


Run a command in a modified environment

nice invocation


Run a command with modified niceness

nohup invocation


Run a command immune to hangups

stdbuf invocation


Run a command with modified I/O buffering

timeout invocation


Run a command with a time limit

kill invocation


Sending a signal to processes.

sleep invocation


Delay for a specified time

factor invocation


Print prime factors

numfmt invocation


Reformat numbers

seq invocation


Print numeric sequences

File timestamps


File timestamp issues

Mode Structure


Structure of file mode bits

Symbolic Modes


Mnemonic representation of file mode bits

Numeric Modes


File mode bits as octal numbers

Directory Setuid and Setgid


Set-user-ID and set-group-ID on directories

General date syntax


Common rules

Calendar date items


19 Dec 1994

Time of day items



Time zone items



Combined date and time of day items



Day of week items


Monday and others

Relative items in date strings


next tuesday, 2 years ago

Pure numbers in date strings


19931219, 1440

Seconds since the Epoch



Specifying time zone rules


TZ="America/New_York", TZ="UTC0"

Authors of parse_datetime


Bellovin, Eggert, Salz, Berets, et al.

Version sort overview


Implementation Details


Differences from the official Debian Algorithm


Advanced Topics


Toolbox introduction


Toolbox introduction

I/O redirection


I/O redirection

The who command


The who command

The cut command


The cut command

The sort command


The sort command

The uniq command


The uniq command

Putting the tools together


Putting the tools together

GNU Free Documentation License


Copying and sharing this manual

Next: Introduction, Up: (dir)   [Contents][Index]