(coreutils.info)Top
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”.
- Introduction
- 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
- Conditions
- false true test expr
- Redirection
- tee
- 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
- kill
- Delaying
- sleep
- 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
— The Detailed Node Listing —
Common Options
- 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
Output of entire files
- 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
Formatting file contents
- fmt invocation
- Reformat paragraph text
- pr invocation
- Paginate or columnate files for printing
- fold invocation
- Wrap input lines to fit in specified width
Output of parts of files
- 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
Summarizing files
- 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
Operating on sorted files
- 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
‘ptx’: Produce permuted indexes
- 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’
Operating on fields
- cut invocation
- Print selected parts of lines
- paste invocation
- Merge lines of files
- join invocation
- Join lines on a common field
Operating on characters
- tr invocation
- Translate, squeeze, and/or delete characters
- expand invocation
- Convert tabs to spaces
- unexpand invocation
- Convert spaces to tabs
‘tr’: Translate, squeeze, and/or delete characters
- Character sets
- Specifying sets of characters
- Translating
- Changing one set of characters to another
- Squeezing and deleting
- Removing characters
Directory listing
- ls invocation
- List directory contents
- dir invocation
- Briefly list directory contents
- vdir invocation
- Verbosely list directory contents
- dircolors invocation
- Color setup for ‘ls’
‘ls’: List directory contents
- 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
Basic operations
- 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
Special file types
- 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
Changing file attributes
- chown invocation
- Change file owner and group
- chgrp invocation
- Change group ownership
- chmod invocation
- Change access permissions
- touch invocation
- Change file timestamps
Disk usage
- 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
Printing text
- echo invocation
- Print a line of text
- printf invocation
- Format and print data
- yes invocation
- Print a string until interrupted
Conditions
- false invocation
- Do nothing, unsuccessfully
- true invocation
- Do nothing, successfully
- test invocation
- Check file types and compare values
- expr invocation
- Evaluate expressions
‘test’: Check file types and compare values
- 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
‘expr’: Evaluate expression
- String expressions
- + : match substr index length
- Numeric expressions
- + - * / %
- Relations for expr
- | & < <= = == != >= >
- Examples of expr
- Examples of using ‘expr’
Redirection
- tee invocation
- Redirect output to multiple files or processes
File name manipulation
- 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
Working context
- 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
‘stty’: Print or change terminal characteristics
- Control
- Control settings
- Input
- Input settings
- Output
- Output settings
- Local
- Local settings
- Combination
- Combination settings
- Characters
- Special characters
- Special
- Special settings
User information
- 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
System context
- 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
‘date’: Print or set system date and time
- Time conversion specifiers
- %[HIklMNpPrRsSTXzZ]
- Date conversion specifiers
- %[aAbBcCdDeFgGhjmuUVwWxyY]
- Literal conversion specifiers
- %[%nt]
- 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
- Examples
SELinux context
- chcon invocation
- Change SELinux context of file
- runcon invocation
- Run a command in specified SELinux context
Modified command invocation
- 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
Process control
- kill invocation
- Sending a signal to processes.
Delaying
- sleep invocation
- Delay for a specified time
Numeric operations
- factor invocation
- Print prime factors
- numfmt invocation
- Reformat numbers
- seq invocation
- Print numeric sequences
File timestamps
- File timestamps
- File timestamp issues
File permissions
- 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
Date input formats
- General date syntax
- Common rules
- Calendar date items
- 19 Dec 1994
- Time of day items
- 9:20pm
- Time zone items
- EST, PDT, UTC, ...
- Combined date and time of day items
- 1972-09-24T20:02:00,000000-0500
- 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
- @1078100502
- Specifying time zone rules
- TZ="America/New_York", TZ="UTC0"
- Authors of parse_datetime
- Bellovin, Eggert, Salz, Berets, et al.
Version sorting order
- Version sort overview
- Implementation Details
- Differences from the official Debian Algorithm
- Advanced Topics
Opening the software toolbox
- 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
Copying This Manual
- GNU Free Documentation License
- Copying and sharing this manual