1 1 GNU Coreutils 1 ************* 1 1 This manual documents version 8.30 of the GNU core utilities, including 1 the standard programs for text and file manipulation. 1 1 Copyright © 1994-2018 Free Software Foundation, Inc. 1 1 Permission is granted to copy, distribute and/or modify this 1 document under the terms of the GNU Free Documentation License, 1 Version 1.3 or any later version published by the Free Software 1 Foundation; with no Invariant Sections, with no Front-Cover Texts, 1 and with no Back-Cover Texts. A copy of the license is included in 1 the section entitled “GNU Free Documentation License”. 1
1 · Introduction Caveats, overview, and authors · Common options Common options · Output of entire files cat tac nl od base32 base64 · 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 · Opening the software toolbox The software tools philosophy · GNU Free Documentation License Copying and sharing this manual · Concept index General index 1 1 — The Detailed Node Listing — 1 1 Common Options 1 · 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 1 1 Output of entire files 1 · 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 1 1 Formatting file contents 1 · fmt invocation Reformat paragraph text · pr invocation Paginate or columnate files for printing · fold invocation Wrap input lines to fit in specified width 1 1 Output of parts of files 1 · 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 1 1 Summarizing files 1 · 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 1 1 Operating on sorted files 1 · 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 1 1 ‘ptx’: Produce permuted indexes 1 · 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’ 1 1 Operating on fields 1 · cut invocation Print selected parts of lines · paste invocation Merge lines of files · join invocation Join lines on a common field 1 1 Operating on characters 1 · tr invocation Translate, squeeze, and/or delete characters · expand invocation Convert tabs to spaces · unexpand invocation Convert spaces to tabs 1 1 ‘tr’: Translate, squeeze, and/or delete characters 1 · Character sets Specifying sets of characters · Translating Changing one set of characters to another · Squeezing and deleting Removing characters 1 1 Directory listing 1 · ls invocation List directory contents · dir invocation Briefly list directory contents · vdir invocation Verbosely list directory contents · dircolors invocation Color setup for ‘ls’ 1 1 ‘ls’: List directory contents 1 · Which files are listed Which files are listed · What information is listed What information is listed · Sorting the output Sorting the output · Details about version sort More details about version sort · General output formatting General output formatting · Formatting the file names Formatting the file names 1 1 Basic operations 1 · 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 1 1 Special file types 1 · 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 1 1 Changing file attributes 1 · chown invocation Change file owner and group · chgrp invocation Change group ownership · chmod invocation Change access permissions · touch invocation Change file timestamps 1 1 Disk usage 1 · 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 1 1 Printing text 1 · echo invocation Print a line of text · printf invocation Format and print data · yes invocation Print a string until interrupted 1 1 Conditions 1 · false invocation Do nothing, unsuccessfully · true invocation Do nothing, successfully · test invocation Check file types and compare values · expr invocation Evaluate expressions 1 1 ‘test’: Check file types and compare values 1 · 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 1 1 ‘expr’: Evaluate expression 1 · String expressions + : match substr index length · Numeric expressions + - * / % · Relations for expr | & < <= = == != >= > · Examples of expr Examples of using ‘expr’ 1 1 Redirection 1 · tee invocation Redirect output to multiple files or processes 1 1 File name manipulation 1 · 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 1 1 Working context 1 · 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 1 1 ‘stty’: Print or change terminal characteristics 1 · Control Control settings · Input Input settings · Output Output settings · Local Local settings · Combination Combination settings · Characters Special characters · Special Special settings 1 1 User information 1 · 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 1 1 System context 1 · 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 1 1 ‘date’: Print or set system date and time 1 · 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 1 1 SELinux context 1 · chcon invocation Change SELinux context of file · runcon invocation Run a command in specified SELinux context 1 1 Modified command invocation 1 · 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 1 1 Process control 1 · kill invocation Sending a signal to processes. 1 1 Delaying 1 · sleep invocation Delay for a specified time 1 1 Numeric operations 1 · factor invocation Print prime factors · numfmt invocation Reformat numbers · seq invocation Print numeric sequences 1 1 1 File timestamps 1 · File timestamps File timestamp issues 1 1 File permissions 1 · 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 1 1 Date input formats 1 · 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. 1 1 Opening the software toolbox 1 · 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 1 1 Copying This Manual 1 · GNU Free Documentation License Copying and sharing this manual 1 1