1This is coreutils.info, produced by makeinfo version 6.6 from
2coreutils.texi.
3
4This manual documents version 8.32 of the GNU core utilities, including
5the standard programs for text and file manipulation.
6
7   Copyright © 1994-2020 Free Software Foundation, Inc.
8
9     Permission is granted to copy, distribute and/or modify this
10     document under the terms of the GNU Free Documentation License,
11     Version 1.3 or any later version published by the Free Software
12     Foundation; with no Invariant Sections, with no Front-Cover Texts,
13     and with no Back-Cover Texts.  A copy of the license is included in
14     the section entitled “GNU Free Documentation License”.
15INFO-DIR-SECTION Basics
16START-INFO-DIR-ENTRY
17* Coreutils: (coreutils).       Core GNU (file, text, shell) utilities.
18* Common options: (coreutils)Common options.
19* File permissions: (coreutils)File permissions.  Access modes.
20* Date input formats: (coreutils)Date input formats.
21END-INFO-DIR-ENTRY
22
23INFO-DIR-SECTION Individual utilities
24START-INFO-DIR-ENTRY
25* arch: (coreutils)arch invocation.             Print machine hardware name.
26* b2sum: (coreutils)b2sum invocation.           Print or check BLAKE2 digests.
27* base32: (coreutils)base32 invocation.         Base32 encode/decode data.
28* base64: (coreutils)base64 invocation.         Base64 encode/decode data.
29* basename: (coreutils)basename invocation.     Strip directory and suffix.
30* basenc: (coreutils)basenc invocation.         Encoding/decoding of data.
31* cat: (coreutils)cat invocation.               Concatenate and write files.
32* chcon: (coreutils)chcon invocation.           Change SELinux CTX of files.
33* chgrp: (coreutils)chgrp invocation.           Change file groups.
34* chmod: (coreutils)chmod invocation.           Change access permissions.
35* chown: (coreutils)chown invocation.           Change file owners and groups.
36* chroot: (coreutils)chroot invocation.         Specify the root directory.
37* cksum: (coreutils)cksum invocation.           Print POSIX CRC checksum.
38* comm: (coreutils)comm invocation.             Compare sorted files by line.
39* cp: (coreutils)cp invocation.                 Copy files.
40* csplit: (coreutils)csplit invocation.         Split by context.
41* cut: (coreutils)cut invocation.               Print selected parts of lines.
42* date: (coreutils)date invocation.             Print/set system date and time.
43* dd: (coreutils)dd invocation.                 Copy and convert a file.
44* df: (coreutils)df invocation.                 Report file system disk usage.
45* dir: (coreutils)dir invocation.               List directories briefly.
46* dircolors: (coreutils)dircolors invocation.   Color setup for ls.
47* dirname: (coreutils)dirname invocation.       Strip last file name component.
48* du: (coreutils)du invocation.                 Report on disk usage.
49* echo: (coreutils)echo invocation.             Print a line of text.
50* env: (coreutils)env invocation.               Modify the environment.
51* expand: (coreutils)expand invocation.         Convert tabs to spaces.
52* expr: (coreutils)expr invocation.             Evaluate expressions.
53* factor: (coreutils)factor invocation.         Print prime factors
54* false: (coreutils)false invocation.           Do nothing, unsuccessfully.
55* fmt: (coreutils)fmt invocation.               Reformat paragraph text.
56* fold: (coreutils)fold invocation.             Wrap long input lines.
57* groups: (coreutils)groups invocation.         Print group names a user is in.
58* head: (coreutils)head invocation.             Output the first part of files.
59* hostid: (coreutils)hostid invocation.         Print numeric host identifier.
60* hostname: (coreutils)hostname invocation.     Print or set system name.
61* id: (coreutils)id invocation.                 Print user identity.
62* install: (coreutils)install invocation.       Copy files and set attributes.
63* join: (coreutils)join invocation.             Join lines on a common field.
64* kill: (coreutils)kill invocation.             Send a signal to processes.
65* link: (coreutils)link invocation.             Make hard links between files.
66* ln: (coreutils)ln invocation.                 Make links between files.
67* logname: (coreutils)logname invocation.       Print current login name.
68* ls: (coreutils)ls invocation.                 List directory contents.
69* md5sum: (coreutils)md5sum invocation.         Print or check MD5 digests.
70* mkdir: (coreutils)mkdir invocation.           Create directories.
71* mkfifo: (coreutils)mkfifo invocation.         Create FIFOs (named pipes).
72* mknod: (coreutils)mknod invocation.           Create special files.
73* mktemp: (coreutils)mktemp invocation.         Create temporary files.
74* mv: (coreutils)mv invocation.                 Rename files.
75* nice: (coreutils)nice invocation.             Modify niceness.
76* nl: (coreutils)nl invocation.                 Number lines and write files.
77* nohup: (coreutils)nohup invocation.           Immunize to hangups.
78* nproc: (coreutils)nproc invocation.           Print the number of processors.
79* numfmt: (coreutils)numfmt invocation.         Reformat numbers.
80* od: (coreutils)od invocation.                 Dump files in octal, etc.
81* paste: (coreutils)paste invocation.           Merge lines of files.
82* pathchk: (coreutils)pathchk invocation.       Check file name portability.
83* pr: (coreutils)pr invocation.                 Paginate or columnate files.
84* printenv: (coreutils)printenv invocation.     Print environment variables.
85* printf: (coreutils)printf invocation.         Format and print data.
86* ptx: (coreutils)ptx invocation.               Produce permuted indexes.
87* pwd: (coreutils)pwd invocation.               Print working directory.
88* readlink: (coreutils)readlink invocation.     Print referent of a symlink.
89* realpath: (coreutils)realpath invocation.     Print resolved file names.
90* rm: (coreutils)rm invocation.                 Remove files.
91* rmdir: (coreutils)rmdir invocation.           Remove empty directories.
92* runcon: (coreutils)runcon invocation.         Run in specified SELinux CTX.
93* seq: (coreutils)seq invocation.               Print numeric sequences
94* sha1sum: (coreutils)sha1sum invocation.       Print or check SHA-1 digests.
95* sha2: (coreutils)sha2 utilities.              Print or check SHA-2 digests.
96* shred: (coreutils)shred invocation.           Remove files more securely.
97* shuf: (coreutils)shuf invocation.             Shuffling text files.
98* sleep: (coreutils)sleep invocation.           Delay for a specified time.
99* sort: (coreutils)sort invocation.             Sort text files.
100* split: (coreutils)split invocation.           Split into pieces.
101* stat: (coreutils)stat invocation.             Report file(system) status.
102* stdbuf: (coreutils)stdbuf invocation.         Modify stdio buffering.
103* stty: (coreutils)stty invocation.             Print/change terminal settings.
104* sum: (coreutils)sum invocation.               Print traditional checksum.
105* sync: (coreutils)sync invocation.             Synchronize memory to disk.
106* tac: (coreutils)tac invocation.               Reverse files.
107* tail: (coreutils)tail invocation.             Output the last part of files.
108* tee: (coreutils)tee invocation.               Redirect to multiple files.
109* test: (coreutils)test invocation.             File/string tests.
110* timeout: (coreutils)timeout invocation.       Run with time limit.
111* touch: (coreutils)touch invocation.           Change file timestamps.
112* tr: (coreutils)tr invocation.                 Translate characters.
113* true: (coreutils)true invocation.             Do nothing, successfully.
114* truncate: (coreutils)truncate invocation.     Shrink/extend size of a file.
115* tsort: (coreutils)tsort invocation.           Topological sort.
116* tty: (coreutils)tty invocation.               Print terminal name.
117* uname: (coreutils)uname invocation.           Print system information.
118* unexpand: (coreutils)unexpand invocation.     Convert spaces to tabs.
119* uniq: (coreutils)uniq invocation.             Uniquify files.
120* unlink: (coreutils)unlink invocation.         Removal via unlink(2).
121* uptime: (coreutils)uptime invocation.         Print uptime and load.
122* users: (coreutils)users invocation.           Print current user names.
123* vdir: (coreutils)vdir invocation.             List directories verbosely.
124* wc: (coreutils)wc invocation.                 Line, word, and byte counts.
125* who: (coreutils)who invocation.               Print who is logged in.
126* whoami: (coreutils)whoami invocation.         Print effective user ID.
127* yes: (coreutils)yes invocation.               Print a string indefinitely.
128END-INFO-DIR-ENTRY
129
130
131File: coreutils.info,  Node: Top,  Next: Introduction,  Up: (dir)
132
133GNU Coreutils
134*************
135
136This manual documents version 8.32 of the GNU core utilities, including
137the standard programs for text and file manipulation.
138
139   Copyright © 1994-2020 Free Software Foundation, Inc.
140
141     Permission is granted to copy, distribute and/or modify this
142     document under the terms of the GNU Free Documentation License,
143     Version 1.3 or any later version published by the Free Software
144     Foundation; with no Invariant Sections, with no Front-Cover Texts,
145     and with no Back-Cover Texts.  A copy of the license is included in
146     the section entitled “GNU Free Documentation License”.
147
148* Menu:
149
150* Introduction::                 Caveats, overview, and authors
151* Common options::               Common options
152* Output of entire files::       cat tac nl od base32 base64 basenc
153* Formatting file contents::     fmt pr fold
154* Output of parts of files::     head tail split csplit
155* Summarizing files::            wc sum cksum b2sum md5sum sha1sum sha2
156* Operating on sorted files::    sort shuf uniq comm ptx tsort
157* Operating on fields::          cut paste join
158* Operating on characters::      tr expand unexpand
159* Directory listing::            ls dir vdir dircolors
160* Basic operations::             cp dd install mv rm shred
161* Special file types::         mkdir rmdir unlink mkfifo mknod ln link readlink
162* Changing file attributes::     chgrp chmod chown touch
163* Disk usage::                   df du stat sync truncate
164* Printing text::                echo printf yes
165* Conditions::                   false true test expr
166* Redirection::                  tee
167* File name manipulation::       dirname basename pathchk mktemp realpath
168* Working context::              pwd stty printenv tty
169* User information::             id logname whoami groups users who
170* System context::               date arch nproc uname hostname hostid uptime
171* SELinux context::              chcon runcon
172* Modified command invocation::  chroot env nice nohup stdbuf timeout
173* Process control::              kill
174* Delaying::                     sleep
175* Numeric operations::           factor numfmt seq
176* File permissions::             Access modes
177* File timestamps::              File timestamp issues
178* Date input formats::           Specifying date strings
179* Version sort ordering::        Details on version-sort algorithm
180* Opening the software toolbox:: The software tools philosophy
181* GNU Free Documentation License:: Copying and sharing this manual
182* Concept index::                General index
183
184 — The Detailed Node Listing —
185
186Common Options
187
188* Exit status::                  Indicating program success or failure
189* Backup options::               Backup options
190* Block size::                   Block size
191* Floating point::               Floating point number representation
192* Signal specifications::        Specifying signals
193* Disambiguating names and IDs:: chgrp, chown, chroot, id: user and group syntax
194* Random sources::               Sources of random data
195* Target directory::             Target directory
196* Trailing slashes::             Trailing slashes
197* Traversing symlinks::          Traversing symlinks to directories
198* Treating / specially::         Treating / specially
199* Standards conformance::        Standards conformance
200* Multi-call invocation::        Multi-call program invocation
201
202Output of entire files
203
204* cat invocation::               Concatenate and write files
205* tac invocation::               Concatenate and write files in reverse
206* nl invocation::                Number lines and write files
207* od invocation::                Write files in octal or other formats
208* base32 invocation::            Transform data into printable data
209* base64 invocation::            Transform data into printable data
210* basenc invocation::            Transform data into printable data
211
212Formatting file contents
213
214* fmt invocation::               Reformat paragraph text
215* pr invocation::                Paginate or columnate files for printing
216* fold invocation::              Wrap input lines to fit in specified width
217
218Output of parts of files
219
220* head invocation::              Output the first part of files
221* tail invocation::              Output the last part of files
222* split invocation::             Split a file into fixed-size pieces
223* csplit invocation::            Split a file into context-determined pieces
224
225Summarizing files
226
227* wc invocation::                Print newline, word, and byte counts
228* sum invocation::               Print checksum and block counts
229* cksum invocation::             Print CRC checksum and byte counts
230* b2sum invocation::             Print or check BLAKE2 digests
231* md5sum invocation::            Print or check MD5 digests
232* sha1sum invocation::           Print or check SHA-1 digests
233* sha2 utilities::               Print or check SHA-2 digests
234
235Operating on sorted files
236
237* sort invocation::              Sort text files
238* shuf invocation::              Shuffle text files
239* uniq invocation::              Uniquify files
240* comm invocation::              Compare two sorted files line by line
241* ptx invocation::               Produce a permuted index of file contents
242* tsort invocation::             Topological sort
243
244‘ptx’: Produce permuted indexes
245
246* General options in ptx::       Options which affect general program behavior
247* Charset selection in ptx::     Underlying character set considerations
248* Input processing in ptx::      Input fields, contexts, and keyword selection
249* Output formatting in ptx::     Types of output format, and sizing the fields
250* Compatibility in ptx::         The GNU extensions to ‘ptx’
251
252Operating on fields
253
254* cut invocation::               Print selected parts of lines
255* paste invocation::             Merge lines of files
256* join invocation::              Join lines on a common field
257
258Operating on characters
259
260* tr invocation::                Translate, squeeze, and/or delete characters
261* expand invocation::            Convert tabs to spaces
262* unexpand invocation::          Convert spaces to tabs
263
264‘tr’: Translate, squeeze, and/or delete characters
265
266* Character sets::               Specifying sets of characters
267* Translating::                  Changing one set of characters to another
268* Squeezing and deleting::       Removing characters
269
270Directory listing
271
272* ls invocation::                List directory contents
273* dir invocation::               Briefly list directory contents
274* vdir invocation::              Verbosely list directory contents
275* dircolors invocation::         Color setup for ‘ls’
276
277‘ls’:  List directory contents
278
279* Which files are listed::       Which files are listed
280* What information is listed::   What information is listed
281* Sorting the output::           Sorting the output
282* General output formatting::    General output formatting
283* Formatting the file names::    Formatting the file names
284
285Basic operations
286
287* cp invocation::                Copy files and directories
288* dd invocation::                Convert and copy a file
289* install invocation::           Copy files and set attributes
290* mv invocation::                Move (rename) files
291* rm invocation::                Remove files or directories
292* shred invocation::             Remove files more securely
293
294Special file types
295
296* link invocation::              Make a hard link via the link syscall
297* ln invocation::                Make links between files
298* mkdir invocation::             Make directories
299* mkfifo invocation::            Make FIFOs (named pipes)
300* mknod invocation::             Make block or character special files
301* readlink invocation::          Print value of a symlink or canonical file name
302* rmdir invocation::             Remove empty directories
303* unlink invocation::            Remove files via unlink syscall
304
305Changing file attributes
306
307* chown invocation::             Change file owner and group
308* chgrp invocation::             Change group ownership
309* chmod invocation::             Change access permissions
310* touch invocation::             Change file timestamps
311
312Disk usage
313
314* df invocation::                Report file system disk space usage
315* du invocation::                Estimate file space usage
316* stat invocation::              Report file or file system status
317* sync invocation::              Synchronize cached writes to persistent storage
318* truncate invocation::          Shrink or extend the size of a file
319
320Printing text
321
322* echo invocation::              Print a line of text
323* printf invocation::            Format and print data
324* yes invocation::               Print a string until interrupted
325
326Conditions
327
328* false invocation::             Do nothing, unsuccessfully
329* true invocation::              Do nothing, successfully
330* test invocation::              Check file types and compare values
331* expr invocation::              Evaluate expressions
332
333‘test’: Check file types and compare values
334
335* File type tests::              File type tests
336* Access permission tests::      Access permission tests
337* File characteristic tests::    File characteristic tests
338* String tests::                 String tests
339* Numeric tests::                Numeric tests
340
341‘expr’: Evaluate expression
342
343* String expressions::           + : match substr index length
344* Numeric expressions::          + - * / %
345* Relations for expr::           | & < <= = == != >= >
346* Examples of expr::             Examples of using ‘expr’
347
348Redirection
349
350* tee invocation::               Redirect output to multiple files or processes
351
352File name manipulation
353
354* basename invocation::          Strip directory and suffix from a file name
355* dirname invocation::           Strip last file name component
356* pathchk invocation::           Check file name validity and portability
357* mktemp invocation::            Create temporary file or directory
358* realpath invocation::          Print resolved file names
359
360Working context
361
362* pwd invocation::               Print working directory
363* stty invocation::              Print or change terminal characteristics
364* printenv invocation::          Print all or some environment variables
365* tty invocation::               Print file name of terminal on standard input
366
367‘stty’: Print or change terminal characteristics
368
369* Control::                      Control settings
370* Input::                        Input settings
371* Output::                       Output settings
372* Local::                        Local settings
373* Combination::                  Combination settings
374* Characters::                   Special characters
375* Special::                      Special settings
376
377User information
378
379* id invocation::                Print user identity
380* logname invocation::           Print current login name
381* whoami invocation::            Print effective user ID
382* groups invocation::            Print group names a user is in
383* users invocation::             Print login names of users currently logged in
384* who invocation::               Print who is currently logged in
385
386System context
387
388* arch invocation::              Print machine hardware name
389* date invocation::              Print or set system date and time
390* nproc invocation::             Print the number of processors
391* uname invocation::             Print system information
392* hostname invocation::          Print or set system name
393* hostid invocation::            Print numeric host identifier
394* uptime invocation::            Print system uptime and load
395
396‘date’: Print or set system date and time
397
398* Time conversion specifiers::   %[HIklMNpPrRsSTXzZ]
399* Date conversion specifiers::   %[aAbBcCdDeFgGhjmuUVwWxyY]
400* Literal conversion specifiers:: %[%nt]
401* Padding and other flags::      Pad with zeros, spaces, etc.
402* Setting the time::             Changing the system clock
403* Options for date::             Instead of the current time
404* Date input formats::           Specifying date strings
405* Examples of date::             Examples
406
407SELinux context
408
409* chcon invocation::             Change SELinux context of file
410* runcon invocation::            Run a command in specified SELinux context
411
412Modified command invocation
413
414* chroot invocation::            Run a command with a different root directory
415* env invocation::               Run a command in a modified environment
416* nice invocation::              Run a command with modified niceness
417* nohup invocation::             Run a command immune to hangups
418* stdbuf invocation::            Run a command with modified I/O buffering
419* timeout invocation::           Run a command with a time limit
420
421Process control
422
423* kill invocation::              Sending a signal to processes.
424
425Delaying
426
427* sleep invocation::             Delay for a specified time
428
429Numeric operations
430
431* factor invocation::            Print prime factors
432* numfmt invocation::            Reformat numbers
433* seq invocation::               Print numeric sequences
434
435
436File timestamps
437
438* File timestamps::              File timestamp issues
439
440File permissions
441
442* Mode Structure::               Structure of file mode bits
443* Symbolic Modes::               Mnemonic representation of file mode bits
444* Numeric Modes::                File mode bits as octal numbers
445* Directory Setuid and Setgid::  Set-user-ID and set-group-ID on directories
446
447Date input formats
448
449* General date syntax::          Common rules
450* Calendar date items::          19 Dec 1994
451* Time of day items::            9:20pm
452* Time zone items::              EST, PDT, UTC, ...
453* Combined date and time of day items:: 1972-09-24T20:02:00,000000-0500
454* Day of week items::            Monday and others
455* Relative items in date strings:: next tuesday, 2 years ago
456* Pure numbers in date strings:: 19931219, 1440
457* Seconds since the Epoch::      @1078100502
458* Specifying time zone rules::   TZ="America/New_York", TZ="UTC0"
459* Authors of parse_datetime::    Bellovin, Eggert, Salz, Berets, et al.
460
461Version sorting order
462
463* Version sort overview::
464* Implementation Details::
465* Differences from the official Debian Algorithm::
466* Advanced Topics::
467
468Opening the software toolbox
469
470* Toolbox introduction::         Toolbox introduction
471* I/O redirection::              I/O redirection
472* The who command::              The ‘who’ command
473* The cut command::              The ‘cut’ command
474* The sort command::             The ‘sort’ command
475* The uniq command::             The ‘uniq’ command
476* Putting the tools together::   Putting the tools together
477
478Copying This Manual
479
480* GNU Free Documentation License::     Copying and sharing this manual
481
482
483
484File: coreutils.info,  Node: Introduction,  Next: Common options,  Prev: Top,  Up: Top
485
4861 Introduction
487**************
488
489This manual is a work in progress: many sections make no attempt to
490explain basic concepts in a way suitable for novices.  Thus, if you are
491interested, please get involved in improving this manual.  The entire
492GNU community will benefit.
493
494   The GNU utilities documented here are mostly compatible with the
495POSIX standard.
496
497   Please report bugs to <bug-coreutils@gnu.org>.  Include the version
498number, machine architecture, input files, and any other information
499needed to reproduce the bug: your input, what you expected, what you
500got, and why it is wrong.
501
502   If you have a problem with ‘sort’ or ‘date’, try using the ‘--debug’
503option, as it can can often help find and fix problems without having to
504wait for an answer to a bug report.  If the debug output does not
505suffice to fix the problem on your own, please compress and attach it to
506the rest of your bug report.
507
508   Although diffs are welcome, please include a description of the
509problem as well, since this is sometimes difficult to infer.  *Note
510(gcc)Bugs::.
511
512   This manual was originally derived from the Unix man pages in the
513distributions, which were written by David MacKenzie and updated by Jim
514Meyering.  What you are reading now is the authoritative documentation
515for these utilities; the man pages are no longer being maintained.  The
516original ‘fmt’ man page was written by Ross Paterson.  François Pinard
517did the initial conversion to Texinfo format.  Karl Berry did the
518indexing, some reorganization, and editing of the results.  Brian
519Youmans of the Free Software Foundation office staff combined the
520manuals for textutils, fileutils, and sh-utils to produce the present
521omnibus manual.  Richard Stallman contributed his usual invaluable
522insights to the overall process.
523
524
525File: coreutils.info,  Node: Common options,  Next: Output of entire files,  Prev: Introduction,  Up: Top
526
5272 Common options
528****************
529
530Certain options are available in all of these programs.  Rather than
531writing identical descriptions for each of the programs, they are
532described here.  (In fact, every GNU program accepts (or should accept)
533these options.)
534
535   Normally options and operands can appear in any order, and programs
536act as if all the options appear before any operands.  For example,
537‘sort -r passwd -t :’ acts like ‘sort -r -t : passwd’, since ‘:’ is an
538option-argument of ‘-t’.  However, if the ‘POSIXLY_CORRECT’ environment
539variable is set, options must appear before operands, unless otherwise
540specified for a particular command.
541
542   A few programs can usefully have trailing operands with leading ‘-’.
543With such a program, options must precede operands even if
544‘POSIXLY_CORRECT’ is not set, and this fact is noted in the program
545description.  For example, the ‘env’ command’s options must appear
546before its operands, since in some cases the operands specify a command
547that itself contains options.
548
549   Most programs that accept long options recognize unambiguous
550abbreviations of those options.  For example, ‘rmdir
551--ignore-fail-on-non-empty’ can be invoked as ‘rmdir --ignore-fail’ or
552even ‘rmdir --i’.  Ambiguous options, such as ‘ls --h’, are identified
553as such.
554
555   Some of these programs recognize the ‘--help’ and ‘--version’ options
556only when one of them is the sole command line argument.  For these
557programs, abbreviations of the long options are not always recognized.
558
559‘--help’
560     Print a usage message listing all available options, then exit
561     successfully.
562
563‘--version’
564     Print the version number, then exit successfully.
565
566‘--’
567     Delimit the option list.  Later arguments, if any, are treated as
568     operands even if they begin with ‘-’.  For example, ‘sort -- -r’
569     reads from the file named ‘-r’.
570
571   A single ‘-’ operand is not really an option, though it looks like
572one.  It stands for a file operand, and some tools treat it as standard
573input, or as standard output if that is clear from the context.  For
574example, ‘sort -’ reads from standard input, and is equivalent to plain
575‘sort’.  Unless otherwise specified, a ‘-’ can appear as any operand
576that requires a file name.
577
578* Menu:
579
580* Exit status::                 Indicating program success or failure.
581* Backup options::              -b -S, in some programs.
582* Block size::                  BLOCK_SIZE and –block-size, in some programs.
583* Floating point::              Floating point number representation.
584* Signal specifications::       Specifying signals using the –signal option.
585* Disambiguating names and IDs:: chgrp, chown, chroot, id: user and group syntax
586* Random sources::              –random-source, in some programs.
587* Target directory::            Specifying a target directory, in some programs.
588* Trailing slashes::            –strip-trailing-slashes, in some programs.
589* Traversing symlinks::         -H, -L, or -P, in some programs.
590* Treating / specially::        –preserve-root and –no-preserve-root.
591* Special built-in utilities::  ‘break’, ‘:’, ...
592* Standards conformance::       Conformance to the POSIX standard.
593* Multi-call invocation::       Multi-call program invocation.
594
595
596File: coreutils.info,  Node: Exit status,  Next: Backup options,  Up: Common options
597
5982.1 Exit status
599===============
600
601Nearly every command invocation yields an integral “exit status” that
602can be used to change how other commands work.  For the vast majority of
603commands, an exit status of zero indicates success.  Failure is
604indicated by a nonzero value—typically ‘1’, though it may differ on
605unusual platforms as POSIX requires only that it be nonzero.
606
607   However, some of the programs documented here do produce other exit
608status values and a few associate different meanings with the values ‘0’
609and ‘1’.  Here are some of the exceptions: ‘chroot’, ‘env’, ‘expr’,
610‘nice’, ‘nohup’, ‘numfmt’, ‘printenv’, ‘sort’, ‘stdbuf’, ‘test’,
611‘timeout’, ‘tty’.
612
613
614File: coreutils.info,  Node: Backup options,  Next: Block size,  Prev: Exit status,  Up: Common options
615
6162.2 Backup options
617==================
618
619Some GNU programs (at least ‘cp’, ‘install’, ‘ln’, and ‘mv’) optionally
620make backups of files before writing new versions.  These options
621control the details of these backups.  The options are also briefly
622mentioned in the descriptions of the particular programs.
623
624‘-b’
625‘--backup[=METHOD]’
626     Make a backup of each file that would otherwise be overwritten or
627     removed.  Without this option, the original versions are destroyed.
628     Use METHOD to determine the type of backups to make.  When this
629     option is used but METHOD is not specified, then the value of the
630     ‘VERSION_CONTROL’ environment variable is used.  And if
631     ‘VERSION_CONTROL’ is not set, the default backup type is
632     ‘existing’.
633
634     Note that the short form of this option, ‘-b’ does not accept any
635     argument.  Using ‘-b’ is equivalent to using ‘--backup=existing’.
636
637     This option corresponds to the Emacs variable ‘version-control’;
638     the values for METHOD are the same as those used in Emacs.  This
639     option also accepts more descriptive names.  The valid METHODs are
640     (unique abbreviations are accepted):
641
642     ‘none’
643     ‘off’
644          Never make backups.
645
646     ‘numbered’
647     ‘t’
648          Always make numbered backups.
649
650     ‘existing’
651     ‘nil’
652          Make numbered backups of files that already have them, simple
653          backups of the others.
654
655     ‘simple’
656     ‘never’
657          Always make simple backups.  Please note ‘never’ is not to be
658          confused with ‘none’.
659
660‘-S SUFFIX’
661‘--suffix=SUFFIX’
662     Append SUFFIX to each backup file made with ‘-b’.  If this option
663     is not specified, the value of the ‘SIMPLE_BACKUP_SUFFIX’
664     environment variable is used.  And if ‘SIMPLE_BACKUP_SUFFIX’ is not
665     set, the default is ‘~’, just as in Emacs.
666
667
668File: coreutils.info,  Node: Block size,  Next: Floating point,  Prev: Backup options,  Up: Common options
669
6702.3 Block size
671==============
672
673Some GNU programs (at least ‘df’, ‘du’, and ‘ls’) display sizes in
674“blocks”.  You can adjust the block size and method of display to make
675sizes easier to read.  The block size used for display is independent of
676any file system block size.  Fractional block counts are rounded up to
677the nearest integer.
678
679   The default block size is chosen by examining the following
680environment variables in turn; the first one that is set determines the
681block size.
682
683‘DF_BLOCK_SIZE’
684     This specifies the default block size for the ‘df’ command.
685     Similarly, ‘DU_BLOCK_SIZE’ specifies the default for ‘du’ and
686     ‘LS_BLOCK_SIZE’ for ‘ls’.
687
688‘BLOCK_SIZE’
689     This specifies the default block size for all three commands, if
690     the above command-specific environment variables are not set.
691
692‘BLOCKSIZE’
693     This specifies the default block size for all values that are
694     normally printed as blocks, if neither ‘BLOCK_SIZE’ nor the above
695     command-specific environment variables are set.  Unlike the other
696     environment variables, ‘BLOCKSIZE’ does not affect values that are
697     normally printed as byte counts, e.g., the file sizes contained in
698     ‘ls -l’ output.
699
700‘POSIXLY_CORRECT’
701     If neither ‘COMMAND_BLOCK_SIZE’, nor ‘BLOCK_SIZE’, nor ‘BLOCKSIZE’
702     is set, but this variable is set, the block size defaults to 512.
703
704   If none of the above environment variables are set, the block size
705currently defaults to 1024 bytes in most contexts, but this number may
706change in the future.  For ‘ls’ file sizes, the block size defaults to 1
707byte.
708
709   A block size specification can be a positive integer specifying the
710number of bytes per block, or it can be ‘human-readable’ or ‘si’ to
711select a human-readable format.  Integers may be followed by suffixes
712that are upward compatible with the SI prefixes
713(http://www.bipm.org/en/publications/si-brochure/chapter3.html) for
714decimal multiples and with the ISO/IEC 80000-13 (formerly IEC 60027-2)
715prefixes (https://physics.nist.gov/cuu/Units/binary.html) for binary
716multiples.
717
718   With human-readable formats, output sizes are followed by a size
719letter such as ‘M’ for megabytes.  ‘BLOCK_SIZE=human-readable’ uses
720powers of 1024; ‘M’ stands for 1,048,576 bytes.  ‘BLOCK_SIZE=si’ is
721similar, but uses powers of 1000 and appends ‘B’; ‘MB’ stands for
7221,000,000 bytes.
723
724   A block size specification preceded by ‘'’ causes output sizes to be
725displayed with thousands separators.  The ‘LC_NUMERIC’ locale specifies
726the thousands separator and grouping.  For example, in an American
727English locale, ‘--block-size="'1kB"’ would cause a size of 1234000
728bytes to be displayed as ‘1,234’.  In the default C locale, there is no
729thousands separator so a leading ‘'’ has no effect.
730
731   An integer block size can be followed by a suffix to specify a
732multiple of that size.  A bare size letter, or one followed by ‘iB’,
733specifies a multiple using powers of 1024.  A size letter followed by
734‘B’ specifies powers of 1000 instead.  For example, ‘1M’ and ‘1MiB’ are
735equivalent to ‘1048576’, whereas ‘1MB’ is equivalent to ‘1000000’.
736
737   A plain suffix without a preceding integer acts as if ‘1’ were
738prepended, except that it causes a size indication to be appended to the
739output.  For example, ‘--block-size="kB"’ displays 3000 as ‘3kB’.
740
741   The following suffixes are defined.  Large sizes like ‘1Y’ may be
742rejected by your computer due to limitations of its arithmetic.
743
744‘kB’
745     kilobyte: 10^3 = 1000.
746‘k’
747‘K’
748‘KiB’
749     kibibyte: 2^{10} = 1024.  ‘K’ is special: the SI prefix is ‘k’ and
750     the ISO/IEC 80000-13 prefix is ‘Ki’, but tradition and POSIX use
751     ‘k’ to mean ‘KiB’.
752‘MB’
753     megabyte: 10^6 = 1,000,000.
754‘M’
755‘MiB’
756     mebibyte: 2^{20} = 1,048,576.
757‘GB’
758     gigabyte: 10^9 = 1,000,000,000.
759‘G’
760‘GiB’
761     gibibyte: 2^{30} = 1,073,741,824.
762‘TB’
763     terabyte: 10^{12} = 1,000,000,000,000.
764‘T’
765‘TiB’
766     tebibyte: 2^{40} = 1,099,511,627,776.
767‘PB’
768     petabyte: 10^{15} = 1,000,000,000,000,000.
769‘P’
770‘PiB’
771     pebibyte: 2^{50} = 1,125,899,906,842,624.
772‘EB’
773     exabyte: 10^{18} = 1,000,000,000,000,000,000.
774‘E’
775‘EiB’
776     exbibyte: 2^{60} = 1,152,921,504,606,846,976.
777‘ZB’
778     zettabyte: 10^{21} = 1,000,000,000,000,000,000,000
779‘Z’
780‘ZiB’
781     2^{70} = 1,180,591,620,717,411,303,424.
782‘YB’
783     yottabyte: 10^{24} = 1,000,000,000,000,000,000,000,000.
784‘Y’
785‘YiB’
786     2^{80} = 1,208,925,819,614,629,174,706,176.
787
788   Block size defaults can be overridden by an explicit
789‘--block-size=SIZE’ option.  The ‘-k’ option is equivalent to
790‘--block-size=1K’, which is the default unless the ‘POSIXLY_CORRECT’
791environment variable is set.  The ‘-h’ or ‘--human-readable’ option is
792equivalent to ‘--block-size=human-readable’.  The ‘--si’ option is
793equivalent to ‘--block-size=si’.  Note for ‘ls’ the ‘-k’ option does not
794control the display of the apparent file sizes, whereas the
795‘--block-size’ option does.
796
797
798File: coreutils.info,  Node: Floating point,  Next: Signal specifications,  Prev: Block size,  Up: Common options
799
8002.4 Floating point numbers
801==========================
802
803Commands that accept or produce floating point numbers employ the
804floating point representation of the underlying system, and suffer from
805rounding error, overflow, and similar floating-point issues.  Almost all
806modern systems use IEEE-754 floating point, and it is typically portable
807to assume IEEE-754 behavior these days.  IEEE-754 has positive and
808negative infinity, distinguishes positive from negative zero, and uses
809special values called NaNs to represent invalid computations such as
810dividing zero by itself.  For more information, please see David
811Goldberg’s paper What Every Computer Scientist Should Know About
812Floating-Point Arithmetic
813(https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
814
815   Commands that accept floating point numbers as options, operands or
816input use the standard C functions ‘strtod’ and ‘strtold’ to convert
817from text to floating point numbers.  These floating point numbers
818therefore can use scientific notation like ‘1.0e-34’ and ‘-10e100’.
819Commands that parse floating point also understand case-insensitive
820‘inf’, ‘infinity’, and ‘NaN’, although whether such values are useful
821depends on the command in question.  Modern C implementations also
822accept hexadecimal floating point numbers such as ‘-0x.ep-3’, which
823stands for −14/16 times 2^-3, which equals −0.109375.  *Note
824(libc)Parsing of Floats::.
825
826   Normally the ‘LC_NUMERIC’ locale determines the decimal-point
827character.  However, some commands’ descriptions specify that they
828accept numbers in either the current or the C locale; for example, they
829treat ‘3.14’ like ‘3,14’ if the current locale uses comma as a decimal
830point.
831
832
833File: coreutils.info,  Node: Signal specifications,  Next: Disambiguating names and IDs,  Prev: Floating point,  Up: Common options
834
8352.5 Signal specifications
836=========================
837
838A SIGNAL may be a signal name like ‘HUP’, or a signal number like ‘1’,
839or an exit status of a process terminated by the signal.  A signal name
840can be given in canonical form or prefixed by ‘SIG’.  The case of the
841letters is ignored.  The following signal names and numbers are
842supported on all POSIX compliant systems:
843
844‘HUP’
845     1.  Hangup.
846‘INT’
847     2.  Terminal interrupt.
848‘QUIT’
849     3.  Terminal quit.
850‘ABRT’
851     6.  Process abort.
852‘KILL’
853     9.  Kill (cannot be caught or ignored).
854‘ALRM’
855     14.  Alarm Clock.
856‘TERM’
857     15.  Termination.
858
859Other supported signal names have system-dependent corresponding
860numbers.  All systems conforming to POSIX 1003.1-2001 also support the
861following signals:
862
863‘BUS’
864     Access to an undefined portion of a memory object.
865‘CHLD’
866     Child process terminated, stopped, or continued.
867‘CONT’
868     Continue executing, if stopped.
869‘FPE’
870     Erroneous arithmetic operation.
871‘ILL’
872     Illegal Instruction.
873‘PIPE’
874     Write on a pipe with no one to read it.
875‘SEGV’
876     Invalid memory reference.
877‘STOP’
878     Stop executing (cannot be caught or ignored).
879‘TSTP’
880     Terminal stop.
881‘TTIN’
882     Background process attempting read.
883‘TTOU’
884     Background process attempting write.
885‘URG’
886     High bandwidth data is available at a socket.
887‘USR1’
888     User-defined signal 1.
889‘USR2’
890     User-defined signal 2.
891
892POSIX 1003.1-2001 systems that support the XSI extension also support
893the following signals:
894
895‘POLL’
896     Pollable event.
897‘PROF’
898     Profiling timer expired.
899‘SYS’
900     Bad system call.
901‘TRAP’
902     Trace/breakpoint trap.
903‘VTALRM’
904     Virtual timer expired.
905‘XCPU’
906     CPU time limit exceeded.
907‘XFSZ’
908     File size limit exceeded.
909
910POSIX 1003.1-2001 systems that support the XRT extension also support at
911least eight real-time signals called ‘RTMIN’, ‘RTMIN+1’, ..., ‘RTMAX-1’,
912‘RTMAX’.
913
914
915File: coreutils.info,  Node: Disambiguating names and IDs,  Next: Random sources,  Prev: Signal specifications,  Up: Common options
916
9172.6 chown, chgrp, chroot, id: Disambiguating user names and IDs
918===============================================================
919
920Since the USER and GROUP arguments to these commands may be specified as
921names or numeric IDs, there is an apparent ambiguity.  What if a user or
922group _name_ is a string of digits?  (1) Should the command interpret it
923as a user name or as an ID?  POSIX requires that these commands first
924attempt to resolve the specified string as a name, and only once that
925fails, then try to interpret it as an ID.  This is troublesome when you
926want to specify a numeric ID, say 42, and it must work even in a
927pathological situation where ‘42’ is a user name that maps to some other
928user ID, say 1000.  Simply invoking ‘chown 42 F’, will set ‘F’s owner ID
929to 1000—not what you intended.
930
931   GNU ‘chown’, ‘chgrp’, ‘chroot’, and ‘id’ provide a way to work around
932this, that at the same time may result in a significant performance
933improvement by eliminating a database look-up.  Simply precede each
934numeric user ID and/or group ID with a ‘+’, in order to force its
935interpretation as an integer:
936
937     chown +42 F
938     chgrp +$numeric_group_id another-file
939     chown +0:+0 /
940
941   The name look-up process is skipped for each ‘+’-prefixed string,
942because a string containing ‘+’ is never a valid user or group name.
943This syntax is accepted on most common Unix systems, but not on Solaris
94410.
945
946   ---------- Footnotes ----------
947
948   (1) Using a number as a user name is common in some environments.
949
950
951File: coreutils.info,  Node: Random sources,  Next: Target directory,  Prev: Disambiguating names and IDs,  Up: Common options
952
9532.7 Sources of random data
954==========================
955
956The ‘shuf’, ‘shred’, and ‘sort’ commands sometimes need random data to
957do their work.  For example, ‘sort -R’ must choose a hash function at
958random, and it needs random data to make this selection.
959
960   By default these commands use an internal pseudo-random generator
961initialized by a small amount of entropy, but can be directed to use an
962external source with the ‘--random-source=FILE’ option.  An error is
963reported if FILE does not contain enough bytes.
964
965   For example, the device file ‘/dev/urandom’ could be used as the
966source of random data.  Typically, this device gathers environmental
967noise from device drivers and other sources into an entropy pool, and
968uses the pool to generate random bits.  If the pool is short of data,
969the device reuses the internal pool to produce more bits, using a
970cryptographically secure pseudo-random number generator.  But be aware
971that this device is not designed for bulk random data generation and is
972relatively slow.
973
974/dev/urandom’ suffices for most practical uses, but applications
975requiring high-value or long-term protection of private data may require
976an alternate data source like ‘/dev/random’ or ‘/dev/arandom’.  The set
977of available sources depends on your operating system.
978
979   To reproduce the results of an earlier invocation of a command, you
980can save some random data into a file and then use that file as the
981random source in earlier and later invocations of the command.  Rather
982than depending on a file, one can generate a reproducible arbitrary
983amount of pseudo-random data given a seed value, using for example:
984
985     get_seeded_random()
986     {
987       seed="$1"
988       openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt \
989         </dev/zero 2>/dev/null
990     }
991
992     shuf -i1-100 --random-source=<(get_seeded_random 42)
993
994
995File: coreutils.info,  Node: Target directory,  Next: Trailing slashes,  Prev: Random sources,  Up: Common options
996
9972.8 Target directory
998====================
999
1000The ‘cp’, ‘install’, ‘ln’, and ‘mv’ commands normally treat the last
1001operand specially when it is a directory or a symbolic link to a
1002directory.  For example, ‘cp source dest’ is equivalent to ‘cp source
1003dest/source’ if ‘dest’ is a directory.  Sometimes this behavior is not
1004exactly what is wanted, so these commands support the following options
1005to allow more fine-grained control:
1006
1007‘-T’
1008‘--no-target-directory’
1009     Do not treat the last operand specially when it is a directory or a
1010     symbolic link to a directory.  This can help avoid race conditions
1011     in programs that operate in a shared area.  For example, when the
1012     command ‘mv /tmp/source /tmp/dest’ succeeds, there is no guarantee
1013     that ‘/tmp/source’ was renamed to ‘/tmp/dest’: it could have been
1014     renamed to ‘/tmp/dest/source’ instead, if some other process
1015     created ‘/tmp/dest’ as a directory.  However, if ‘mv -T /tmp/source
1016     /tmp/dest’ succeeds, there is no question that ‘/tmp/source’ was
1017     renamed to ‘/tmp/dest’.
1018
1019     In the opposite situation, where you want the last operand to be
1020     treated as a directory and want a diagnostic otherwise, you can use
1021     the ‘--target-directory’ (‘-t’) option.
1022
1023‘-t DIRECTORY’
1024‘--target-directory=DIRECTORY’
1025     Use DIRECTORY as the directory component of each destination file
1026     name.
1027
1028     The interface for most programs is that after processing options
1029     and a finite (possibly zero) number of fixed-position arguments,
1030     the remaining argument list is either expected to be empty, or is a
1031     list of items (usually files) that will all be handled identically.
1032     The ‘xargs’ program is designed to work well with this convention.
1033
1034     The commands in the ‘mv’-family are unusual in that they take a
1035     variable number of arguments with a special case at the _end_
1036     (namely, the target directory).  This makes it nontrivial to
1037     perform some operations, e.g., “move all files from here to ../d/”,
1038     because ‘mv * ../d/’ might exhaust the argument space, and ‘ls |
1039     xargs ...’ doesn’t have a clean way to specify an extra final
1040     argument for each invocation of the subject command.  (It can be
1041     done by going through a shell command, but that requires more human
1042     labor and brain power than it should.)
1043
1044     The ‘--target-directory’ (‘-t’) option allows the ‘cp’, ‘install’,
1045     ‘ln’, and ‘mv’ programs to be used conveniently with ‘xargs’.  For
1046     example, you can move the files from the current directory to a
1047     sibling directory, ‘d’ like this:
1048
1049          ls | xargs mv -t ../d --
1050
1051     However, this doesn’t move files whose names begin with ‘.’.  If
1052     you use the GNU ‘find’ program, you can move those files too, with
1053     this command:
1054
1055          find . -mindepth 1 -maxdepth 1 \
1056            | xargs mv -t ../d
1057
1058     But both of the above approaches fail if there are no files in the
1059     current directory, or if any file has a name containing a blank or
1060     some other special characters.  The following example removes those
1061     limitations and requires both GNU ‘find’ and GNU ‘xargs’:
1062
1063          find . -mindepth 1 -maxdepth 1 -print0 \
1064            | xargs --null --no-run-if-empty \
1065                mv -t ../d
1066
1067The ‘--target-directory’ (‘-t’) and ‘--no-target-directory’ (‘-T’)
1068options cannot be combined.
1069
1070
1071File: coreutils.info,  Node: Trailing slashes,  Next: Traversing symlinks,  Prev: Target directory,  Up: Common options
1072
10732.9 Trailing slashes
1074====================
1075
1076Some GNU programs (at least ‘cp’ and ‘mv’) allow you to remove any
1077trailing slashes from each SOURCE argument before operating on it.  The
1078‘--strip-trailing-slashes’ option enables this behavior.
1079
1080   This is useful when a SOURCE argument may have a trailing slash and
1081specify a symbolic link to a directory.  This scenario is in fact rather
1082common because some shells can automatically append a trailing slash
1083when performing file name completion on such symbolic links.  Without
1084this option, ‘mv’, for example, (via the system’s rename function) must
1085interpret a trailing slash as a request to dereference the symbolic link
1086and so must rename the indirectly referenced _directory_ and not the
1087symbolic link.  Although it may seem surprising that such behavior be
1088the default, it is required by POSIX and is consistent with other parts
1089of that standard.
1090
1091
1092File: coreutils.info,  Node: Traversing symlinks,  Next: Treating / specially,  Prev: Trailing slashes,  Up: Common options
1093
10942.10 Traversing symlinks
1095========================
1096
1097The following options modify how ‘chown’ and ‘chgrp’ traverse a
1098hierarchy when the ‘--recursive’ (‘-R’) option is also specified.  If
1099more than one of the following options is specified, only the final one
1100takes effect.  These options specify whether processing a symbolic link
1101to a directory entails operating on just the symbolic link or on all
1102files in the hierarchy rooted at that directory.
1103
1104   These options are independent of ‘--dereference’ and
1105‘--no-dereference’ (‘-h’), which control whether to modify a symlink or
1106its referent.
1107
1108‘-H’
1109     If ‘--recursive’ (‘-R’) is specified and a command line argument is
1110     a symbolic link to a directory, traverse it.
1111
1112‘-L’
1113     In a recursive traversal, traverse every symbolic link to a
1114     directory that is encountered.
1115
1116‘-P’
1117     Do not traverse any symbolic links.  This is the default if none of
1118     ‘-H’, ‘-L’, or ‘-P’ is specified.
1119
1120
1121File: coreutils.info,  Node: Treating / specially,  Next: Special built-in utilities,  Prev: Traversing symlinks,  Up: Common options
1122
11232.11 Treating ‘/’ specially
1124===========================
1125
1126Certain commands can operate destructively on entire hierarchies.  For
1127example, if a user with appropriate privileges mistakenly runs ‘rm -rf /
1128tmp/junk’, that may remove all files on the entire system.  Since there
1129are so few legitimate uses for such a command, GNU ‘rm’ normally
1130declines to operate on any directory that resolves to ‘/’.  If you
1131really want to try to remove all the files on your system, you can use
1132the ‘--no-preserve-root’ option, but the default behavior, specified by
1133the ‘--preserve-root’ option, is safer for most purposes.
1134
1135   The commands ‘chgrp’, ‘chmod’ and ‘chown’ can also operate
1136destructively on entire hierarchies, so they too support these options.
1137Although, unlike ‘rm’, they don’t actually unlink files, these commands
1138are arguably more dangerous when operating recursively on ‘/’, since
1139they often work much more quickly, and hence damage more files before an
1140alert user can interrupt them.  Tradition and POSIX require these
1141commands to operate recursively on ‘/’, so they default to
1142‘--no-preserve-root’, but using the ‘--preserve-root’ option makes them
1143safer for most purposes.  For convenience you can specify
1144‘--preserve-root’ in an alias or in a shell function.
1145
1146   Note that the ‘--preserve-root’ option also ensures that ‘chgrp’ and
1147‘chown’ do not modify ‘/’ even when dereferencing a symlink pointing to
1148‘/’.
1149
1150
1151File: coreutils.info,  Node: Special built-in utilities,  Next: Standards conformance,  Prev: Treating / specially,  Up: Common options
1152
11532.12 Special built-in utilities
1154===============================
1155
1156Some programs like ‘nice’ can invoke other programs; for example, the
1157command ‘nice cat file’ invokes the program ‘cat’ by executing the
1158command ‘cat file’.  However, “special built-in utilities” like ‘exit’
1159cannot be invoked this way.  For example, the command ‘nice exit’ does
1160not have a well-defined behavior: it may generate an error message
1161instead of exiting.
1162
1163   Here is a list of the special built-in utilities that are
1164standardized by POSIX 1003.1-2004.
1165
1166     . : break continue eval exec exit export readonly return set shift
1167     times trap unset
1168
1169   For example, because ‘.’, ‘:’, and ‘exec’ are special, the commands
1170‘nice . foo.sh’, ‘nice :’, and ‘nice exec pwd’ do not work as you might
1171expect.
1172
1173   Many shells extend this list.  For example, Bash has several extra
1174special built-in utilities like ‘history’, and ‘suspend’, and with Bash
1175the command ‘nice suspend’ generates an error message instead of
1176suspending.
1177
1178
1179File: coreutils.info,  Node: Standards conformance,  Next: Multi-call invocation,  Prev: Special built-in utilities,  Up: Common options
1180
11812.13 Standards conformance
1182==========================
1183
1184In a few cases, the GNU utilities’ default behavior is incompatible with
1185the POSIX standard.  To suppress these incompatibilities, define the
1186‘POSIXLY_CORRECT’ environment variable.  Unless you are checking for
1187POSIX conformance, you probably do not need to define ‘POSIXLY_CORRECT’.
1188
1189   Newer versions of POSIX are occasionally incompatible with older
1190versions.  For example, older versions of POSIX required the command
1191‘sort +1’ to sort based on the second and succeeding fields in each
1192input line, but in POSIX 1003.1-2001 the same command is required to
1193sort the file named ‘+1’, and you must instead use the command ‘sort -k
11942’ to get the field-based sort.  To complicate things further, POSIX
11951003.1-2008 allows an implementation to have either the old or the new
1196behavior.
1197
1198   The GNU utilities normally conform to the version of POSIX that is
1199standard for your system.  To cause them to conform to a different
1200version of POSIX, define the ‘_POSIX2_VERSION’ environment variable to a
1201value of the form YYYYMM specifying the year and month the standard was
1202adopted.  Three values are currently supported for ‘_POSIX2_VERSION’:
1203‘199209’ stands for POSIX 1003.2-1992, ‘200112’ stands for POSIX
12041003.1-2001, and ‘200809’ stands for POSIX 1003.1-2008.  For example, if
1205you have a POSIX 1003.1-2001 system but are running software containing
1206traditional usage like ‘sort +1’ or ‘tail +10’, you can work around the
1207compatibility problems by setting ‘_POSIX2_VERSION=200809’ in your
1208environment.
1209
1210
1211File: coreutils.info,  Node: Multi-call invocation,  Prev: Standards conformance,  Up: Common options
1212
12132.14 ‘coreutils’: Multi-call program
1214====================================
1215
1216The ‘coreutils’ command invokes an individual utility, either implicitly
1217selected by the last component of the name used to invoke ‘coreutils’,
1218or explicitly with the ‘--coreutils-prog’ option.  Synopsis:
1219
1220     coreutils --coreutils-prog=PROGRAM ...
1221
1222   The ‘coreutils’ command is not installed by default, so portable
1223scripts should not rely on its existence.
1224
1225
1226File: coreutils.info,  Node: Output of entire files,  Next: Formatting file contents,  Prev: Common options,  Up: Top
1227
12283 Output of entire files
1229************************
1230
1231These commands read and write entire files, possibly transforming them
1232in some way.
1233
1234* Menu:
1235
1236* cat invocation::              Concatenate and write files.
1237* tac invocation::              Concatenate and write files in reverse.
1238* nl invocation::               Number lines and write files.
1239* od invocation::               Write files in octal or other formats.
1240* base32 invocation::           Transform data into printable data.
1241* base64 invocation::           Transform data into printable data.
1242* basenc invocation::           Transform data into printable data.
1243
1244
1245File: coreutils.info,  Node: cat invocation,  Next: tac invocation,  Up: Output of entire files
1246
12473.1 ‘cat’: Concatenate and write files
1248======================================
1249
1250‘cat’ copies each FILE (‘-’ means standard input), or standard input if
1251none are given, to standard output.  Synopsis:
1252
1253     cat [OPTION] [FILE]...
1254
1255   The program accepts the following options.  Also see *note Common
1256options::.
1257
1258‘-A’
1259‘--show-all’
1260     Equivalent to ‘-vET’.
1261
1262‘-b’
1263‘--number-nonblank’
1264     Number all nonempty output lines, starting with 1.
1265
1266‘-e’
1267     Equivalent to ‘-vE’.
1268
1269‘-E’
1270‘--show-ends’
1271     Display a ‘$’ after the end of each line.
1272
1273‘-n’
1274‘--number’
1275     Number all output lines, starting with 1.  This option is ignored
1276     if ‘-b’ is in effect.
1277
1278‘-s’
1279‘--squeeze-blank’
1280     Suppress repeated adjacent blank lines; output just one empty line
1281     instead of several.
1282
1283‘-t’
1284     Equivalent to ‘-vT’.
1285
1286‘-T’
1287‘--show-tabs’
1288     Display TAB characters as ‘^I’.
1289
1290‘-u’
1291     Ignored; for POSIX compatibility.
1292
1293‘-v’
1294‘--show-nonprinting’
1295     Display control characters except for LFD and TAB using ‘^’
1296     notation and precede characters that have the high bit set with
1297     ‘M-’.
1298
1299   On systems like MS-DOS that distinguish between text and binary
1300files, ‘cat’ normally reads and writes in binary mode.  However, ‘cat’
1301reads in text mode if one of the options ‘-bensAE’ is used or if ‘cat’
1302is reading from standard input and standard input is a terminal.
1303Similarly, ‘cat’ writes in text mode if one of the options ‘-bensAE’ is
1304used or if standard output is a terminal.
1305
1306   An exit status of zero indicates success, and a nonzero value
1307indicates failure.
1308
1309   Examples:
1310
1311     # Output f's contents, then standard input, then g's contents.
1312     cat f - g
1313
1314     # Copy standard input to standard output.
1315     cat
1316
1317
1318File: coreutils.info,  Node: tac invocation,  Next: nl invocation,  Prev: cat invocation,  Up: Output of entire files
1319
13203.2 ‘tac’: Concatenate and write files in reverse
1321=================================================
1322
1323‘tac’ copies each FILE (‘-’ means standard input), or standard input if
1324none are given, to standard output, reversing the records (lines by
1325default) in each separately.  Synopsis:
1326
1327     tac [OPTION]... [FILE]...
1328
1329   “Records” are separated by instances of a string (newline by
1330default).  By default, this separator string is attached to the end of
1331the record that it follows in the file.
1332
1333   The program accepts the following options.  Also see *note Common
1334options::.
1335
1336‘-b’
1337‘--before’
1338     The separator is attached to the beginning of the record that it
1339     precedes in the file.
1340
1341‘-r’
1342‘--regex’
1343     Treat the separator string as a regular expression.
1344
1345‘-s SEPARATOR’
1346‘--separator=SEPARATOR’
1347     Use SEPARATOR as the record separator, instead of newline.  Note an
1348     empty SEPARATOR is treated as a zero byte.  I.e., input and output
1349     items are delimited with ASCII NUL.
1350
1351   On systems like MS-DOS that distinguish between text and binary
1352files, ‘tac’ reads and writes in binary mode.
1353
1354   An exit status of zero indicates success, and a nonzero value
1355indicates failure.
1356
1357   Example:
1358
1359     # Reverse a file character by character.
1360     tac -r -s 'x\|[^x]'
1361
1362
1363File: coreutils.info,  Node: nl invocation,  Next: od invocation,  Prev: tac invocation,  Up: Output of entire files
1364
13653.3 ‘nl’: Number lines and write files
1366======================================
1367
1368‘nl’ writes each FILE (‘-’ means standard input), or standard input if
1369none are given, to standard output, with line numbers added to some or
1370all of the lines.  Synopsis:
1371
1372     nl [OPTION]... [FILE]...
1373
1374   ‘nl’ decomposes its input into (logical) page sections; by default,
1375the line number is reset to 1 at each logical page section.  ‘nl’ treats
1376all of the input files as a single document; it does not reset line
1377numbers or logical pages between files.
1378
1379   A logical page consists of three sections: header, body, and footer.
1380Any of the sections can be empty.  Each can be numbered in a different
1381style from the others.
1382
1383   The beginnings of the sections of logical pages are indicated in the
1384input file by a line containing exactly one of these delimiter strings:
1385
1386‘\:\:\:’
1387     start of header;
1388‘\:\:’
1389     start of body;
1390‘\:’
1391     start of footer.
1392
1393   The two characters from which these strings are made can be changed
1394from ‘\’ and ‘:’ via options (see below), but the pattern and length of
1395each string cannot be changed.
1396
1397   A section delimiter is replaced by an empty line on output.  Any text
1398that comes before the first section delimiter string in the input file
1399is considered to be part of a body section, so ‘nl’ treats a file that
1400contains no section delimiters as a single body section.
1401
1402   The program accepts the following options.  Also see *note Common
1403options::.
1404
1405‘-b STYLE’
1406‘--body-numbering=STYLE’
1407     Select the numbering style for lines in the body section of each
1408     logical page.  When a line is not numbered, the current line number
1409     is not incremented, but the line number separator character is
1410     still prepended to the line.  The styles are:
1411
1412     ‘a’
1413          number all lines,
1414     ‘t’
1415          number only nonempty lines (default for body),
1416     ‘n’
1417          do not number lines (default for header and footer),
1418     ‘pBRE’
1419          number only lines that contain a match for the basic regular
1420          expression BRE.  *Note Regular Expressions: (grep)Regular
1421          Expressions.
1422
1423‘-d CD’
1424‘--section-delimiter=CD’
1425     Set the section delimiter characters to CD; default is ‘\:’.  If
1426     only C is given, the second remains ‘:’.  (Remember to protect ‘\’
1427     or other metacharacters from shell expansion with quotes or extra
1428     backslashes.)
1429
1430‘-f STYLE’
1431‘--footer-numbering=STYLE’
1432     Analogous to ‘--body-numbering’.
1433
1434‘-h STYLE’
1435‘--header-numbering=STYLE’
1436     Analogous to ‘--body-numbering’.
1437
1438‘-i NUMBER’
1439‘--line-increment=NUMBER’
1440     Increment line numbers by NUMBER (default 1).
1441
1442‘-l NUMBER’
1443‘--join-blank-lines=NUMBER’
1444     Consider NUMBER (default 1) consecutive empty lines to be one
1445     logical line for numbering, and only number the last one.  Where
1446     fewer than NUMBER consecutive empty lines occur, do not number
1447     them.  An empty line is one that contains no characters, not even
1448     spaces or tabs.
1449
1450‘-n FORMAT’
1451‘--number-format=FORMAT’
1452     Select the line numbering format (default is ‘rn’):
1453
1454     ‘ln’
1455          left justified, no leading zeros;
1456     ‘rn’
1457          right justified, no leading zeros;
1458     ‘rz’
1459          right justified, leading zeros.
1460
1461‘-p’
1462‘--no-renumber’
1463     Do not reset the line number at the start of a logical page.
1464
1465‘-s STRING’
1466‘--number-separator=STRING’
1467     Separate the line number from the text line in the output with
1468     STRING (default is the TAB character).
1469
1470‘-v NUMBER’
1471‘--starting-line-number=NUMBER’
1472     Set the initial line number on each logical page to NUMBER (default
1473     1).
1474
1475‘-w NUMBER’
1476‘--number-width=NUMBER’
1477     Use NUMBER characters for line numbers (default 6).
1478
1479   An exit status of zero indicates success, and a nonzero value
1480indicates failure.
1481
1482
1483File: coreutils.info,  Node: od invocation,  Next: base32 invocation,  Prev: nl invocation,  Up: Output of entire files
1484
14853.4 ‘od’: Write files in octal or other formats
1486===============================================
1487
1488‘od’ writes an unambiguous representation of each FILE (‘-’ means
1489standard input), or standard input if none are given.  Synopses:
1490
1491     od [OPTION]... [FILE]...
1492     od [-abcdfilosx]... [FILE] [[+]OFFSET[.][b]]
1493     od [OPTION]... --traditional [FILE] [[+]OFFSET[.][b] [[+]LABEL[.][b]]]
1494
1495   Each line of output consists of the offset in the input, followed by
1496groups of data from the file.  By default, ‘od’ prints the offset in
1497octal, and each group of file data is a C ‘short int’’s worth of input
1498printed as a single octal number.
1499
1500   If OFFSET is given, it specifies how many input bytes to skip before
1501formatting and writing.  By default, it is interpreted as an octal
1502number, but the optional trailing decimal point causes it to be
1503interpreted as decimal.  If no decimal is specified and the offset
1504begins with ‘0x’ or ‘0X’ it is interpreted as a hexadecimal number.  If
1505there is a trailing ‘b’, the number of bytes skipped will be OFFSET
1506multiplied by 512.
1507
1508   If a command is of both the first and second forms, the second form
1509is assumed if the last operand begins with ‘+’ or (if there are two
1510operands) a digit.  For example, in ‘od foo 10’ and ‘od +10’ the ‘10’ is
1511an offset, whereas in ‘od 10’ the ‘10’ is a file name.
1512
1513   The program accepts the following options.  Also see *note Common
1514options::.
1515
1516‘-A RADIX’
1517‘--address-radix=RADIX’
1518     Select the base in which file offsets are printed.  RADIX can be
1519     one of the following:
1520
1521     ‘d’
1522          decimal;
1523     ‘o’
1524          octal;
1525     ‘x’
1526          hexadecimal;
1527     ‘n’
1528          none (do not print offsets).
1529
1530     The default is octal.
1531
1532‘--endian=ORDER’
1533     Reorder input bytes, to handle inputs with differing byte orders,
1534     or to provide consistent output independent of the endian
1535     convention of the current system.  Swapping is performed according
1536     to the specified ‘--type’ size and endian ORDER, which can be
1537     ‘little’ or ‘big’.
1538
1539‘-j BYTES’
1540‘--skip-bytes=BYTES’
1541     Skip BYTES input bytes before formatting and writing.  If BYTES
1542     begins with ‘0x’ or ‘0X’, it is interpreted in hexadecimal;
1543     otherwise, if it begins with ‘0’, in octal; otherwise, in decimal.
1544     BYTES may be, or may be an integer optionally followed by, one of
1545     the following multiplicative suffixes:
1546          ‘b’  =>            512 ("blocks")
1547          ‘KB’ =>           1000 (KiloBytes)
1548          ‘K’  =>           1024 (KibiBytes)
1549          ‘MB’ =>      1000*1000 (MegaBytes)
1550          ‘M’  =>      1024*1024 (MebiBytes)
1551          ‘GB’ => 1000*1000*1000 (GigaBytes)
1552          ‘G’  => 1024*1024*1024 (GibiBytes)
1553     and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.  Binary prefixes can be
1554     used, too: ‘KiB’=‘K’, ‘MiB’=‘M’, and so on.
1555
1556‘-N BYTES’
1557‘--read-bytes=BYTES’
1558     Output at most BYTES bytes of the input.  Prefixes and suffixes on
1559     ‘bytes’ are interpreted as for the ‘-j’ option.
1560
1561‘-S BYTES’
1562‘--strings[=BYTES]’
1563     Instead of the normal output, output only “string constants”: at
1564     least BYTES consecutive ASCII graphic characters, followed by a
1565     zero byte (ASCII NUL). Prefixes and suffixes on BYTES are
1566     interpreted as for the ‘-j’ option.
1567
1568     If BYTES is omitted with ‘--strings’, the default is 3.
1569
1570‘-t TYPE’
1571‘--format=TYPE’
1572     Select the format in which to output the file data.  TYPE is a
1573     string of one or more of the below type indicator characters.  If
1574     you include more than one type indicator character in a single TYPE
1575     string, or use this option more than once, ‘od’ writes one copy of
1576     each output line using each of the data types that you specified,
1577     in the order that you specified.
1578
1579     Adding a trailing “z” to any type specification appends a display
1580     of the single byte character representation of the printable
1581     characters to the output line generated by the type specification.
1582
1583     ‘a’
1584          named character, ignoring high-order bit
1585     ‘c’
1586          printable single byte character, C backslash escape or a 3
1587          digit octal sequence
1588     ‘d’
1589          signed decimal
1590     ‘f’
1591          floating point (*note Floating point::)
1592     ‘o’
1593          octal
1594     ‘u’
1595          unsigned decimal
1596     ‘x’
1597          hexadecimal
1598
1599     The type ‘a’ outputs things like ‘sp’ for space, ‘nl’ for newline,
1600     and ‘nul’ for a zero byte.  Only the least significant seven bits
1601     of each byte is used; the high-order bit is ignored.  Type ‘c’
1602     outputs ‘ ’, ‘\n’, and ‘\0’, respectively.
1603
1604     Except for types ‘a’ and ‘c’, you can specify the number of bytes
1605     to use in interpreting each number in the given data type by
1606     following the type indicator character with a decimal integer.
1607     Alternately, you can specify the size of one of the C compiler’s
1608     built-in data types by following the type indicator character with
1609     one of the following characters.  For integers (‘d’, ‘o’, ‘u’,
1610     ‘x’):
1611
1612     ‘C’
1613          char
1614     ‘S’
1615          short
1616     ‘I’
1617          int
1618     ‘L’
1619          long
1620
1621     For floating point (‘f’):
1622
1623     F
1624          float
1625     D
1626          double
1627     L
1628          long double
1629
1630‘-v’
1631‘--output-duplicates’
1632     Output consecutive lines that are identical.  By default, when two
1633     or more consecutive output lines would be identical, ‘od’ outputs
1634     only the first line, and puts just an asterisk on the following
1635     line to indicate the elision.
1636
1637‘-w[N]’
1638‘--width[=N]’
1639     Dump ‘n’ input bytes per output line.  This must be a multiple of
1640     the least common multiple of the sizes associated with the
1641     specified output types.
1642
1643     If this option is not given at all, the default is 16.  If N is
1644     omitted, the default is 32.
1645
1646   The next several options are shorthands for format specifications.
1647GNU ‘od’ accepts any combination of shorthands and format specification
1648options.  These options accumulate.
1649
1650‘-a’
1651     Output as named characters.  Equivalent to ‘-t a’.
1652
1653‘-b’
1654     Output as octal bytes.  Equivalent to ‘-t o1’.
1655
1656‘-c’
1657     Output as printable single byte characters, C backslash escapes or
1658     3 digit octal sequences.  Equivalent to ‘-t c’.
1659
1660‘-d’
1661     Output as unsigned decimal two-byte units.  Equivalent to ‘-t u2’.
1662
1663‘-f’
1664     Output as floats.  Equivalent to ‘-t fF’.
1665
1666‘-i’
1667     Output as decimal ints.  Equivalent to ‘-t dI’.
1668
1669‘-l’
1670     Output as decimal long ints.  Equivalent to ‘-t dL’.
1671
1672‘-o’
1673     Output as octal two-byte units.  Equivalent to ‘-t o2’.
1674
1675‘-s’
1676     Output as decimal two-byte units.  Equivalent to ‘-t d2’.
1677
1678‘-x’
1679     Output as hexadecimal two-byte units.  Equivalent to ‘-t x2’.
1680
1681‘--traditional’
1682     Recognize the non-option label argument that traditional ‘od’
1683     accepted.  The following syntax:
1684
1685          od --traditional [FILE] [[+]OFFSET[.][b] [[+]LABEL[.][b]]]
1686
1687     can be used to specify at most one file and optional arguments
1688     specifying an offset and a pseudo-start address, LABEL.  The LABEL
1689     argument is interpreted just like OFFSET, but it specifies an
1690     initial pseudo-address.  The pseudo-addresses are displayed in
1691     parentheses following any normal address.
1692
1693   An exit status of zero indicates success, and a nonzero value
1694indicates failure.
1695
1696
1697File: coreutils.info,  Node: base32 invocation,  Next: base64 invocation,  Prev: od invocation,  Up: Output of entire files
1698
16993.5 ‘base32’: Transform data into printable data
1700================================================
1701
1702‘base32’ transforms data read from a file, or standard input, into (or
1703from) base32 encoded form.  The base32 encoded form uses printable ASCII
1704characters to represent binary data.  The usage and options of this
1705command are precisely the same as for ‘base64’.  *Note base64
1706invocation::.
1707
1708
1709File: coreutils.info,  Node: base64 invocation,  Next: basenc invocation,  Prev: base32 invocation,  Up: Output of entire files
1710
17113.6 ‘base64’: Transform data into printable data
1712================================================
1713
1714‘base64’ transforms data read from a file, or standard input, into (or
1715from) base64 encoded form.  The base64 encoded form uses printable ASCII
1716characters to represent binary data.  Synopses:
1717
1718     base64 [OPTION]... [FILE]
1719     base64 --decode [OPTION]... [FILE]
1720
1721   The base64 encoding expands data to roughly 133% of the original.
1722The base32 encoding expands data to roughly 160% of the original.  The
1723format conforms to RFC 4648 (https://tools.ietf.org/search/rfc4648).
1724
1725   The program accepts the following options.  Also see *note Common
1726options::.
1727
1728‘-w COLS’
1729‘--wrap=COLS’
1730     During encoding, wrap lines after COLS characters.  This must be a
1731     positive number.
1732
1733     The default is to wrap after 76 characters.  Use the value 0 to
1734     disable line wrapping altogether.
1735
1736‘-d’
1737‘--decode’
1738     Change the mode of operation, from the default of encoding data, to
1739     decoding data.  Input is expected to be base64 encoded data, and
1740     the output will be the original data.
1741
1742‘-i’
1743‘--ignore-garbage’
1744     When decoding, newlines are always accepted.  During decoding,
1745     ignore unrecognized bytes, to permit distorted data to be decoded.
1746
1747   An exit status of zero indicates success, and a nonzero value
1748indicates failure.
1749
1750
1751File: coreutils.info,  Node: basenc invocation,  Prev: base64 invocation,  Up: Output of entire files
1752
17533.7 ‘basenc’: Transform data into printable data
1754================================================
1755
1756‘basenc’ transforms data read from a file, or standard input, into (or
1757from) various common encoding forms.  The encoded form uses printable
1758ASCII characters to represent binary data.
1759
1760   Synopses:
1761
1762     basenc ENCODING [OPTION]... [FILE]
1763     basenc ENCODING --decode [OPTION]... [FILE]
1764
1765   The ENCODING argument is required.  If FILE is omitted, reads input
1766from stdin.  The ‘-w/--wrap’,‘-i/--ignore-garbage’, ‘-d/--decode’
1767options of this command are precisely the same as for ‘base64’.  *Note
1768base64 invocation::.
1769
1770   Supported ENCODINGs are:
1771
1772‘--base64’
1773     Encode into (or decode from with ‘-d/--decode’) base64 form.  The
1774     format conforms to RFC 4648#4
1775     (https://tools.ietf.org/search/rfc4648#section-4).  Equivalent to
1776     the ‘base64’ command.
1777
1778‘--base64url’
1779     Encode into (or decode from with ‘-d/--decode’) file-and-url-safe
1780     base64 form (using ‘_’ and ‘-’ instead of ‘+’ and ‘/’).  The format
1781     conforms to RFC 4648#5
1782     (https://tools.ietf.org/search/rfc4648#section-5).
1783
1784‘--base32’
1785     Encode into (or decode from with ‘-d/--decode’) base32 form.  The
1786     encoded data uses the ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=’
1787     characters.  The format conforms to RFC 4648#6
1788     (https://tools.ietf.org/search/rfc4648#section-6).  Equivalent to
1789     the ‘base32’ command.
1790
1791‘--base32hex’
1792     Encode into (or decode from with ‘-d/--decode’) Extended Hex
1793     Alphabet base32 form.  The encoded data uses the
1794     ‘0123456789ABCDEFGHIJKLMNOPQRSTUV=’ characters.  The format
1795     conforms to RFC 4648#7
1796     (https://tools.ietf.org/search/rfc4648#section-7).
1797
1798‘--base16’
1799     Encode into (or decode from with ‘-d/--decode’) base16
1800     (hexadecimal) form.  The encoded data uses the ‘0123456789ABCDEF’
1801     characters.  The format conforms to RFC 4648#8
1802     (https://tools.ietf.org/search/rfc4648#section-8).
1803
1804‘--base2lsbf’
1805     Encode into (or decode from with ‘-d/--decode’) binary string form
1806     (‘0’ and ‘1’) with the _least_ significant bit of every byte first.
1807
1808‘--base2msbf’
1809     Encode into (or decode from with ‘-d/--decode’) binary string form
1810     (‘0’ and ‘1’) with the _most_ significant bit of every byte first.
1811
1812‘--z85’
1813     Encode into (or decode from with ‘-d/--decode’) Z85 form (a
1814     modified Ascii85 form).  The encoded data uses the
1815     ‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU VWXYZ.-:+=^!/*?&<>()[]{}@%$#’.
1816     characters.  The format conforms to ZeroMQ spec:32/Z85
1817     (https://rfc.zeromq.org/spec:32/Z85/).
1818
1819     When encoding with ‘--z85’, input length must be a multiple of 4;
1820     when decoding with ‘--z85’, input length must be a multiple of 5.
1821
1822   Encoding/decoding examples:
1823
1824     $ printf '\376\117\202' | basenc --base64
1825     /k+C
1826
1827     $ printf '\376\117\202' | basenc --base64url
1828     _k-C
1829
1830     $ printf '\376\117\202' | basenc --base32
1831     7ZHYE===
1832
1833     $ printf '\376\117\202' | basenc --base32hex
1834     VP7O4===
1835
1836     $ printf '\376\117\202' | basenc --base16
1837     FE4F82
1838
1839     $ printf '\376\117\202' | basenc --base2lsbf
1840     011111111111001001000001
1841
1842     $ printf '\376\117\202' | basenc --base2msbf
1843     111111100100111110000010
1844
1845     $ printf '\376\117\202\000' | basenc --z85
1846     @.FaC
1847
1848     $ printf 01010100 | basenc --base2msbf --decode
1849     T
1850
1851     $ printf 01010100 | basenc --base2lsbf --decode
1852     *
1853
1854
1855File: coreutils.info,  Node: Formatting file contents,  Next: Output of parts of files,  Prev: Output of entire files,  Up: Top
1856
18574 Formatting file contents
1858**************************
1859
1860These commands reformat the contents of files.
1861
1862* Menu:
1863
1864* fmt invocation::              Reformat paragraph text.
1865* pr invocation::               Paginate or columnate files for printing.
1866* fold invocation::             Wrap input lines to fit in specified width.
1867
1868
1869File: coreutils.info,  Node: fmt invocation,  Next: pr invocation,  Up: Formatting file contents
1870
18714.1 ‘fmt’: Reformat paragraph text
1872==================================
1873
1874‘fmt’ fills and joins lines to produce output lines of (at most) a given
1875number of characters (75 by default).  Synopsis:
1876
1877     fmt [OPTION]... [FILE]...
1878
1879   ‘fmt’ reads from the specified FILE arguments (or standard input if
1880none are given), and writes to standard output.
1881
1882   By default, blank lines, spaces between words, and indentation are
1883preserved in the output; successive input lines with different
1884indentation are not joined; tabs are expanded on input and introduced on
1885output.
1886
1887   ‘fmt’ prefers breaking lines at the end of a sentence, and tries to
1888avoid line breaks after the first word of a sentence or before the last
1889word of a sentence.  A “sentence break” is defined as either the end of
1890a paragraph or a word ending in any of ‘.?!’, followed by two spaces or
1891end of line, ignoring any intervening parentheses or quotes.  Like TeX,
1892‘fmt’ reads entire “paragraphs” before choosing line breaks; the
1893algorithm is a variant of that given by Donald E. Knuth and Michael F.
1894Plass in “Breaking Paragraphs Into Lines”, ‘Software—Practice &
1895Experience’ 11, 11 (November 1981), 1119–1184.
1896
1897   The program accepts the following options.  Also see *note Common
1898options::.
1899
1900‘-c’
1901‘--crown-margin’
1902     “Crown margin” mode: preserve the indentation of the first two
1903     lines within a paragraph, and align the left margin of each
1904     subsequent line with that of the second line.
1905
1906‘-t’
1907‘--tagged-paragraph’
1908     “Tagged paragraph” mode: like crown margin mode, except that if
1909     indentation of the first line of a paragraph is the same as the
1910     indentation of the second, the first line is treated as a one-line
1911     paragraph.
1912
1913‘-s’
1914‘--split-only’
1915     Split lines only.  Do not join short lines to form longer ones.
1916     This prevents sample lines of code, and other such “formatted” text
1917     from being unduly combined.
1918
1919‘-u’
1920‘--uniform-spacing’
1921     Uniform spacing.  Reduce spacing between words to one space, and
1922     spacing between sentences to two spaces.
1923
1924‘-WIDTH’
1925‘-w WIDTH’
1926‘--width=WIDTH’
1927     Fill output lines up to WIDTH characters (default 75 or GOAL plus
1928     10, if GOAL is provided).
1929
1930‘-g GOAL’
1931‘--goal=GOAL’
1932     ‘fmt’ initially tries to make lines GOAL characters wide.  By
1933     default, this is 7% shorter than WIDTH.
1934
1935‘-p PREFIX’
1936‘--prefix=PREFIX’
1937     Only lines beginning with PREFIX (possibly preceded by whitespace)
1938     are subject to formatting.  The prefix and any preceding whitespace
1939     are stripped for the formatting and then re-attached to each
1940     formatted output line.  One use is to format certain kinds of
1941     program comments, while leaving the code unchanged.
1942
1943   An exit status of zero indicates success, and a nonzero value
1944indicates failure.
1945
1946
1947File: coreutils.info,  Node: pr invocation,  Next: fold invocation,  Prev: fmt invocation,  Up: Formatting file contents
1948
19494.2 ‘pr’: Paginate or columnate files for printing
1950==================================================
1951
1952‘pr’ writes each FILE (‘-’ means standard input), or standard input if
1953none are given, to standard output, paginating and optionally outputting
1954in multicolumn format; optionally merges all FILEs, printing all in
1955parallel, one per column.  Synopsis:
1956
1957     pr [OPTION]... [FILE]...
1958
1959   By default, a 5-line header is printed at each page: two blank lines;
1960a line with the date, the file name, and the page count; and two more
1961blank lines.  A footer of five blank lines is also printed.  The default
1962PAGE_LENGTH is 66 lines.  The default number of text lines is therefore
196356.  The text line of the header takes the form ‘DATE STRING PAGE’, with
1964spaces inserted around STRING so that the line takes up the full
1965PAGE_WIDTH.  Here, DATE is the date (see the ‘-D’ or ‘--date-format’
1966option for details), STRING is the centered header string, and PAGE
1967identifies the page number.  The ‘LC_MESSAGES’ locale category affects
1968the spelling of PAGE; in the default C locale, it is ‘Page NUMBER’ where
1969NUMBER is the decimal page number.
1970
1971   Form feeds in the input cause page breaks in the output.  Multiple
1972form feeds produce empty pages.
1973
1974   Columns are of equal width, separated by an optional string (default
1975is ‘space’).  For multicolumn output, lines will always be truncated to
1976PAGE_WIDTH (default 72), unless you use the ‘-J’ option.  For single
1977column output no line truncation occurs by default.  Use ‘-W’ option to
1978truncate lines in that case.
1979
1980   The program accepts the following options.  Also see *note Common
1981options::.
1982
1983‘+FIRST_PAGE[:LAST_PAGE]’
1984‘--pages=FIRST_PAGE[:LAST_PAGE]’
1985     Begin printing with page FIRST_PAGE and stop with LAST_PAGE.
1986     Missing ‘:LAST_PAGE’ implies end of file.  While estimating the
1987     number of skipped pages each form feed in the input file results in
1988     a new page.  Page counting with and without ‘+FIRST_PAGE’ is
1989     identical.  By default, counting starts with the first page of
1990     input file (not first page printed).  Line numbering may be altered
1991     by ‘-N’ option.
1992
1993‘-COLUMN’
1994‘--columns=COLUMN’
1995     With each single FILE, produce COLUMN columns of output (default is
1996     1) and print columns down, unless ‘-a’ is used.  The column width
1997     is automatically decreased as COLUMN increases; unless you use the
1998     ‘-W/-w’ option to increase PAGE_WIDTH as well.  This option might
1999     well cause some lines to be truncated.  The number of lines in the
2000     columns on each page are balanced.  The options ‘-e’ and ‘-i’ are
2001     on for multiple text-column output.  Together with ‘-J’ option
2002     column alignment and line truncation is turned off.  Lines of full
2003     length are joined in a free field format and ‘-S’ option may set
2004     field separators.  ‘-COLUMN’ may not be used with ‘-m’ option.
2005
2006‘-a’
2007‘--across’
2008     With each single FILE, print columns across rather than down.  The
2009     ‘-COLUMN’ option must be given with COLUMN greater than one.  If a
2010     line is too long to fit in a column, it is truncated.
2011
2012‘-c’
2013‘--show-control-chars’
2014     Print control characters using hat notation (e.g., ‘^G’); print
2015     other nonprinting characters in octal backslash notation.  By
2016     default, nonprinting characters are not changed.
2017
2018‘-d’
2019‘--double-space’
2020     Double space the output.
2021
2022‘-D FORMAT’
2023‘--date-format=FORMAT’
2024     Format header dates using FORMAT, using the same conventions as for
2025     the command ‘date +FORMAT’.  *Note date invocation::.  Except for
2026     directives, which start with ‘%’, characters in FORMAT are printed
2027     unchanged.  You can use this option to specify an arbitrary string
2028     in place of the header date, e.g., ‘--date-format="Monday
2029     morning"’.
2030
2031     The default date format is ‘%Y-%m-%d %H:%M’ (for example,
2032     ‘2001-12-04 23:59’); but if the ‘POSIXLY_CORRECT’ environment
2033     variable is set and the ‘LC_TIME’ locale category specifies the
2034     POSIX locale, the default is ‘%b %e %H:%M %Y’ (for example, ‘Dec  4
2035     23:59 2001’.
2036
2037     Timestamps are listed according to the time zone rules specified by
2038     the ‘TZ’ environment variable, or by the system default rules if
2039     ‘TZ’ is not set.  *Note Specifying the Time Zone with ‘TZ’:
2040     (libc)TZ Variable.
2041
2042‘-e[IN-TABCHAR[IN-TABWIDTH]]’
2043‘--expand-tabs[=IN-TABCHAR[IN-TABWIDTH]]’
2044     Expand TABs to spaces on input.  Optional argument IN-TABCHAR is
2045     the input tab character (default is the TAB character).  Second
2046     optional argument IN-TABWIDTH is the input tab character’s width
2047     (default is 8).
2048
2049‘-f’
2050‘-F’
2051‘--form-feed’
2052     Use a form feed instead of newlines to separate output pages.  This
2053     does not alter the default page length of 66 lines.
2054
2055‘-h HEADER’
2056‘--header=HEADER’
2057     Replace the file name in the header with the centered string
2058     HEADER.  When using the shell, HEADER should be quoted and should
2059     be separated from ‘-h’ by a space.
2060
2061‘-i[OUT-TABCHAR[OUT-TABWIDTH]]’
2062‘--output-tabs[=OUT-TABCHAR[OUT-TABWIDTH]]’
2063     Replace spaces with TABs on output.  Optional argument OUT-TABCHAR
2064     is the output tab character (default is the TAB character).  Second
2065     optional argument OUT-TABWIDTH is the output tab character’s width
2066     (default is 8).
2067
2068‘-J’
2069‘--join-lines’
2070     Merge lines of full length.  Used together with the column options
2071     ‘-COLUMN’, ‘-a -COLUMN’ or ‘-m’.  Turns off ‘-W/-w’ line
2072     truncation; no column alignment used; may be used with
2073     ‘--sep-string[=STRING]’.  ‘-J’ has been introduced (together with
2074     ‘-W’ and ‘--sep-string’) to disentangle the old (POSIX-compliant)
2075     options ‘-w’ and ‘-s’ along with the three column options.
2076
2077‘-l PAGE_LENGTH’
2078‘--length=PAGE_LENGTH’
2079     Set the page length to PAGE_LENGTH (default 66) lines, including
2080     the lines of the header [and the footer].  If PAGE_LENGTH is less
2081     than or equal to 10, the header and footer are omitted, as if the
2082     ‘-t’ option had been given.
2083
2084‘-m’
2085‘--merge’
2086     Merge and print all FILEs in parallel, one in each column.  If a
2087     line is too long to fit in a column, it is truncated, unless the
2088     ‘-J’ option is used.  ‘--sep-string[=STRING]’ may be used.  Empty
2089     pages in some FILEs (form feeds set) produce empty columns, still
2090     marked by STRING.  The result is a continuous line numbering and
2091     column marking throughout the whole merged file.  Completely empty
2092     merged pages show no separators or line numbers.  The default
2093     header becomes ‘DATE PAGE’ with spaces inserted in the middle; this
2094     may be used with the ‘-h’ or ‘--header’ option to fill up the
2095     middle blank part.
2096
2097‘-n[NUMBER-SEPARATOR[DIGITS]]’
2098‘--number-lines[=NUMBER-SEPARATOR[DIGITS]]’
2099     Provide DIGITS digit line numbering (default for DIGITS is 5).
2100     With multicolumn output the number occupies the first DIGITS column
2101     positions of each text column or only each line of ‘-m’ output.
2102     With single column output the number precedes each line just as
2103     ‘-m’ does.  Default counting of the line numbers starts with the
2104     first line of the input file (not the first line printed, compare
2105     the ‘--page’ option and ‘-N’ option).  Optional argument
2106     NUMBER-SEPARATOR is the character appended to the line number to
2107     separate it from the text followed.  The default separator is the
2108     TAB character.  In a strict sense a TAB is always printed with
2109     single column output only.  The TAB width varies with the TAB
2110     position, e.g., with the left MARGIN specified by ‘-o’ option.
2111     With multicolumn output priority is given to ‘equal width of output
2112     columns’ (a POSIX specification).  The TAB width is fixed to the
2113     value of the first column and does not change with different values
2114     of left MARGIN.  That means a fixed number of spaces is always
2115     printed in the place of the NUMBER-SEPARATOR TAB.  The tabification
2116     depends upon the output position.
2117
2118‘-N LINE_NUMBER’
2119‘--first-line-number=LINE_NUMBER’
2120     Start line counting with the number LINE_NUMBER at first line of
2121     first page printed (in most cases not the first line of the input
2122     file).
2123
2124‘-o MARGIN’
2125‘--indent=MARGIN’
2126     Indent each line with a margin MARGIN spaces wide (default is
2127     zero).  The total page width is the size of the margin plus the
2128     PAGE_WIDTH set with the ‘-W/-w’ option.  A limited overflow may
2129     occur with numbered single column output (compare ‘-n’ option).
2130
2131‘-r’
2132‘--no-file-warnings’
2133     Do not print a warning message when an argument FILE cannot be
2134     opened.  (The exit status will still be nonzero, however.)
2135
2136‘-s[CHAR]’
2137‘--separator[=CHAR]’
2138     Separate columns by a single character CHAR.  The default for CHAR
2139     is the TAB character without ‘-w’ and ‘no character’ with ‘-w’.
2140     Without ‘-s’ the default separator ‘space’ is set.  ‘-s[char]’
2141     turns off line truncation of all three column options
2142     (‘-COLUMN’|‘-a -COLUMN’|‘-m’) unless ‘-w’ is set.  This is a
2143     POSIX-compliant formulation.
2144
2145‘-S[STRING]’
2146‘--sep-string[=STRING]’
2147     Use STRING to separate output columns.  The ‘-S’ option doesn’t
2148     affect the ‘-W/-w’ option, unlike the ‘-s’ option which does.  It
2149     does not affect line truncation or column alignment.  Without ‘-S’,
2150     and with ‘-J’, ‘pr’ uses the default output separator, TAB.
2151     Without ‘-S’ or ‘-J’, ‘pr’ uses a ‘space’ (same as ‘-S" "’).  If no
2152     ‘STRING’ argument is specified, ‘""’ is assumed.
2153
2154‘-t’
2155‘--omit-header’
2156     Do not print the usual header [and footer] on each page, and do not
2157     fill out the bottom of pages (with blank lines or a form feed).  No
2158     page structure is produced, but form feeds set in the input files
2159     are retained.  The predefined pagination is not changed.  ‘-t’ or
2160     ‘-T’ may be useful together with other options; e.g.: ‘-t -e4’,
2161     expand TAB characters in the input file to 4 spaces but don’t make
2162     any other changes.  Use of ‘-t’ overrides ‘-h’.
2163
2164‘-T’
2165‘--omit-pagination’
2166     Do not print header [and footer].  In addition eliminate all form
2167     feeds set in the input files.
2168
2169‘-v’
2170‘--show-nonprinting’
2171     Print nonprinting characters in octal backslash notation.
2172
2173‘-w PAGE_WIDTH’
2174‘--width=PAGE_WIDTH’
2175     Set page width to PAGE_WIDTH characters for multiple text-column
2176     output only (default for PAGE_WIDTH is 72).  The specified
2177     PAGE_WIDTH is rounded down so that columns have equal width.
2178     ‘-s[CHAR]’ turns off the default page width and any line truncation
2179     and column alignment.  Lines of full length are merged, regardless
2180     of the column options set.  No PAGE_WIDTH setting is possible with
2181     single column output.  A POSIX-compliant formulation.
2182
2183‘-W PAGE_WIDTH’
2184‘--page_width=PAGE_WIDTH’
2185     Set the page width to PAGE_WIDTH characters, honored with and
2186     without a column option.  With a column option, the specified
2187     PAGE_WIDTH is rounded down so that columns have equal width.  Text
2188     lines are truncated, unless ‘-J’ is used.  Together with one of the
2189     three column options (‘-COLUMN’, ‘-a -COLUMN’ or ‘-m’) column
2190     alignment is always used.  The separator options ‘-S’ or ‘-s’ don’t
2191     disable the ‘-W’ option.  Default is 72 characters.  Without ‘-W
2192     PAGE_WIDTH’ and without any of the column options NO line
2193     truncation is used (defined to keep downward compatibility and to
2194     meet most frequent tasks).  That’s equivalent to ‘-W 72 -J’.  The
2195     header line is never truncated.
2196
2197   An exit status of zero indicates success, and a nonzero value
2198indicates failure.
2199
2200
2201File: coreutils.info,  Node: fold invocation,  Prev: pr invocation,  Up: Formatting file contents
2202
22034.3 ‘fold’: Wrap input lines to fit in specified width
2204======================================================
2205
2206‘fold’ writes each FILE (‘-’ means standard input), or standard input if
2207none are given, to standard output, breaking long lines.  Synopsis:
2208
2209     fold [OPTION]... [FILE]...
2210
2211   By default, ‘fold’ breaks lines wider than 80 columns.  The output is
2212split into as many lines as necessary.
2213
2214   ‘fold’ counts screen columns by default; thus, a tab may count more
2215than one column, backspace decreases the column count, and carriage
2216return sets the column to zero.
2217
2218   The program accepts the following options.  Also see *note Common
2219options::.
2220
2221‘-b’
2222‘--bytes’
2223     Count bytes rather than columns, so that tabs, backspaces, and
2224     carriage returns are each counted as taking up one column, just
2225     like other characters.
2226
2227‘-s’
2228‘--spaces’
2229     Break at word boundaries: the line is broken after the last blank
2230     before the maximum line length.  If the line contains no such
2231     blanks, the line is broken at the maximum line length as usual.
2232
2233‘-w WIDTH’
2234‘--width=WIDTH’
2235     Use a maximum line length of WIDTH columns instead of 80.
2236
2237     For compatibility ‘fold’ supports an obsolete option syntax
2238     ‘-WIDTH’.  New scripts should use ‘-w WIDTH’ instead.
2239
2240   An exit status of zero indicates success, and a nonzero value
2241indicates failure.
2242
2243
2244File: coreutils.info,  Node: Output of parts of files,  Next: Summarizing files,  Prev: Formatting file contents,  Up: Top
2245
22465 Output of parts of files
2247**************************
2248
2249These commands output pieces of the input.
2250
2251* Menu:
2252
2253* head invocation::             Output the first part of files.
2254* tail invocation::             Output the last part of files.
2255* split invocation::            Split a file into pieces.
2256* csplit invocation::           Split a file into context-determined pieces.
2257
2258
2259File: coreutils.info,  Node: head invocation,  Next: tail invocation,  Up: Output of parts of files
2260
22615.1 ‘head’: Output the first part of files
2262==========================================
2263
2264‘head’ prints the first part (10 lines by default) of each FILE; it
2265reads from standard input if no files are given or when given a FILE of
2266‘-’.  Synopsis:
2267
2268     head [OPTION]... [FILE]...
2269
2270   If more than one FILE is specified, ‘head’ prints a one-line header
2271consisting of:
2272
2273     ==> FILE NAME <==
2274
2275before the output for each FILE.
2276
2277   The program accepts the following options.  Also see *note Common
2278options::.
2279
2280‘-c [-]NUM’
2281‘--bytes=[-]NUM’
2282     Print the first NUM bytes, instead of initial lines.  However, if
2283     NUM is prefixed with a ‘-’, print all but the last NUM bytes of
2284     each file.  NUM may be, or may be an integer optionally followed
2285     by, one of the following multiplicative suffixes:
2286          ‘b’  =>            512 ("blocks")
2287          ‘KB’ =>           1000 (KiloBytes)
2288          ‘K’  =>           1024 (KibiBytes)
2289          ‘MB’ =>      1000*1000 (MegaBytes)
2290          ‘M’  =>      1024*1024 (MebiBytes)
2291          ‘GB’ => 1000*1000*1000 (GigaBytes)
2292          ‘G’  => 1024*1024*1024 (GibiBytes)
2293     and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.  Binary prefixes can be
2294     used, too: ‘KiB’=‘K’, ‘MiB’=‘M’, and so on.
2295
2296‘-n [-]NUM’
2297‘--lines=[-]NUM’
2298     Output the first NUM lines.  However, if NUM is prefixed with a
2299     ‘-’, print all but the last NUM lines of each file.  Size
2300     multiplier suffixes are the same as with the ‘-c’ option.
2301
2302‘-q’
2303‘--quiet’
2304‘--silent’
2305     Never print file name headers.
2306
2307‘-v’
2308‘--verbose’
2309     Always print file name headers.
2310
2311‘-z’
2312‘--zero-terminated’
2313     Delimit items with a zero byte rather than a newline (ASCII LF).
2314     I.e., treat input as items separated by ASCII NUL and terminate
2315     output items with ASCII NUL. This option can be useful in
2316     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
2317     do the same in order to reliably handle arbitrary file names (even
2318     those containing blanks or other special characters).
2319
2320   For compatibility ‘head’ also supports an obsolete option syntax
2321‘-[NUM][bkm][cqv]’, which is recognized only if it is specified first.
2322NUM is a decimal number optionally followed by a size letter (‘b’, ‘k’,
2323‘m’) as in ‘-c’, or ‘l’ to mean count by lines, or other option letters
2324(‘cqv’).  Scripts intended for standard hosts should use ‘-c NUM’ or ‘-n
2325NUM’ instead.  If your script must also run on hosts that support only
2326the obsolete syntax, it is usually simpler to avoid ‘head’, e.g., by
2327using ‘sed 5q’ instead of ‘head -5’.
2328
2329   An exit status of zero indicates success, and a nonzero value
2330indicates failure.
2331
2332
2333File: coreutils.info,  Node: tail invocation,  Next: split invocation,  Prev: head invocation,  Up: Output of parts of files
2334
23355.2 ‘tail’: Output the last part of files
2336=========================================
2337
2338‘tail’ prints the last part (10 lines by default) of each FILE; it reads
2339from standard input if no files are given or when given a FILE of ‘-’.
2340Synopsis:
2341
2342     tail [OPTION]... [FILE]...
2343
2344   If more than one FILE is specified, ‘tail’ prints a one-line header
2345before the output for each FILE, consisting of:
2346
2347     ==> FILE NAME <==
2348
2349   For further processing of tail output, it can be useful to convert
2350the file headers to line prefixes, which can be done like:
2351
2352     tail ... |
2353     awk '
2354       /^==> .* <==$/ {prefix=substr($0,5,length-8)":"; next}
2355       {print prefix$0}
2356     ' | ...
2357
2358   GNU ‘tail’ can output any amount of data (some other versions of
2359‘tail’ cannot).  It also has no ‘-r’ option (print in reverse), since
2360reversing a file is really a different job from printing the end of a
2361file; BSD ‘tail’ (which is the one with ‘-r’) can only reverse files
2362that are at most as large as its buffer, which is typically 32 KiB.  A
2363more reliable and versatile way to reverse files is the GNU ‘tac’
2364command.
2365
2366   The program accepts the following options.  Also see *note Common
2367options::.
2368
2369‘-c [+]NUM’
2370‘--bytes=[+]NUM’
2371     Output the last NUM bytes, instead of final lines.  However, if NUM
2372     is prefixed with a ‘+’, start printing with byte NUM from the start
2373     of each file, instead of from the end.  NUM may be, or may be an
2374     integer optionally followed by, one of the following multiplicative
2375     suffixes:
2376          ‘b’  =>            512 ("blocks")
2377          ‘KB’ =>           1000 (KiloBytes)
2378          ‘K’  =>           1024 (KibiBytes)
2379          ‘MB’ =>      1000*1000 (MegaBytes)
2380          ‘M’  =>      1024*1024 (MebiBytes)
2381          ‘GB’ => 1000*1000*1000 (GigaBytes)
2382          ‘G’  => 1024*1024*1024 (GibiBytes)
2383     and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.  Binary prefixes can be
2384     used, too: ‘KiB’=‘K’, ‘MiB’=‘M’, and so on.
2385
2386‘-f’
2387‘--follow[=HOW]’
2388     Loop forever trying to read more characters at the end of the file,
2389     presumably because the file is growing.  If more than one file is
2390     given, ‘tail’ prints a header whenever it gets output from a
2391     different file, to indicate which file that output is from.
2392
2393     There are two ways to specify how you’d like to track files with
2394     this option, but that difference is noticeable only when a followed
2395     file is removed or renamed.  If you’d like to continue to track the
2396     end of a growing file even after it has been unlinked, use
2397     ‘--follow=descriptor’.  This is the default behavior, but it is not
2398     useful if you’re tracking a log file that may be rotated (removed
2399     or renamed, then reopened).  In that case, use ‘--follow=name’ to
2400     track the named file, perhaps by reopening it periodically to see
2401     if it has been removed and recreated by some other program.  Note
2402     that the inotify-based implementation handles this case without the
2403     need for any periodic reopening.
2404
2405     No matter which method you use, if the tracked file is determined
2406     to have shrunk, ‘tail’ prints a message saying the file has been
2407     truncated and resumes tracking from the start of the file, assuming
2408     it has been truncated to 0, which is the usual truncation operation
2409     for log files.
2410
2411     When a file is removed, ‘tail’’s behavior depends on whether it is
2412     following the name or the descriptor.  When following by name, tail
2413     can detect that a file has been removed and gives a message to that
2414     effect, and if ‘--retry’ has been specified it will continue
2415     checking periodically to see if the file reappears.  When following
2416     a descriptor, tail does not detect that the file has been unlinked
2417     or renamed and issues no message; even though the file may no
2418     longer be accessible via its original name, it may still be
2419     growing.
2420
2421     The option values ‘descriptor’ and ‘name’ may be specified only
2422     with the long form of the option, not with ‘-f’.
2423
2424     The ‘-f’ option is ignored if no FILE operand is specified and
2425     standard input is a FIFO or a pipe.  Likewise, the ‘-f’ option has
2426     no effect for any operand specified as ‘-’, when standard input is
2427     a FIFO or a pipe.
2428
2429     With kernel inotify support, output is triggered by file changes
2430     and is generally very prompt.  Otherwise, ‘tail’ sleeps for one
2431     second between checks— use ‘--sleep-interval=N’ to change that
2432     default—which can make the output appear slightly less responsive
2433     or bursty.  When using tail without inotify support, you can make
2434     it more responsive by using a sub-second sleep interval, e.g., via
2435     an alias like this:
2436
2437          alias tail='tail -s.1'
2438
2439‘-F’
2440     This option is the same as ‘--follow=name --retry’.  That is, tail
2441     will attempt to reopen a file when it is removed.  Should this
2442     fail, tail will keep trying until it becomes accessible again.
2443
2444‘--max-unchanged-stats=N’
2445     When tailing a file by name, if there have been N (default n=5)
2446     consecutive iterations for which the file has not changed, then
2447     ‘open’/‘fstat’ the file to determine if that file name is still
2448     associated with the same device/inode-number pair as before.  When
2449     following a log file that is rotated, this is approximately the
2450     number of seconds between when tail prints the last pre-rotation
2451     lines and when it prints the lines that have accumulated in the new
2452     log file.  This option is meaningful only when polling (i.e.,
2453     without inotify) and when following by name.
2454
2455‘-n [+]NUM’
2456‘--lines=[+]’
2457     Output the last NUM lines.  However, if NUM is prefixed with a ‘+’,
2458     start printing with line NUM from the start of each file, instead
2459     of from the end.  Size multiplier suffixes are the same as with the
2460     ‘-c’ option.
2461
2462‘--pid=PID’
2463     When following by name or by descriptor, you may specify the
2464     process ID, PID, of the sole writer of all FILE arguments.  Then,
2465     shortly after that process terminates, tail will also terminate.
2466     This will work properly only if the writer and the tailing process
2467     are running on the same machine.  For example, to save the output
2468     of a build in a file and to watch the file grow, if you invoke
2469     ‘make’ and ‘tail’ like this then the tail process will stop when
2470     your build completes.  Without this option, you would have had to
2471     kill the ‘tail -f’ process yourself.
2472
2473          $ make >& makerr & tail --pid=$! -f makerr
2474
2475     If you specify a PID that is not in use or that does not correspond
2476     to the process that is writing to the tailed files, then ‘tail’ may
2477     terminate long before any FILEs stop growing or it may not
2478     terminate until long after the real writer has terminated.  Note
2479     that ‘--pid’ cannot be supported on some systems; ‘tail’ will print
2480     a warning if this is the case.
2481
2482‘-q’
2483‘--quiet’
2484‘--silent’
2485     Never print file name headers.
2486
2487‘--retry’
2488     Indefinitely try to open the specified file.  This option is useful
2489     mainly when following (and otherwise issues a warning).
2490
2491     When following by file descriptor (i.e., with
2492     ‘--follow=descriptor’), this option only affects the initial open
2493     of the file, as after a successful open, ‘tail’ will start
2494     following the file descriptor.
2495
2496     When following by name (i.e., with ‘--follow=name’), ‘tail’
2497     infinitely retries to re-open the given files until killed.
2498
2499     Without this option, when ‘tail’ encounters a file that doesn’t
2500     exist or is otherwise inaccessible, it reports that fact and never
2501     checks it again.
2502
2503‘-s NUMBER’
2504‘--sleep-interval=NUMBER’
2505     Change the number of seconds to wait between iterations (the
2506     default is 1.0).  During one iteration, every specified file is
2507     checked to see if it has changed size.  When ‘tail’ uses inotify,
2508     this polling-related option is usually ignored.  However, if you
2509     also specify ‘--pid=P’, ‘tail’ checks whether process P is alive at
2510     least every NUMBER seconds.  The NUMBER must be non-negative and
2511     can be a floating-point number in either the current or the C
2512     locale.  *Note Floating point::.
2513
2514‘-v’
2515‘--verbose’
2516     Always print file name headers.
2517
2518‘-z’
2519‘--zero-terminated’
2520     Delimit items with a zero byte rather than a newline (ASCII LF).
2521     I.e., treat input as items separated by ASCII NUL and terminate
2522     output items with ASCII NUL. This option can be useful in
2523     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
2524     do the same in order to reliably handle arbitrary file names (even
2525     those containing blanks or other special characters).
2526
2527   For compatibility ‘tail’ also supports an obsolete usage ‘tail
2528-[NUM][bcl][f] [FILE]’, which is recognized only if it does not conflict
2529with the usage described above.  This obsolete form uses exactly one
2530option and at most one file.  In the option, NUM is an optional decimal
2531number optionally followed by a size letter (‘b’, ‘c’, ‘l’) to mean
2532count by 512-byte blocks, bytes, or lines, optionally followed by ‘f’
2533which has the same meaning as ‘-f’.
2534
2535   On systems not conforming to POSIX 1003.1-2001, the leading ‘-’ can
2536be replaced by ‘+’ in the traditional option syntax with the same
2537meaning as in counts, and on obsolete systems predating POSIX
25381003.1-2001 traditional usage overrides normal usage when the two
2539conflict.  This behavior can be controlled with the ‘_POSIX2_VERSION’
2540environment variable (*note Standards conformance::).
2541
2542   Scripts intended for use on standard hosts should avoid traditional
2543syntax and should use ‘-c NUM[b]’, ‘-n NUM’, and/or ‘-f’ instead.  If
2544your script must also run on hosts that support only the traditional
2545syntax, you can often rewrite it to avoid problematic usages, e.g., by
2546using ‘sed -n '$p'’ rather than ‘tail -1’.  If that’s not possible, the
2547script can use a test like ‘if tail -c +1 </dev/null >/dev/null 2>&1;
2548then ...’ to decide which syntax to use.
2549
2550   Even if your script assumes the standard behavior, you should still
2551beware usages whose behaviors differ depending on the POSIX version.
2552For example, avoid ‘tail - main.c’, since it might be interpreted as
2553either ‘tail main.c’ or as ‘tail -- - main.c’; avoid ‘tail -c 4’, since
2554it might mean either ‘tail -c4’ or ‘tail -c 10 4’; and avoid ‘tail +4’,
2555since it might mean either ‘tail ./+4’ or ‘tail -n +4’.
2556
2557   An exit status of zero indicates success, and a nonzero value
2558indicates failure.
2559
2560
2561File: coreutils.info,  Node: split invocation,  Next: csplit invocation,  Prev: tail invocation,  Up: Output of parts of files
2562
25635.3 ‘split’: Split a file into pieces.
2564======================================
2565
2566‘split’ creates output files containing consecutive or interleaved
2567sections of INPUT (standard input if none is given or INPUT is ‘-’).
2568Synopsis:
2569
2570     split [OPTION] [INPUT [PREFIX]]
2571
2572   By default, ‘split’ puts 1000 lines of INPUT (or whatever is left
2573over for the last section), into each output file.
2574
2575   The output files’ names consist of PREFIX (‘x’ by default) followed
2576by a group of characters (‘aa’, ‘ab’, ... by default), such that
2577concatenating the output files in traditional sorted order by file name
2578produces the original input file (except ‘-nr/N’).  By default split
2579will initially create files with two generated suffix characters, and
2580will increase this width by two when the next most significant position
2581reaches the last character.  (‘yz’, ‘zaaa’, ‘zaab’, ...).  In this way
2582an arbitrary number of output files are supported, which sort as
2583described above, even in the presence of an ‘--additional-suffix’
2584option.  If the ‘-a’ option is specified and the output file names are
2585exhausted, ‘split’ reports an error without deleting the output files
2586that it did create.
2587
2588   The program accepts the following options.  Also see *note Common
2589options::.
2590
2591‘-l LINES’
2592‘--lines=LINES’
2593     Put LINES lines of INPUT into each output file.  If ‘--separator’
2594     is specified, then LINES determines the number of records.
2595
2596     For compatibility ‘split’ also supports an obsolete option syntax
2597     ‘-LINES’.  New scripts should use ‘-l LINES’ instead.
2598
2599‘-b SIZE’
2600‘--bytes=SIZE’
2601     Put SIZE bytes of INPUT into each output file.  SIZE may be, or may
2602     be an integer optionally followed by, one of the following
2603     multiplicative suffixes:
2604          ‘b’  =>            512 ("blocks")
2605          ‘KB’ =>           1000 (KiloBytes)
2606          ‘K’  =>           1024 (KibiBytes)
2607          ‘MB’ =>      1000*1000 (MegaBytes)
2608          ‘M’  =>      1024*1024 (MebiBytes)
2609          ‘GB’ => 1000*1000*1000 (GigaBytes)
2610          ‘G’  => 1024*1024*1024 (GibiBytes)
2611     and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.  Binary prefixes can be
2612     used, too: ‘KiB’=‘K’, ‘MiB’=‘M’, and so on.
2613
2614‘-C SIZE’
2615‘--line-bytes=SIZE’
2616     Put into each output file as many complete lines of INPUT as
2617     possible without exceeding SIZE bytes.  Individual lines or records
2618     longer than SIZE bytes are broken into multiple files.  SIZE has
2619     the same format as for the ‘--bytes’ option.  If ‘--separator’ is
2620     specified, then LINES determines the number of records.
2621
2622‘--filter=COMMAND’
2623     With this option, rather than simply writing to each output file,
2624     write through a pipe to the specified shell COMMAND for each output
2625     file.  COMMAND should use the $FILE environment variable, which is
2626     set to a different output file name for each invocation of the
2627     command.  For example, imagine that you have a 1TiB compressed file
2628     that, if uncompressed, would be too large to reside on disk, yet
2629     you must split it into individually-compressed pieces of a more
2630     manageable size.  To do that, you might run this command:
2631
2632          xz -dc BIG.xz | split -b200G --filter='xz > $FILE.xz' - big-
2633
2634     Assuming a 10:1 compression ratio, that would create about fifty
2635     20GiB files with names ‘big-aa.xz’, ‘big-ab.xz’, ‘big-ac.xz’, etc.
2636
2637‘-n CHUNKS’
2638‘--number=CHUNKS’
2639
2640     Split INPUT to CHUNKS output files where CHUNKS may be:
2641
2642          N      generate N files based on current size of INPUT
2643          K/N    only output Kth of N to stdout
2644          l/N    generate N files without splitting lines or records
2645          l/K/N  likewise but only output Kth of N to stdout
2646          r/N    like ‘l’ but use round robin distribution
2647          r/K/N  likewise but only output Kth of N to stdout
2648
2649     Any excess bytes remaining after dividing the INPUT into N chunks,
2650     are assigned to the last chunk.  Any excess bytes appearing after
2651     the initial calculation are discarded (except when using ‘r’ mode).
2652
2653     All N files are created even if there are fewer than N lines, or
2654     the INPUT is truncated.
2655
2656     For ‘l’ mode, chunks are approximately INPUT size / N.  The INPUT
2657     is partitioned into N equal sized portions, with the last assigned
2658     any excess.  If a line _starts_ within a partition it is written
2659     completely to the corresponding file.  Since lines or records are
2660     not split even if they overlap a partition, the files written can
2661     be larger or smaller than the partition size, and even empty if a
2662     line/record is so long as to completely overlap the partition.
2663
2664     For ‘r’ mode, the size of INPUT is irrelevant, and so can be a pipe
2665     for example.
2666
2667‘-a LENGTH’
2668‘--suffix-length=LENGTH’
2669     Use suffixes of length LENGTH.  If a LENGTH of 0 is specified, this
2670     is the same as if (any previous) ‘-a’ was not specified, and thus
2671     enables the default behavior, which starts the suffix length at 2,
2672     and unless ‘-n’ or ‘--numeric-suffixes=FROM’ is specified, will
2673     auto increase the length by 2 as required.
2674
2675‘-d’
2676‘--numeric-suffixes[=FROM]’
2677     Use digits in suffixes rather than lower-case letters.  The
2678     numerical suffix counts from FROM if specified, 0 otherwise.
2679
2680     FROM is supported with the long form option, and is used to either
2681     set the initial suffix for a single run, or to set the suffix
2682     offset for independently split inputs, and consequently the auto
2683     suffix length expansion described above is disabled.  Therefore you
2684     may also want to use option ‘-a’ to allow suffixes beyond ‘99’.
2685     Note if option ‘--number’ is specified and the number of files is
2686     less than FROM, a single run is assumed and the minimum suffix
2687     length required is automatically determined.
2688
2689‘-x’
2690‘--hex-suffixes[=FROM]’
2691     Like ‘--numeric-suffixes’, but use hexadecimal numbers (in lower
2692     case).
2693
2694‘--additional-suffix=SUFFIX’
2695     Append an additional SUFFIX to output file names.  SUFFIX must not
2696     contain slash.
2697
2698‘-e’
2699‘--elide-empty-files’
2700     Suppress the generation of zero-length output files.  This can
2701     happen with the ‘--number’ option if a file is (truncated to be)
2702     shorter than the number requested, or if a line is so long as to
2703     completely span a chunk.  The output file sequence numbers, always
2704     run consecutively even when this option is specified.
2705
2706‘-t SEPARATOR’
2707‘--separator=SEPARATOR’
2708     Use character SEPARATOR as the record separator instead of the
2709     default newline character (ASCII LF). To specify ASCII NUL as the
2710     separator, use the two-character string ‘\0’, e.g., ‘split -t
2711     '\0'’.
2712
2713‘-u’
2714‘--unbuffered’
2715     Immediately copy input to output in ‘--number r/...’ mode, which is
2716     a much slower mode of operation.
2717
2718‘--verbose’
2719     Write a diagnostic just before each output file is opened.
2720
2721   An exit status of zero indicates success, and a nonzero value
2722indicates failure.
2723
2724   Here are a few examples to illustrate how the ‘--number’ (‘-n’)
2725option works:
2726
2727   Notice how, by default, one line may be split onto two or more:
2728
2729     $ seq -w 6 10 > k; split -n3 k; head xa?
2730     ==> xaa <==
2731     06
2732     07
2733     ==> xab <==
2734
2735     08
2736     0
2737     ==> xac <==
2738     9
2739     10
2740
2741   Use the "l/" modifier to suppress that:
2742
2743     $ seq -w 6 10 > k; split -nl/3 k; head xa?
2744     ==> xaa <==
2745     06
2746     07
2747
2748     ==> xab <==
2749     08
2750     09
2751
2752     ==> xac <==
2753     10
2754
2755   Use the "r/" modifier to distribute lines in a round-robin fashion:
2756
2757     $ seq -w 6 10 > k; split -nr/3 k; head xa?
2758     ==> xaa <==
2759     06
2760     09
2761
2762     ==> xab <==
2763     07
2764     10
2765
2766     ==> xac <==
2767     08
2768
2769   You can also extract just the Kth chunk.  This extracts and prints
2770just the 7th "chunk" of 33:
2771
2772     $ seq 100 > k; split -nl/7/33 k
2773     20
2774     21
2775     22
2776
2777
2778File: coreutils.info,  Node: csplit invocation,  Prev: split invocation,  Up: Output of parts of files
2779
27805.4 ‘csplit’: Split a file into context-determined pieces
2781=========================================================
2782
2783‘csplit’ creates zero or more output files containing sections of INPUT
2784(standard input if INPUT is ‘-’).  Synopsis:
2785
2786     csplit [OPTION]... INPUT PATTERN...
2787
2788   The contents of the output files are determined by the PATTERN
2789arguments, as detailed below.  An error occurs if a PATTERN argument
2790refers to a nonexistent line of the input file (e.g., if no remaining
2791line matches a given regular expression).  After every PATTERN has been
2792matched, any remaining input is copied into one last output file.
2793
2794   By default, ‘csplit’ prints the number of bytes written to each
2795output file after it has been created.
2796
2797   The types of pattern arguments are:
2798
2799‘N’
2800     Create an output file containing the input up to but not including
2801     line N (a positive integer).  If followed by a repeat count, also
2802     create an output file containing the next N lines of the input file
2803     once for each repeat.
2804
2805‘/REGEXP/[OFFSET]’
2806     Create an output file containing the current line up to (but not
2807     including) the next line of the input file that contains a match
2808     for REGEXP.  The optional OFFSET is an integer.  If it is given,
2809     the input up to (but not including) the matching line plus or minus
2810     OFFSET is put into the output file, and the line after that begins
2811     the next section of input.  Note lines within a negative offset of
2812     a regexp pattern are not matched in subsequent regexp patterns.
2813
2814‘%REGEXP%[OFFSET]’
2815     Like the previous type, except that it does not create an output
2816     file, so that section of the input file is effectively ignored.
2817
2818‘{REPEAT-COUNT}’
2819     Repeat the previous pattern REPEAT-COUNT additional times.  The
2820     REPEAT-COUNT can either be a positive integer or an asterisk,
2821     meaning repeat as many times as necessary until the input is
2822     exhausted.
2823
2824   The output files’ names consist of a prefix (‘xx’ by default)
2825followed by a suffix.  By default, the suffix is an ascending sequence
2826of two-digit decimal numbers from ‘00’ to ‘99’.  In any case,
2827concatenating the output files in sorted order by file name produces the
2828original input file, excluding portions skipped with a %REGEXP% pattern
2829or the ‘--suppress-matched’ option.
2830
2831   By default, if ‘csplit’ encounters an error or receives a hangup,
2832interrupt, quit, or terminate signal, it removes any output files that
2833it has created so far before it exits.
2834
2835   The program accepts the following options.  Also see *note Common
2836options::.
2837
2838‘-f PREFIX’
2839‘--prefix=PREFIX’
2840     Use PREFIX as the output file name prefix.
2841
2842‘-b FORMAT’
2843‘--suffix-format=FORMAT’
2844     Use FORMAT as the output file name suffix.  When this option is
2845     specified, the suffix string must include exactly one
2846     ‘printf(3)’-style conversion specification, possibly including
2847     format specification flags, a field width, a precision
2848     specifications, or all of these kinds of modifiers.  The format
2849     letter must convert a binary unsigned integer argument to readable
2850     form.  The format letters ‘d’ and ‘i’ are aliases for ‘u’, and the
2851     ‘u’, ‘o’, ‘x’, and ‘X’ conversions are allowed.  The entire FORMAT
2852     is given (with the current output file number) to ‘sprintf(3)’ to
2853     form the file name suffixes for each of the individual output files
2854     in turn.  If this option is used, the ‘--digits’ option is ignored.
2855
2856‘-n DIGITS’
2857‘--digits=DIGITS’
2858     Use output file names containing numbers that are DIGITS digits
2859     long instead of the default 2.
2860
2861‘-k’
2862‘--keep-files’
2863     Do not remove output files when errors are encountered.
2864
2865‘--suppress-matched’
2866     Do not output lines matching the specified PATTERN.  I.e., suppress
2867     the boundary line from the start of the second and subsequent
2868     splits.
2869
2870‘-z’
2871‘--elide-empty-files’
2872     Suppress the generation of zero-length output files.  (In cases
2873     where the section delimiters of the input file are supposed to mark
2874     the first lines of each of the sections, the first output file will
2875     generally be a zero-length file unless you use this option.)  The
2876     output file sequence numbers always run consecutively starting from
2877     0, even when this option is specified.
2878
2879‘-s’
2880‘-q’
2881‘--silent’
2882‘--quiet’
2883     Do not print counts of output file sizes.
2884
2885   An exit status of zero indicates success, and a nonzero value
2886indicates failure.
2887
2888   Here is an example of its usage.  First, create an empty directory
2889for the exercise, and cd into it:
2890
2891     $ mkdir d && cd d
2892
2893   Now, split the sequence of 1..14 on lines that end with 0 or 5:
2894
2895     $ seq 14 | csplit - '/[05]$/' '{*}'
2896     8
2897     10
2898     15
2899
2900   Each number printed above is the size of an output file that csplit
2901has just created.  List the names of those output files:
2902
2903     $ ls
2904     xx00  xx01  xx02
2905
2906   Use ‘head’ to show their contents:
2907
2908     $ head xx*
2909     ==> xx00 <==
2910     1
2911     2
2912     3
2913     4
2914
2915     ==> xx01 <==
2916     5
2917     6
2918     7
2919     8
2920     9
2921
2922     ==> xx02 <==
2923     10
2924     11
2925     12
2926     13
2927     14
2928
2929   Example of splitting input by empty lines:
2930
2931     $ csplit --suppress-matched INPUT.TXT '/^$/' '{*}'
2932
2933
2934File: coreutils.info,  Node: Summarizing files,  Next: Operating on sorted files,  Prev: Output of parts of files,  Up: Top
2935
29366 Summarizing files
2937*******************
2938
2939These commands generate just a few numbers representing entire contents
2940of files.
2941
2942* Menu:
2943
2944* wc invocation::               Print newline, word, and byte counts.
2945* sum invocation::              Print checksum and block counts.
2946* cksum invocation::            Print CRC checksum and byte counts.
2947* b2sum invocation::            Print or check BLAKE2 digests.
2948* md5sum invocation::           Print or check MD5 digests.
2949* sha1sum invocation::          Print or check SHA-1 digests.
2950* sha2 utilities::              Print or check SHA-2 digests.
2951
2952
2953File: coreutils.info,  Node: wc invocation,  Next: sum invocation,  Up: Summarizing files
2954
29556.1 ‘wc’: Print newline, word, and byte counts
2956==============================================
2957
2958‘wc’ counts the number of bytes, characters, whitespace-separated words,
2959and newlines in each given FILE, or standard input if none are given or
2960for a FILE of ‘-’.  Synopsis:
2961
2962     wc [OPTION]... [FILE]...
2963
2964   ‘wc’ prints one line of counts for each file, and if the file was
2965given as an argument, it prints the file name following the counts.  If
2966more than one FILE is given, ‘wc’ prints a final line containing the
2967cumulative counts, with the file name ‘total’.  The counts are printed
2968in this order: newlines, words, characters, bytes, maximum line length.
2969Each count is printed right-justified in a field with at least one space
2970between fields so that the numbers and file names normally line up
2971nicely in columns.  The width of the count fields varies depending on
2972the inputs, so you should not depend on a particular field width.
2973However, as a GNU extension, if only one count is printed, it is
2974guaranteed to be printed without leading spaces.
2975
2976   By default, ‘wc’ prints three counts: the newline, words, and byte
2977counts.  Options can specify that only certain counts be printed.
2978Options do not undo others previously given, so
2979
2980     wc --bytes --words
2981
2982prints both the byte counts and the word counts.
2983
2984   With the ‘--max-line-length’ option, ‘wc’ prints the length of the
2985longest line per file, and if there is more than one file it prints the
2986maximum (not the sum) of those lengths.  The line lengths here are
2987measured in screen columns, according to the current locale and assuming
2988tab positions in every 8th column.
2989
2990   The program accepts the following options.  Also see *note Common
2991options::.
2992
2993‘-c’
2994‘--bytes’
2995     Print only the byte counts.
2996
2997‘-m’
2998‘--chars’
2999     Print only the character counts.
3000
3001‘-w’
3002‘--words’
3003     Print only the word counts.
3004
3005‘-l’
3006‘--lines’
3007     Print only the newline counts.
3008
3009‘-L’
3010‘--max-line-length’
3011     Print only the maximum display widths.  Tabs are set at every 8th
3012     column.  Display widths of wide characters are considered.
3013     Non-printable characters are given 0 width.
3014
3015‘--files0-from=FILE’
3016     Disallow processing files named on the command line, and instead
3017     process those named in file FILE; each name being terminated by a
3018     zero byte (ASCII NUL). This is useful when the list of file names
3019     is so long that it may exceed a command line length limitation.  In
3020     such cases, running ‘wc’ via ‘xargs’ is undesirable because it
3021     splits the list into pieces and makes ‘wc’ print a total for each
3022     sublist rather than for the entire list.  One way to produce a list
3023     of ASCII NUL terminated file names is with GNU ‘find’, using its
3024     ‘-print0’ predicate.  If FILE is ‘-’ then the ASCII NUL terminated
3025     file names are read from standard input.
3026
3027     For example, to find the length of the longest line in any ‘.c’ or
3028     ‘.h’ file in the current hierarchy, do this:
3029
3030          find . -name '*.[ch]' -print0 |
3031            wc -L --files0-from=- | tail -n1
3032
3033   An exit status of zero indicates success, and a nonzero value
3034indicates failure.
3035
3036
3037File: coreutils.info,  Node: sum invocation,  Next: cksum invocation,  Prev: wc invocation,  Up: Summarizing files
3038
30396.2 ‘sum’: Print checksum and block counts
3040==========================================
3041
3042‘sum’ computes a 16-bit checksum for each given FILE, or standard input
3043if none are given or for a FILE of ‘-’.  Synopsis:
3044
3045     sum [OPTION]... [FILE]...
3046
3047   ‘sum’ prints the checksum for each FILE followed by the number of
3048blocks in the file (rounded up).  If more than one FILE is given, file
3049names are also printed (by default).  (With the ‘--sysv’ option,
3050corresponding file names are printed when there is at least one file
3051argument.)
3052
3053   By default, GNU ‘sum’ computes checksums using an algorithm
3054compatible with BSD ‘sum’ and prints file sizes in units of 1024-byte
3055blocks.
3056
3057   The program accepts the following options.  Also see *note Common
3058options::.
3059
3060‘-r’
3061     Use the default (BSD compatible) algorithm.  This option is
3062     included for compatibility with the System V ‘sum’.  Unless ‘-s’
3063     was also given, it has no effect.
3064
3065‘-s’
3066‘--sysv’
3067     Compute checksums using an algorithm compatible with System V
3068     ‘sum’’s default, and print file sizes in units of 512-byte blocks.
3069
3070   ‘sum’ is provided for compatibility; the ‘cksum’ program (see next
3071section) is preferable in new applications.
3072
3073   An exit status of zero indicates success, and a nonzero value
3074indicates failure.
3075
3076
3077File: coreutils.info,  Node: cksum invocation,  Next: b2sum invocation,  Prev: sum invocation,  Up: Summarizing files
3078
30796.3 ‘cksum’: Print CRC checksum and byte counts
3080===============================================
3081
3082‘cksum’ computes a cyclic redundancy check (CRC) checksum for each given
3083FILE, or standard input if none are given or for a FILE of ‘-’.
3084Synopsis:
3085
3086     cksum [OPTION]... [FILE]...
3087
3088   ‘cksum’ prints the CRC checksum for each file along with the number
3089of bytes in the file, and the file name unless no arguments were given.
3090
3091   ‘cksum’ is typically used to ensure that files transferred by
3092unreliable means (e.g., netnews) have not been corrupted, by comparing
3093the ‘cksum’ output for the received files with the ‘cksum’ output for
3094the original files (typically given in the distribution).
3095
3096   The CRC algorithm is specified by the POSIX standard.  It is not
3097compatible with the BSD or System V ‘sum’ algorithms (see the previous
3098section); it is more robust.
3099
3100   The only options are ‘--help’ and ‘--version’.  *Note Common
3101options::.
3102
3103   An exit status of zero indicates success, and a nonzero value
3104indicates failure.
3105
3106
3107File: coreutils.info,  Node: b2sum invocation,  Next: md5sum invocation,  Prev: cksum invocation,  Up: Summarizing files
3108
31096.4 ‘b2sum’: Print or check BLAKE2 digests
3110==========================================
3111
3112‘b2sum’ computes a 512-bit checksum for each specified FILE.  The same
3113usage and options as the ‘md5sum’ command are supported.  *Note md5sum
3114invocation::.  In addition ‘b2sum’ supports the following options.
3115
3116‘-l’
3117‘--length’
3118     Change (shorten) the default digest length.  This is specified in
3119     bits and thus must be a multiple of 8.  This option is ignored when
3120     ‘--check’ is specified, as the length is automatically determined
3121     when checking.
3122
3123
3124File: coreutils.info,  Node: md5sum invocation,  Next: sha1sum invocation,  Prev: b2sum invocation,  Up: Summarizing files
3125
31266.5 ‘md5sum’: Print or check MD5 digests
3127========================================
3128
3129‘md5sum’ computes a 128-bit checksum (or “fingerprint” or
3130“message-digest”) for each specified FILE.
3131
3132   Note: The MD5 digest is more reliable than a simple CRC (provided by
3133the ‘cksum’ command) for detecting accidental file corruption, as the
3134chances of accidentally having two files with identical MD5 are
3135vanishingly small.  However, it should not be considered secure against
3136malicious tampering: although finding a file with a given MD5
3137fingerprint is considered infeasible at the moment, it is known how to
3138modify certain files, including digital certificates, so that they
3139appear valid when signed with an MD5 digest.  For more secure hashes,
3140consider using SHA-2, or the newer ‘b2sum’ command.  *Note sha2
3141utilities::.  *Note b2sum invocation::.
3142
3143   If a FILE is specified as ‘-’ or if no files are given ‘md5sum’
3144computes the checksum for the standard input.  ‘md5sum’ can also
3145determine whether a file and checksum are consistent.  Synopsis:
3146
3147     md5sum [OPTION]... [FILE]...
3148
3149   For each FILE, ‘md5sum’ outputs by default, the MD5 checksum, a
3150space, a flag indicating binary or text input mode, and the file name.
3151Binary mode is indicated with ‘*’, text mode with ‘ ’ (space).  Binary
3152mode is the default on systems where it’s significant, otherwise text
3153mode is the default.  Without ‘--zero’, if FILE contains a backslash or
3154newline, the line is started with a backslash, and each problematic
3155character in the file name is escaped with a backslash, making the
3156output unambiguous even in the presence of arbitrary file names.  If
3157FILE is omitted or specified as ‘-’, standard input is read.
3158
3159   The program accepts the following options.  Also see *note Common
3160options::.
3161
3162‘-b’
3163‘--binary’
3164     Treat each input file as binary, by reading it in binary mode and
3165     outputting a ‘*’ flag.  This is the inverse of ‘--text’.  On
3166     systems like GNU that do not distinguish between binary and text
3167     files, this option merely flags each input mode as binary: the MD5
3168     checksum is unaffected.  This option is the default on systems like
3169     MS-DOS that distinguish between binary and text files, except for
3170     reading standard input when standard input is a terminal.
3171
3172‘-c’
3173‘--check’
3174     Read file names and checksum information (not data) from each FILE
3175     (or from stdin if no FILE was specified) and report whether the
3176     checksums match the contents of the named files.  The input to this
3177     mode of ‘md5sum’ is usually the output of a prior,
3178     checksum-generating run of ‘md5sum’.  Three input formats are
3179     supported.  Either the default output format described above, the
3180     ‘--tag’ output format, or the BSD reversed mode format which is
3181     similar to the default mode, but doesn’t use a character to
3182     distinguish binary and text modes.  Output with ‘--zero’ enabled is
3183     not supported by ‘--check’.
3184
3185     For each such line, ‘md5sum’ reads the named file and computes its
3186     MD5 checksum.  Then, if the computed message digest does not match
3187     the one on the line with the file name, the file is noted as having
3188     failed the test.  Otherwise, the file passes the test.  By default,
3189     for each valid line, one line is written to standard output
3190     indicating whether the named file passed the test.  After all
3191     checks have been performed, if there were any failures, a warning
3192     is issued to standard error.  Use the ‘--status’ option to inhibit
3193     that output.  If any listed file cannot be opened or read, if any
3194     valid line has an MD5 checksum inconsistent with the associated
3195     file, or if no valid line is found, ‘md5sum’ exits with nonzero
3196     status.  Otherwise, it exits successfully.
3197
3198‘--ignore-missing’
3199     This option is useful only when verifying checksums.  When
3200     verifying checksums, don’t fail or report any status for missing
3201     files.  This is useful when verifying a subset of downloaded files
3202     given a larger list of checksums.
3203
3204‘--quiet’
3205     This option is useful only when verifying checksums.  When
3206     verifying checksums, don’t generate an ’OK’ message per
3207     successfully checked file.  Files that fail the verification are
3208     reported in the default one-line-per-file format.  If there is any
3209     checksum mismatch, print a warning summarizing the failures to
3210     standard error.
3211
3212‘--status’
3213     This option is useful only when verifying checksums.  When
3214     verifying checksums, don’t generate the default one-line-per-file
3215     diagnostic and don’t output the warning summarizing any failures.
3216     Failures to open or read a file still evoke individual diagnostics
3217     to standard error.  If all listed files are readable and are
3218     consistent with the associated MD5 checksums, exit successfully.
3219     Otherwise exit with a status code indicating there was a failure.
3220
3221‘--tag’
3222     Output BSD style checksums, which indicate the checksum algorithm
3223     used.  As a GNU extension, if ‘--zero’ is not used, file names with
3224     problematic characters are escaped as described above, with the
3225     same escaping indicator of ‘\’ at the start of the line, being
3226     used.  The ‘--tag’ option implies binary mode, and is disallowed
3227     with ‘--text’ mode as supporting that would unnecessarily
3228     complicate the output format, while providing little benefit.
3229
3230‘-t’
3231‘--text’
3232     Treat each input file as text, by reading it in text mode and
3233     outputting a ‘ ’ flag.  This is the inverse of ‘--binary’.  This
3234     option is the default on systems like GNU that do not distinguish
3235     between binary and text files.  On other systems, it is the default
3236     for reading standard input when standard input is a terminal.  This
3237     mode is never defaulted to if ‘--tag’ is used.
3238
3239‘-w’
3240‘--warn’
3241     When verifying checksums, warn about improperly formatted MD5
3242     checksum lines.  This option is useful only if all but a few lines
3243     in the checked input are valid.
3244
3245‘--strict’
3246     When verifying checksums, if one or more input line is invalid,
3247     exit nonzero after all warnings have been issued.
3248
3249‘-z’
3250‘--zero’
3251     Output a zero byte (ASCII NUL) at the end of each line, rather than
3252     a newline.  This option enables other programs to parse the output
3253     even when that output would contain data with embedded newlines.
3254     Also file name escaping is not used.
3255
3256   An exit status of zero indicates success, and a nonzero value
3257indicates failure.
3258
3259
3260File: coreutils.info,  Node: sha1sum invocation,  Next: sha2 utilities,  Prev: md5sum invocation,  Up: Summarizing files
3261
32626.6 ‘sha1sum’: Print or check SHA-1 digests
3263===========================================
3264
3265‘sha1sum’ computes a 160-bit checksum for each specified FILE.  The
3266usage and options of this command are precisely the same as for
3267‘md5sum’.  *Note md5sum invocation::.
3268
3269   Note: The SHA-1 digest is more reliable than a simple CRC (provided
3270by the ‘cksum’ command) for detecting accidental file corruption, as the
3271chances of accidentally having two files with identical SHA-1 are
3272vanishingly small.  However, it should not be considered secure against
3273malicious tampering: although finding a file with a given SHA-1
3274fingerprint is considered infeasible at the moment, it is known how to
3275modify certain files, including digital certificates, so that they
3276appear valid when signed with an SHA-1 digest.  For more secure hashes,
3277consider using SHA-2, or the newer ‘b2sum’ command.  *Note sha2
3278utilities::.  *Note b2sum invocation::.
3279
3280
3281File: coreutils.info,  Node: sha2 utilities,  Prev: sha1sum invocation,  Up: Summarizing files
3282
32836.7 sha2 utilities: Print or check SHA-2 digests
3284================================================
3285
3286The commands ‘sha224sum’, ‘sha256sum’, ‘sha384sum’ and ‘sha512sum’
3287compute checksums of various lengths (respectively 224, 256, 384 and 512
3288bits), collectively known as the SHA-2 hashes.  The usage and options of
3289these commands are precisely the same as for ‘md5sum’ and ‘sha1sum’.
3290*Note md5sum invocation::.
3291
3292
3293File: coreutils.info,  Node: Operating on sorted files,  Next: Operating on fields,  Prev: Summarizing files,  Up: Top
3294
32957 Operating on sorted files
3296***************************
3297
3298These commands work with (or produce) sorted files.
3299
3300* Menu:
3301
3302* sort invocation::             Sort text files.
3303* shuf invocation::             Shuffle text files.
3304* uniq invocation::             Uniquify files.
3305* comm invocation::             Compare two sorted files line by line.
3306* ptx invocation::              Produce a permuted index of file contents.
3307* tsort invocation::            Topological sort.
3308
3309
3310File: coreutils.info,  Node: sort invocation,  Next: shuf invocation,  Up: Operating on sorted files
3311
33127.1 ‘sort’: Sort text files
3313===========================
3314
3315‘sort’ sorts, merges, or compares all the lines from the given files, or
3316standard input if none are given or for a FILE of ‘-’.  By default,
3317‘sort’ writes the results to standard output.  Synopsis:
3318
3319     sort [OPTION]... [FILE]...
3320
3321   Many options affect how ‘sort’ compares lines; if the results are
3322unexpected, try the ‘--debug’ option to see what happened.  A pair of
3323lines is compared as follows: ‘sort’ compares each pair of fields (see
3324‘--key’), in the order specified on the command line, according to the
3325associated ordering options, until a difference is found or no fields
3326are left.  If no key fields are specified, ‘sort’ uses a default key of
3327the entire line.  Finally, as a last resort when all keys compare equal,
3328‘sort’ compares entire lines as if no ordering options other than
3329‘--reverse’ (‘-r’) were specified.  The ‘--stable’ (‘-s’) option
3330disables this “last-resort comparison” so that lines in which all fields
3331compare equal are left in their original relative order.  The ‘--unique’
3332(‘-u’) option also disables the last-resort comparison.
3333
3334   Unless otherwise specified, all comparisons use the character
3335collating sequence specified by the ‘LC_COLLATE’ locale.(1)  A line’s
3336trailing newline is not part of the line for comparison purposes.  If
3337the final byte of an input file is not a newline, GNU ‘sort’ silently
3338supplies one.  GNU ‘sort’ (as specified for all GNU utilities) has no
3339limit on input line length or restrictions on bytes allowed within
3340lines.
3341
3342   ‘sort’ has three modes of operation: sort (the default), merge, and
3343check for sortedness.  The following options change the operation mode:
3344
3345‘-c’
3346‘--check’
3347‘--check=diagnose-first’
3348     Check whether the given file is already sorted: if it is not all
3349     sorted, print a diagnostic containing the first out-of-order line
3350     and exit with a status of 1.  Otherwise, exit successfully.  At
3351     most one input file can be given.
3352
3353‘-C’
3354‘--check=quiet’
3355‘--check=silent’
3356     Exit successfully if the given file is already sorted, and exit
3357     with status 1 otherwise.  At most one input file can be given.
3358     This is like ‘-c’, except it does not print a diagnostic.
3359
3360‘-m’
3361‘--merge’
3362     Merge the given files by sorting them as a group.  Each input file
3363     must always be individually sorted.  It always works to sort
3364     instead of merge; merging is provided because it is faster, in the
3365     case where it works.
3366
3367   Exit status:
3368
3369     0 if no error occurred
3370     1 if invoked with ‘-c’ or ‘-C’ and the input is not sorted
3371     2 if an error occurred
3372
3373   If the environment variable ‘TMPDIR’ is set, ‘sort’ uses its value as
3374the directory for temporary files instead of ‘/tmp’.  The
3375‘--temporary-directory’ (‘-T’) option in turn overrides the environment
3376variable.
3377
3378   The following options affect the ordering of output lines.  They may
3379be specified globally or as part of a specific key field.  If no key
3380fields are specified, global options apply to comparison of entire
3381lines; otherwise the global options are inherited by key fields that do
3382not specify any special options of their own.  In pre-POSIX versions of
3383‘sort’, global options affect only later key fields, so portable shell
3384scripts should specify global options first.
3385
3386‘-b’
3387‘--ignore-leading-blanks’
3388     Ignore leading blanks when finding sort keys in each line.  By
3389     default a blank is a space or a tab, but the ‘LC_CTYPE’ locale can
3390     change this.  Note blanks may be ignored by your locale’s collating
3391     rules, but without this option they will be significant for
3392     character positions specified in keys with the ‘-k’ option.
3393
3394‘-d’
3395‘--dictionary-order’
3396     Sort in “phone directory” order: ignore all characters except
3397     letters, digits and blanks when sorting.  By default letters and
3398     digits are those of ASCII and a blank is a space or a tab, but the
3399     ‘LC_CTYPE’ locale can change this.
3400
3401‘-f’
3402‘--ignore-case’
3403     Fold lowercase characters into the equivalent uppercase characters
3404     when comparing so that, for example, ‘b’ and ‘B’ sort as equal.
3405     The ‘LC_CTYPE’ locale determines character types.  When used with
3406     ‘--unique’ those lower case equivalent lines are thrown away.
3407     (There is currently no way to throw away the upper case equivalent
3408     instead.  (Any ‘--reverse’ given would only affect the final
3409     result, after the throwing away.))
3410
3411‘-g’
3412‘--general-numeric-sort’
3413‘--sort=general-numeric’
3414     Sort numerically, converting a prefix of each line to a long
3415     double-precision floating point number.  *Note Floating point::.
3416     Do not report overflow, underflow, or conversion errors.  Use the
3417     following collating sequence:
3418
3419        • Lines that do not start with numbers (all considered to be
3420          equal).
3421        • NaNs (“Not a Number” values, in IEEE floating point
3422          arithmetic) in a consistent but machine-dependent order.
3423        • Minus infinity.
3424        • Finite numbers in ascending numeric order (with -0 and +0
3425          equal).
3426        • Plus infinity.
3427
3428     Use this option only if there is no alternative; it is much slower
3429     than ‘--numeric-sort’ (‘-n’) and it can lose information when
3430     converting to floating point.
3431
3432‘-h’
3433‘--human-numeric-sort’
3434‘--sort=human-numeric’
3435     Sort numerically, first by numeric sign (negative, zero, or
3436     positive); then by SI suffix (either empty, or ‘k’ or ‘K’, or one
3437     of ‘MGTPEZY’, in that order; *note Block size::); and finally by
3438     numeric value.  For example, ‘1023M’ sorts before ‘1G’ because ‘M’
3439     (mega) precedes ‘G’ (giga) as an SI suffix.  This option sorts
3440     values that are consistently scaled to the nearest suffix,
3441     regardless of whether suffixes denote powers of 1000 or 1024, and
3442     it therefore sorts the output of any single invocation of the ‘df’,
3443     ‘du’, or ‘ls’ commands that are invoked with their
3444     ‘--human-readable’ or ‘--si’ options.  The syntax for numbers is
3445     the same as for the ‘--numeric-sort’ option; the SI suffix must
3446     immediately follow the number.  Note also the ‘numfmt’ command,
3447     which can be used to reformat numbers to human format _after_ the
3448     sort, thus often allowing sort to operate on more accurate numbers.
3449
3450‘-i’
3451‘--ignore-nonprinting’
3452     Ignore nonprinting characters.  The ‘LC_CTYPE’ locale determines
3453     character types.  This option has no effect if the stronger
3454     ‘--dictionary-order’ (‘-d’) option is also given.
3455
3456‘-M’
3457‘--month-sort’
3458‘--sort=month’
3459     An initial string, consisting of any amount of blanks, followed by
3460     a month name abbreviation, is folded to UPPER case and compared in
3461     the order ‘JAN’ < ‘FEB’ < ... < ‘DEC’.  Invalid names compare low
3462     to valid names.  The ‘LC_TIME’ locale category determines the month
3463     spellings.  By default a blank is a space or a tab, but the
3464     ‘LC_CTYPE’ locale can change this.
3465
3466‘-n’
3467‘--numeric-sort’
3468‘--sort=numeric’
3469     Sort numerically.  The number begins each line and consists of
3470     optional blanks, an optional ‘-’ sign, and zero or more digits
3471     possibly separated by thousands separators, optionally followed by
3472     a decimal-point character and zero or more digits.  An empty number
3473     is treated as ‘0’.  The ‘LC_NUMERIC’ locale specifies the
3474     decimal-point character and thousands separator.  By default a
3475     blank is a space or a tab, but the ‘LC_CTYPE’ locale can change
3476     this.
3477
3478     Comparison is exact; there is no rounding error.
3479
3480     Neither a leading ‘+’ nor exponential notation is recognized.  To
3481     compare such strings numerically, use the ‘--general-numeric-sort’
3482     (‘-g’) option.
3483
3484‘-V’
3485‘--version-sort’
3486     Sort by version name and number.  It behaves like a standard sort,
3487     except that each sequence of decimal digits is treated numerically
3488     as an index/version number.  (*Note Version sort ordering::.)
3489
3490‘-r’
3491‘--reverse’
3492     Reverse the result of comparison, so that lines with greater key
3493     values appear earlier in the output instead of later.
3494
3495‘-R’
3496‘--random-sort’
3497‘--sort=random’
3498     Sort by hashing the input keys and then sorting the hash values.
3499     Choose the hash function at random, ensuring that it is free of
3500     collisions so that differing keys have differing hash values.  This
3501     is like a random permutation of the inputs (*note shuf
3502     invocation::), except that keys with the same value sort together.
3503
3504     If multiple random sort fields are specified, the same random hash
3505     function is used for all fields.  To use different random hash
3506     functions for different fields, you can invoke ‘sort’ more than
3507     once.
3508
3509     The choice of hash function is affected by the ‘--random-source’
3510     option.
3511
3512   Other options are:
3513
3514‘--compress-program=PROG’
3515     Compress any temporary files with the program PROG.
3516
3517     With no arguments, PROG must compress standard input to standard
3518     output, and when given the ‘-d’ option it must decompress standard
3519     input to standard output.
3520
3521     Terminate with an error if PROG exits with nonzero status.
3522
3523     White space and the backslash character should not appear in PROG;
3524     they are reserved for future use.
3525
3526‘--files0-from=FILE’
3527     Disallow processing files named on the command line, and instead
3528     process those named in file FILE; each name being terminated by a
3529     zero byte (ASCII NUL). This is useful when the list of file names
3530     is so long that it may exceed a command line length limitation.  In
3531     such cases, running ‘sort’ via ‘xargs’ is undesirable because it
3532     splits the list into pieces and makes ‘sort’ print sorted output
3533     for each sublist rather than for the entire list.  One way to
3534     produce a list of ASCII NUL terminated file names is with GNU
3535     ‘find’, using its ‘-print0’ predicate.  If FILE is ‘-’ then the
3536     ASCII NUL terminated file names are read from standard input.
3537
3538‘-k POS1[,POS2]’
3539‘--key=POS1[,POS2]’
3540     Specify a sort field that consists of the part of the line between
3541     POS1 and POS2 (or the end of the line, if POS2 is omitted),
3542     _inclusive_.
3543
3544     In its simplest form POS specifies a field number (starting with
3545     1), with fields being separated by runs of blank characters, and by
3546     default those blanks being included in the comparison at the start
3547     of each field.  To adjust the handling of blank characters see the
3548     ‘-b’ and ‘-t’ options.
3549
3550     More generally, each POS has the form ‘F[.C][OPTS]’, where F is the
3551     number of the field to use, and C is the number of the first
3552     character from the beginning of the field.  Fields and character
3553     positions are numbered starting with 1; a character position of
3554     zero in POS2 indicates the field’s last character.  If ‘.C’ is
3555     omitted from POS1, it defaults to 1 (the beginning of the field);
3556     if omitted from POS2, it defaults to 0 (the end of the field).
3557     OPTS are ordering options, allowing individual keys to be sorted
3558     according to different rules; see below for details.  Keys can span
3559     multiple fields.
3560
3561     Example: To sort on the second field, use ‘--key=2,2’ (‘-k 2,2’).
3562     See below for more notes on keys and more examples.  See also the
3563     ‘--debug’ option to help determine the part of the line being used
3564     in the sort.
3565
3566‘--debug’
3567     Highlight the portion of each line used for sorting.  Also issue
3568     warnings about questionable usage to stderr.
3569
3570‘--batch-size=NMERGE’
3571     Merge at most NMERGE inputs at once.
3572
3573     When ‘sort’ has to merge more than NMERGE inputs, it merges them in
3574     groups of NMERGE, saving the result in a temporary file, which is
3575     then used as an input in a subsequent merge.
3576
3577     A large value of NMERGE may improve merge performance and decrease
3578     temporary storage utilization at the expense of increased memory
3579     usage and I/O.  Conversely a small value of NMERGE may reduce
3580     memory requirements and I/O at the expense of temporary storage
3581     consumption and merge performance.
3582
3583     The value of NMERGE must be at least 2.  The default value is
3584     currently 16, but this is implementation-dependent and may change
3585     in the future.
3586
3587     The value of NMERGE may be bounded by a resource limit for open
3588     file descriptors.  The commands ‘ulimit -n’ or ‘getconf OPEN_MAX’
3589     may display limits for your systems; these limits may be modified
3590     further if your program already has some files open, or if the
3591     operating system has other limits on the number of open files.  If
3592     the value of NMERGE exceeds the resource limit, ‘sort’ silently
3593     uses a smaller value.
3594
3595‘-o OUTPUT-FILE’
3596‘--output=OUTPUT-FILE’
3597     Write output to OUTPUT-FILE instead of standard output.  Normally,
3598     ‘sort’ reads all input before opening OUTPUT-FILE, so you can sort
3599     a file in place by using commands like ‘sort -o F F’ and ‘cat F |
3600     sort -o F’.  However, it is often safer to output to an
3601     otherwise-unused file, as data may be lost if the system crashes or
3602     ‘sort’ encounters an I/O or other serious error while a file is
3603     being sorted in place.  Also, ‘sort’ with ‘--merge’ (‘-m’) can open
3604     the output file before reading all input, so a command like ‘cat F
3605     | sort -m -o F - G’ is not safe as ‘sort’ might start writing ‘F’
3606     before ‘cat’ is done reading it.
3607
3608     On newer systems, ‘-o’ cannot appear after an input file if
3609     ‘POSIXLY_CORRECT’ is set, e.g., ‘sort F -o F’.  Portable scripts
3610     should specify ‘-o OUTPUT-FILE’ before any input files.
3611
3612‘--random-source=FILE’
3613     Use FILE as a source of random data used to determine which random
3614     hash function to use with the ‘-R’ option.  *Note Random sources::.
3615
3616‘-s’
3617‘--stable’
3618
3619     Make ‘sort’ stable by disabling its last-resort comparison.  This
3620     option has no effect if no fields or global ordering options other
3621     than ‘--reverse’ (‘-r’) are specified.
3622
3623‘-S SIZE’
3624‘--buffer-size=SIZE’
3625     Use a main-memory sort buffer of the given SIZE.  By default, SIZE
3626     is in units of 1024 bytes.  Appending ‘%’ causes SIZE to be
3627     interpreted as a percentage of physical memory.  Appending ‘K’
3628     multiplies SIZE by 1024 (the default), ‘M’ by 1,048,576, ‘G’ by
3629     1,073,741,824, and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.
3630     Appending ‘b’ causes SIZE to be interpreted as a byte count, with
3631     no multiplication.
3632
3633     This option can improve the performance of ‘sort’ by causing it to
3634     start with a larger or smaller sort buffer than the default.
3635     However, this option affects only the initial buffer size.  The
3636     buffer grows beyond SIZE if ‘sort’ encounters input lines larger
3637     than SIZE.
3638
3639‘-t SEPARATOR’
3640‘--field-separator=SEPARATOR’
3641     Use character SEPARATOR as the field separator when finding the
3642     sort keys in each line.  By default, fields are separated by the
3643     empty string between a non-blank character and a blank character.
3644     By default a blank is a space or a tab, but the ‘LC_CTYPE’ locale
3645     can change this.
3646
3647     That is, given the input line ‘ foo bar’, ‘sort’ breaks it into
3648     fields ‘ foo’ and ‘ bar’.  The field separator is not considered to
3649     be part of either the field preceding or the field following, so
3650     with ‘sort -t " "’ the same input line has three fields: an empty
3651     field, ‘foo’, and ‘bar’.  However, fields that extend to the end of
3652     the line, as ‘-k 2’, or fields consisting of a range, as ‘-k 2,3’,
3653     retain the field separators present between the endpoints of the
3654     range.
3655
3656     To specify ASCII NUL as the field separator, use the two-character
3657     string ‘\0’, e.g., ‘sort -t '\0'’.
3658
3659‘-T TEMPDIR’
3660‘--temporary-directory=TEMPDIR’
3661     Use directory TEMPDIR to store temporary files, overriding the
3662     ‘TMPDIR’ environment variable.  If this option is given more than
3663     once, temporary files are stored in all the directories given.  If
3664     you have a large sort or merge that is I/O-bound, you can often
3665     improve performance by using this option to specify directories on
3666     different disks and controllers.
3667
3668‘--parallel=N’
3669     Set the number of sorts run in parallel to N.  By default, N is set
3670     to the number of available processors, but limited to 8, as there
3671     are diminishing performance gains after that.  Note also that using
3672     N threads increases the memory usage by a factor of log N.  Also
3673     see *note nproc invocation::.
3674
3675‘-u’
3676‘--unique’
3677
3678     Normally, output only the first of a sequence of lines that compare
3679     equal.  For the ‘--check’ (‘-c’ or ‘-C’) option, check that no pair
3680     of consecutive lines compares equal.
3681
3682     This option also disables the default last-resort comparison.
3683
3684     The commands ‘sort -u’ and ‘sort | uniq’ are equivalent, but this
3685     equivalence does not extend to arbitrary ‘sort’ options.  For
3686     example, ‘sort -n -u’ inspects only the value of the initial
3687     numeric string when checking for uniqueness, whereas ‘sort -n |
3688     uniq’ inspects the entire line.  *Note uniq invocation::.
3689
3690‘-z’
3691‘--zero-terminated’
3692     Delimit items with a zero byte rather than a newline (ASCII LF).
3693     I.e., treat input as items separated by ASCII NUL and terminate
3694     output items with ASCII NUL. This option can be useful in
3695     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
3696     do the same in order to reliably handle arbitrary file names (even
3697     those containing blanks or other special characters).
3698
3699   Historical (BSD and System V) implementations of ‘sort’ have differed
3700in their interpretation of some options, particularly ‘-b’, ‘-f’, and
3701‘-n’.  GNU sort follows the POSIX behavior, which is usually (but not
3702always!)  like the System V behavior.  According to POSIX, ‘-n’ no
3703longer implies ‘-b’.  For consistency, ‘-M’ has been changed in the same
3704way.  This may affect the meaning of character positions in field
3705specifications in obscure cases.  The only fix is to add an explicit
3706‘-b’.
3707
3708   A position in a sort field specified with ‘-k’ may have any of the
3709option letters ‘MbdfghinRrV’ appended to it, in which case no global
3710ordering options are inherited by that particular field.  The ‘-b’
3711option may be independently attached to either or both of the start and
3712end positions of a field specification, and if it is inherited from the
3713global options it will be attached to both.  If input lines can contain
3714leading or adjacent blanks and ‘-t’ is not used, then ‘-k’ is typically
3715combined with ‘-b’ or an option that implicitly ignores leading blanks
3716(‘Mghn’) as otherwise the varying numbers of leading blanks in fields
3717can cause confusing results.
3718
3719   If the start position in a sort field specifier falls after the end
3720of the line or after the end field, the field is empty.  If the ‘-b’
3721option was specified, the ‘.C’ part of a field specification is counted
3722from the first nonblank character of the field.
3723
3724   On systems not conforming to POSIX 1003.1-2001, ‘sort’ supports a
3725traditional origin-zero syntax ‘+POS1 [-POS2]’ for specifying sort keys.
3726The traditional command ‘sort +A.X -B.Y’ is equivalent to ‘sort -k
3727A+1.X+1,B’ if Y is ‘0’ or absent, otherwise it is equivalent to ‘sort -k
3728A+1.X+1,B+1.Y’.
3729
3730   This traditional behavior can be controlled with the
3731‘_POSIX2_VERSION’ environment variable (*note Standards conformance::);
3732it can also be enabled when ‘POSIXLY_CORRECT’ is not set by using the
3733traditional syntax with ‘-POS2’ present.
3734
3735   Scripts intended for use on standard hosts should avoid traditional
3736syntax and should use ‘-k’ instead.  For example, avoid ‘sort +2’, since
3737it might be interpreted as either ‘sort ./+2’ or ‘sort -k 3’.  If your
3738script must also run on hosts that support only the traditional syntax,
3739it can use a test like ‘if sort -k 1 </dev/null >/dev/null 2>&1; then
3740...’ to decide which syntax to use.
3741
3742   Here are some examples to illustrate various combinations of options.
3743
3744   • Sort in descending (reverse) numeric order.
3745
3746          sort -n -r
3747
3748   • Run no more than 4 sorts concurrently, using a buffer size of 10M.
3749
3750          sort --parallel=4 -S 10M
3751
3752   • Sort alphabetically, omitting the first and second fields and the
3753     blanks at the start of the third field.  This uses a single key
3754     composed of the characters beginning at the start of the first
3755     nonblank character in field three and extending to the end of each
3756     line.
3757
3758          sort -k 3b
3759
3760   • Sort numerically on the second field and resolve ties by sorting
3761     alphabetically on the third and fourth characters of field five.
3762     Use ‘:’ as the field delimiter.
3763
3764          sort -t : -k 2,2n -k 5.3,5.4
3765
3766     Note that if you had written ‘-k 2n’ instead of ‘-k 2,2n’ ‘sort’
3767     would have used all characters beginning in the second field and
3768     extending to the end of the line as the primary _numeric_ key.  For
3769     the large majority of applications, treating keys spanning more
3770     than one field as numeric will not do what you expect.
3771
3772     Also note that the ‘n’ modifier was applied to the field-end
3773     specifier for the first key.  It would have been equivalent to
3774     specify ‘-k 2n,2’ or ‘-k 2n,2n’.  All modifiers except ‘b’ apply to
3775     the associated _field_, regardless of whether the modifier
3776     character is attached to the field-start and/or the field-end part
3777     of the key specifier.
3778
3779   • Sort the password file on the fifth field and ignore any leading
3780     blanks.  Sort lines with equal values in field five on the numeric
3781     user ID in field three.  Fields are separated by ‘:’.
3782
3783          sort -t : -k 5b,5 -k 3,3n /etc/passwd
3784          sort -t : -n -k 5b,5 -k 3,3 /etc/passwd
3785          sort -t : -b -k 5,5 -k 3,3n /etc/passwd
3786
3787     These three commands have equivalent effect.  The first specifies
3788     that the first key’s start position ignores leading blanks and the
3789     second key is sorted numerically.  The other two commands rely on
3790     global options being inherited by sort keys that lack modifiers.
3791     The inheritance works in this case because ‘-k 5b,5b’ and ‘-k 5b,5’
3792     are equivalent, as the location of a field-end lacking a ‘.C’
3793     character position is not affected by whether initial blanks are
3794     skipped.
3795
3796   • Sort a set of log files, primarily by IPv4 address and secondarily
3797     by timestamp.  If two lines’ primary and secondary keys are
3798     identical, output the lines in the same order that they were input.
3799     The log files contain lines that look like this:
3800
3801          4.150.156.3 - - [01/Apr/2004:06:31:51 +0000] message 1
3802          211.24.3.231 - - [24/Apr/2004:20:17:39 +0000] message 2
3803
3804     Fields are separated by exactly one space.  Sort IPv4 addresses
3805     lexicographically, e.g., 212.61.52.2 sorts before 212.129.233.201
3806     because 61 is less than 129.
3807
3808          sort -s -t ' ' -k 4.9n -k 4.5M -k 4.2n -k 4.14,4.21 file*.log |
3809          sort -s -t '.' -k 1,1n -k 2,2n -k 3,3n -k 4,4n
3810
3811     This example cannot be done with a single ‘sort’ invocation, since
3812     IPv4 address components are separated by ‘.’ while dates come just
3813     after a space.  So it is broken down into two invocations of
3814     ‘sort’: the first sorts by timestamp and the second by IPv4
3815     address.  The timestamp is sorted by year, then month, then day,
3816     and finally by hour-minute-second field, using ‘-k’ to isolate each
3817     field.  Except for hour-minute-second there’s no need to specify
3818     the end of each key field, since the ‘n’ and ‘M’ modifiers sort
3819     based on leading prefixes that cannot cross field boundaries.  The
3820     IPv4 addresses are sorted lexicographically.  The second sort uses
3821     ‘-s’ so that ties in the primary key are broken by the secondary
3822     key; the first sort uses ‘-s’ so that the combination of the two
3823     sorts is stable.
3824
3825   • Generate a tags file in case-insensitive sorted order.
3826
3827          find src -type f -print0 | sort -z -f | xargs -0 etags --append
3828
3829     The use of ‘-print0’, ‘-z’, and ‘-0’ in this case means that file
3830     names that contain blanks or other special characters are not
3831     broken up by the sort operation.
3832
3833   • Use the common DSU, Decorate Sort Undecorate idiom to sort lines
3834     according to their length.
3835
3836          awk '{print length, $0}' /etc/passwd | sort -n | cut -f2- -d' '
3837
3838     In general this technique can be used to sort data that the ‘sort’
3839     command does not support, or is inefficient at, sorting directly.
3840
3841   • Shuffle a list of directories, but preserve the order of files
3842     within each directory.  For instance, one could use this to
3843     generate a music playlist in which albums are shuffled but the
3844     songs of each album are played in order.
3845
3846          ls */* | sort -t / -k 1,1R -k 2,2
3847
3848   ---------- Footnotes ----------
3849
3850   (1) If you use a non-POSIX locale (e.g., by setting ‘LC_ALL’ to
3851‘en_US’), then ‘sort’ may produce output that is sorted differently than
3852you’re accustomed to.  In that case, set the ‘LC_ALL’ environment
3853variable to ‘C’.  Note that setting only ‘LC_COLLATE’ has two problems.
3854First, it is ineffective if ‘LC_ALL’ is also set.  Second, it has
3855undefined behavior if ‘LC_CTYPE’ (or ‘LANG’, if ‘LC_CTYPE’ is unset) is
3856set to an incompatible value.  For example, you get undefined behavior
3857if ‘LC_CTYPE’ is ‘ja_JP.PCK’ but ‘LC_COLLATE’ is ‘en_US.UTF-8’.
3858
3859
3860File: coreutils.info,  Node: shuf invocation,  Next: uniq invocation,  Prev: sort invocation,  Up: Operating on sorted files
3861
38627.2 ‘shuf’: Shuffling text
3863==========================
3864
3865‘shuf’ shuffles its input by outputting a random permutation of its
3866input lines.  Each output permutation is equally likely.  Synopses:
3867
3868     shuf [OPTION]... [FILE]
3869     shuf -e [OPTION]... [ARG]...
3870     shuf -i LO-HI [OPTION]...
3871
3872   ‘shuf’ has three modes of operation that affect where it obtains its
3873input lines.  By default, it reads lines from standard input.  The
3874following options change the operation mode:
3875
3876‘-e’
3877‘--echo’
3878     Treat each command-line operand as an input line.
3879
3880‘-i LO-HI’
3881‘--input-range=LO-HI’
3882     Act as if input came from a file containing the range of unsigned
3883     decimal integers LO...HI, one per line.
3884
3885   ‘shuf’’s other options can affect its behavior in all operation
3886modes:
3887
3888‘-n COUNT’
3889‘--head-count=COUNT’
3890     Output at most COUNT lines.  By default, all input lines are
3891     output.
3892
3893‘-o OUTPUT-FILE’
3894‘--output=OUTPUT-FILE’
3895     Write output to OUTPUT-FILE instead of standard output.  ‘shuf’
3896     reads all input before opening OUTPUT-FILE, so you can safely
3897     shuffle a file in place by using commands like ‘shuf -o F <F’ and
3898     ‘cat F | shuf -o F’.
3899
3900‘--random-source=FILE’
3901     Use FILE as a source of random data used to determine which
3902     permutation to generate.  *Note Random sources::.
3903
3904‘-r’
3905‘--repeat’
3906     Repeat output values, that is, select with replacement.  With this
3907     option the output is not a permutation of the input; instead, each
3908     output line is randomly chosen from all the inputs.  This option is
3909     typically combined with ‘--head-count’; if ‘--head-count’ is not
3910     given, ‘shuf’ repeats indefinitely.
3911
3912‘-z’
3913‘--zero-terminated’
3914     Delimit items with a zero byte rather than a newline (ASCII LF).
3915     I.e., treat input as items separated by ASCII NUL and terminate
3916     output items with ASCII NUL. This option can be useful in
3917     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
3918     do the same in order to reliably handle arbitrary file names (even
3919     those containing blanks or other special characters).
3920
3921   For example:
3922
3923     shuf <<EOF
3924     A man,
3925     a plan,
3926     a canal:
3927     Panama!
3928     EOF
3929
3930might produce the output
3931
3932     Panama!
3933     A man,
3934     a canal:
3935     a plan,
3936
3937Similarly, the command:
3938
3939     shuf -e clubs hearts diamonds spades
3940
3941might output:
3942
3943     clubs
3944     diamonds
3945     spades
3946     hearts
3947
3948and the command ‘shuf -i 1-4’ might output:
3949
3950     4
3951     2
3952     1
3953     3
3954
3955The above examples all have four input lines, so ‘shuf’ might produce
3956any of the twenty-four possible permutations of the input.  In general,
3957if there are N input lines, there are N!  (i.e., N factorial, or N * (N
3958- 1) * ... * 1) possible output permutations.
3959
3960To output 50 random numbers each in the range 0 through 9, use:
3961
3962     shuf -r -n 50 -i 0-9
3963
3964To simulate 100 coin flips, use:
3965
3966     shuf -r -n 100 -e Head Tail
3967
3968   An exit status of zero indicates success, and a nonzero value
3969indicates failure.
3970
3971
3972File: coreutils.info,  Node: uniq invocation,  Next: comm invocation,  Prev: shuf invocation,  Up: Operating on sorted files
3973
39747.3 ‘uniq’: Uniquify files
3975==========================
3976
3977‘uniq’ writes the unique lines in the given ‘input’, or standard input
3978if nothing is given or for an INPUT name of ‘-’.  Synopsis:
3979
3980     uniq [OPTION]... [INPUT [OUTPUT]]
3981
3982   By default, ‘uniq’ prints its input lines, except that it discards
3983all but the first of adjacent repeated lines, so that no output lines
3984are repeated.  Optionally, it can instead discard lines that are not
3985repeated, or all repeated lines.
3986
3987   The input need not be sorted, but repeated input lines are detected
3988only if they are adjacent.  If you want to discard non-adjacent
3989duplicate lines, perhaps you want to use ‘sort -u’.  *Note sort
3990invocation::.
3991
3992   Comparisons honor the rules specified by the ‘LC_COLLATE’ locale
3993category.
3994
3995   If no OUTPUT file is specified, ‘uniq’ writes to standard output.
3996
3997   The program accepts the following options.  Also see *note Common
3998options::.
3999
4000‘-f N’
4001‘--skip-fields=N’
4002     Skip N fields on each line before checking for uniqueness.  Use a
4003     null string for comparison if a line has fewer than N fields.
4004     Fields are sequences of non-space non-tab characters that are
4005     separated from each other by at least one space or tab.
4006
4007     For compatibility ‘uniq’ supports a traditional option syntax ‘-N’.
4008     New scripts should use ‘-f N’ instead.
4009
4010‘-s N’
4011‘--skip-chars=N’
4012     Skip N characters before checking for uniqueness.  Use a null
4013     string for comparison if a line has fewer than N characters.  If
4014     you use both the field and character skipping options, fields are
4015     skipped over first.
4016
4017     On systems not conforming to POSIX 1003.1-2001, ‘uniq’ supports a
4018     traditional option syntax ‘+N’.  Although this traditional behavior
4019     can be controlled with the ‘_POSIX2_VERSION’ environment variable
4020     (*note Standards conformance::), portable scripts should avoid
4021     commands whose behavior depends on this variable.  For example, use
4022     ‘uniq ./+10’ or ‘uniq -s 10’ rather than the ambiguous ‘uniq +10’.
4023
4024‘-c’
4025‘--count’
4026     Print the number of times each line occurred along with the line.
4027
4028‘-i’
4029‘--ignore-case’
4030     Ignore differences in case when comparing lines.
4031
4032‘-d’
4033‘--repeated’
4034     Discard lines that are not repeated.  When used by itself, this
4035     option causes ‘uniq’ to print the first copy of each repeated line,
4036     and nothing else.
4037
4038‘-D’
4039‘--all-repeated[=DELIMIT-METHOD]’
4040     Do not discard the second and subsequent repeated input lines, but
4041     discard lines that are not repeated.  This option is useful mainly
4042     in conjunction with other options e.g., to ignore case or to
4043     compare only selected fields.  The optional DELIMIT-METHOD,
4044     supported with the long form option, specifies how to delimit
4045     groups of repeated lines, and must be one of the following:
4046
4047     ‘none’
4048          Do not delimit groups of repeated lines.  This is equivalent
4049          to ‘--all-repeated’ (‘-D’).
4050
4051     ‘prepend’
4052          Output a newline before each group of repeated lines.  With
4053          ‘--zero-terminated’ (‘-z’), use a zero byte (ASCII NUL)
4054          instead of a newline as the delimiter.
4055
4056     ‘separate’
4057          Separate groups of repeated lines with a single newline.  This
4058          is the same as using ‘prepend’, except that no delimiter is
4059          inserted before the first group, and hence may be better
4060          suited for output direct to users.  With ‘--zero-terminated’
4061          (‘-z’), use a zero byte (ASCII NUL) instead of a newline as
4062          the delimiter.
4063
4064     Note that when groups are delimited and the input stream contains
4065     blank lines, then the output is ambiguous.  To avoid that, filter
4066     the input through ‘tr -s '\n'’ to remove blank lines.
4067
4068     This is a GNU extension.
4069
4070‘--group[=DELIMIT-METHOD]’
4071     Output all lines, and delimit each unique group.  With
4072     ‘--zero-terminated’ (‘-z’), use a zero byte (ASCII NUL) instead of
4073     a newline as the delimiter.  The optional DELIMIT-METHOD specifies
4074     how to delimit groups, and must be one of the following:
4075
4076     ‘separate’
4077          Separate unique groups with a single delimiter.  This is the
4078          default delimiting method if none is specified, and better
4079          suited for output direct to users.
4080
4081     ‘prepend’
4082          Output a delimiter before each group of unique items.
4083
4084     ‘append’
4085          Output a delimiter after each group of unique items.
4086
4087     ‘both’
4088          Output a delimiter around each group of unique items.
4089
4090     Note that when groups are delimited and the input stream contains
4091     blank lines, then the output is ambiguous.  To avoid that, filter
4092     the input through ‘tr -s '\n'’ to remove blank lines.
4093
4094     This is a GNU extension.
4095
4096‘-u’
4097‘--unique’
4098     Discard the last line that would be output for a repeated input
4099     group.  When used by itself, this option causes ‘uniq’ to print
4100     unique lines, and nothing else.
4101
4102‘-w N’
4103‘--check-chars=N’
4104     Compare at most N characters on each line (after skipping any
4105     specified fields and characters).  By default the entire rest of
4106     the lines are compared.
4107
4108‘-z’
4109‘--zero-terminated’
4110     Delimit items with a zero byte rather than a newline (ASCII LF).
4111     I.e., treat input as items separated by ASCII NUL and terminate
4112     output items with ASCII NUL. This option can be useful in
4113     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
4114     do the same in order to reliably handle arbitrary file names (even
4115     those containing blanks or other special characters).  Note with
4116     ‘-z’ the newline character is treated as a field separator.
4117
4118   An exit status of zero indicates success, and a nonzero value
4119indicates failure.
4120
4121
4122File: coreutils.info,  Node: comm invocation,  Next: ptx invocation,  Prev: uniq invocation,  Up: Operating on sorted files
4123
41247.4 ‘comm’: Compare two sorted files line by line
4125=================================================
4126
4127‘comm’ writes to standard output lines that are common, and lines that
4128are unique, to two input files; a file name of ‘-’ means standard input.
4129Synopsis:
4130
4131     comm [OPTION]... FILE1 FILE2
4132
4133   Before ‘comm’ can be used, the input files must be sorted using the
4134collating sequence specified by the ‘LC_COLLATE’ locale.  If an input
4135file ends in a non-newline character, a newline is silently appended.
4136The ‘sort’ command with no options always outputs a file that is
4137suitable input to ‘comm’.
4138
4139   With no options, ‘comm’ produces three-column output.  Column one
4140contains lines unique to FILE1, column two contains lines unique to
4141FILE2, and column three contains lines common to both files.  Columns
4142are separated by a single TAB character.
4143
4144   The options ‘-1’, ‘-2’, and ‘-3’ suppress printing of the
4145corresponding columns (and separators).  Also see *note Common
4146options::.
4147
4148   Unlike some other comparison utilities, ‘comm’ has an exit status
4149that does not depend on the result of the comparison.  Upon normal
4150completion ‘comm’ produces an exit code of zero.  If there is an error
4151it exits with nonzero status.
4152
4153   If the ‘--check-order’ option is given, unsorted inputs will cause a
4154fatal error message.  If the option ‘--nocheck-order’ is given, unsorted
4155inputs will never cause an error message.  If neither of these options
4156is given, wrongly sorted inputs are diagnosed only if an input file is
4157found to contain unpairable lines.  If an input file is diagnosed as
4158being unsorted, the ‘comm’ command will exit with a nonzero status (and
4159the output should not be used).
4160
4161   Forcing ‘comm’ to process wrongly sorted input files containing
4162unpairable lines by specifying ‘--nocheck-order’ is not guaranteed to
4163produce any particular output.  The output will probably not correspond
4164with whatever you hoped it would be.
4165
4166‘--check-order’
4167     Fail with an error message if either input file is wrongly ordered.
4168
4169‘--nocheck-order’
4170     Do not check that both input files are in sorted order.
4171
4172     Other options are:
4173
4174‘--output-delimiter=STR’
4175     Print STR between adjacent output columns, rather than the default
4176     of a single TAB character.
4177
4178     The delimiter STR may not be empty.
4179
4180‘--total’
4181     Output a summary at the end.
4182
4183     Similar to the regular output, column one contains the total number
4184     of lines unique to FILE1, column two contains the total number of
4185     lines unique to FILE2, and column three contains the total number
4186     of lines common to both files, followed by the word ‘total’ in the
4187     additional column four.
4188
4189     In the following example, ‘comm’ omits the regular output (‘-123’),
4190     thus just printing the summary:
4191
4192          $ printf '%s\n' a b c d e     > file1
4193          $ printf '%s\n'   b c d e f g > file2
4194          $ comm --total -123 file1 file2
4195          1       2       4       total
4196
4197     This option is a GNU extension.  Portable scripts should use ‘wc’
4198     to get the totals, e.g.  for the above example files:
4199
4200          $ comm -23 file1 file2 | wc -l    # number of lines only in file1
4201          1
4202          $ comm -13 file1 file2 | wc -l    # number of lines only in file2
4203          2
4204          $ comm -12 file1 file2 | wc -l    # number of lines common to both files
4205          4
4206
4207‘-z’
4208‘--zero-terminated’
4209     Delimit items with a zero byte rather than a newline (ASCII LF).
4210     I.e., treat input as items separated by ASCII NUL and terminate
4211     output items with ASCII NUL. This option can be useful in
4212     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
4213     do the same in order to reliably handle arbitrary file names (even
4214     those containing blanks or other special characters).
4215
4216
4217File: coreutils.info,  Node: ptx invocation,  Next: tsort invocation,  Prev: comm invocation,  Up: Operating on sorted files
4218
42197.5 ‘ptx’: Produce permuted indexes
4220===================================
4221
4222‘ptx’ reads a text file and essentially produces a permuted index, with
4223each keyword in its context.  The calling sketch is either one of:
4224
4225     ptx [OPTION ...] [FILE ...]
4226     ptx -G [OPTION ...] [INPUT [OUTPUT]]
4227
4228   The ‘-G’ (or its equivalent: ‘--traditional’) option disables all GNU
4229extensions and reverts to traditional mode, thus introducing some
4230limitations and changing several of the program’s default option values.
4231When ‘-G’ is not specified, GNU extensions are always enabled.  GNU
4232extensions to ‘ptx’ are documented wherever appropriate in this
4233document.  *Note Compatibility in ptx::, for the full list.
4234
4235   Individual options are explained in the following sections.
4236
4237   When GNU extensions are enabled, there may be zero, one or several
4238FILEs after the options.  If there is no FILE, the program reads the
4239standard input.  If there is one or several FILEs, they give the name of
4240input files which are all read in turn, as if all the input files were
4241concatenated.  However, there is a full contextual break between each
4242file and, when automatic referencing is requested, file names and line
4243numbers refer to individual text input files.  In all cases, the program
4244outputs the permuted index to the standard output.
4245
4246   When GNU extensions are _not_ enabled, that is, when the program
4247operates in traditional mode, there may be zero, one or two parameters
4248besides the options.  If there are no parameters, the program reads the
4249standard input and outputs the permuted index to the standard output.
4250If there is only one parameter, it names the text INPUT to be read
4251instead of the standard input.  If two parameters are given, they give
4252respectively the name of the INPUT file to read and the name of the
4253OUTPUT file to produce.  _Be very careful_ to note that, in this case,
4254the contents of file given by the second parameter is destroyed.  This
4255behavior is dictated by System V ‘ptx’ compatibility; GNU Standards
4256normally discourage output parameters not introduced by an option.
4257
4258   Note that for _any_ file named as the value of an option or as an
4259input text file, a single dash ‘-’ may be used, in which case standard
4260input is assumed.  However, it would not make sense to use this
4261convention more than once per program invocation.
4262
4263* Menu:
4264
4265* General options in ptx::      Options which affect general program behavior.
4266* Charset selection in ptx::    Underlying character set considerations.
4267* Input processing in ptx::     Input fields, contexts, and keyword selection.
4268* Output formatting in ptx::    Types of output format, and sizing the fields.
4269* Compatibility in ptx::
4270
4271
4272File: coreutils.info,  Node: General options in ptx,  Next: Charset selection in ptx,  Up: ptx invocation
4273
42747.5.1 General options
4275---------------------
4276
4277‘-G’
4278‘--traditional’
4279     As already explained, this option disables all GNU extensions to
4280     ‘ptx’ and switches to traditional mode.
4281
4282‘--help’
4283     Print a short help on standard output, then exit without further
4284     processing.
4285
4286‘--version’
4287     Print the program version on standard output, then exit without
4288     further processing.
4289
4290   An exit status of zero indicates success, and a nonzero value
4291indicates failure.
4292
4293
4294File: coreutils.info,  Node: Charset selection in ptx,  Next: Input processing in ptx,  Prev: General options in ptx,  Up: ptx invocation
4295
42967.5.2 Charset selection
4297-----------------------
4298
4299As it is set up now, the program assumes that the input file is coded
4300using 8-bit ISO 8859-1 code, also known as Latin-1 character set,
4301_unless_ it is compiled for MS-DOS, in which case it uses the character
4302set of the IBM-PC.  (GNU ‘ptx’ is not known to work on smaller MS-DOS
4303machines anymore.)  Compared to 7-bit ASCII, the set of characters which
4304are letters is different; this alters the behavior of regular expression
4305matching.  Thus, the default regular expression for a keyword allows
4306foreign or diacriticized letters.  Keyword sorting, however, is still
4307crude; it obeys the underlying character set ordering quite blindly.
4308
4309‘-f’
4310‘--ignore-case’
4311     Fold lower case letters to upper case for sorting.
4312
4313
4314File: coreutils.info,  Node: Input processing in ptx,  Next: Output formatting in ptx,  Prev: Charset selection in ptx,  Up: ptx invocation
4315
43167.5.3 Word selection and input processing
4317-----------------------------------------
4318
4319‘-b FILE’
4320‘--break-file=FILE’
4321
4322     This option provides an alternative (to ‘-W’) method of describing
4323     which characters make up words.  It introduces the name of a file
4324     which contains a list of characters which can_not_ be part of one
4325     word; this file is called the “Break file”.  Any character which is
4326     not part of the Break file is a word constituent.  If both options
4327     ‘-b’ and ‘-W’ are specified, then ‘-W’ has precedence and ‘-b’ is
4328     ignored.
4329
4330     When GNU extensions are enabled, the only way to avoid newline as a
4331     break character is to write all the break characters in the file
4332     with no newline at all, not even at the end of the file.  When GNU
4333     extensions are disabled, spaces, tabs and newlines are always
4334     considered as break characters even if not included in the Break
4335     file.
4336
4337‘-i FILE’
4338‘--ignore-file=FILE’
4339
4340     The file associated with this option contains a list of words which
4341     will never be taken as keywords in concordance output.  It is
4342     called the “Ignore file”.  The file contains exactly one word in
4343     each line; the end of line separation of words is not subject to
4344     the value of the ‘-S’ option.
4345
4346‘-o FILE’
4347‘--only-file=FILE’
4348
4349     The file associated with this option contains a list of words which
4350     will be retained in concordance output; any word not mentioned in
4351     this file is ignored.  The file is called the “Only file”.  The
4352     file contains exactly one word in each line; the end of line
4353     separation of words is not subject to the value of the ‘-S’ option.
4354
4355     There is no default for the Only file.  When both an Only file and
4356     an Ignore file are specified, a word is considered a keyword only
4357     if it is listed in the Only file and not in the Ignore file.
4358
4359‘-r’
4360‘--references’
4361
4362     On each input line, the leading sequence of non-white space
4363     characters will be taken to be a reference that has the purpose of
4364     identifying this input line in the resulting permuted index.  *Note
4365     Output formatting in ptx::, for more information about reference
4366     production.  Using this option changes the default value for option
4367     ‘-S’.
4368
4369     Using this option, the program does not try very hard to remove
4370     references from contexts in output, but it succeeds in doing so
4371     _when_ the context ends exactly at the newline.  If option ‘-r’ is
4372     used with ‘-S’ default value, or when GNU extensions are disabled,
4373     this condition is always met and references are completely excluded
4374     from the output contexts.
4375
4376‘-S REGEXP’
4377‘--sentence-regexp=REGEXP’
4378
4379     This option selects which regular expression will describe the end
4380     of a line or the end of a sentence.  In fact, this regular
4381     expression is not the only distinction between end of lines or end
4382     of sentences, and input line boundaries have no special
4383     significance outside this option.  By default, when GNU extensions
4384     are enabled and if ‘-r’ option is not used, end of sentences are
4385     used.  In this case, this REGEX is imported from GNU Emacs:
4386
4387          [.?!][]\"')}]*\\($\\|\t\\|  \\)[ \t\n]*
4388
4389     Whenever GNU extensions are disabled or if ‘-r’ option is used, end
4390     of lines are used; in this case, the default REGEXP is just:
4391
4392          \n
4393
4394     Using an empty REGEXP is equivalent to completely disabling end of
4395     line or end of sentence recognition.  In this case, the whole file
4396     is considered to be a single big line or sentence.  The user might
4397     want to disallow all truncation flag generation as well, through
4398     option ‘-F ""’.  *Note Syntax of Regular Expressions:
4399     (emacs)Regexps.
4400
4401     When the keywords happen to be near the beginning of the input line
4402     or sentence, this often creates an unused area at the beginning of
4403     the output context line; when the keywords happen to be near the
4404     end of the input line or sentence, this often creates an unused
4405     area at the end of the output context line.  The program tries to
4406     fill those unused areas by wrapping around context in them; the
4407     tail of the input line or sentence is used to fill the unused area
4408     on the left of the output line; the head of the input line or
4409     sentence is used to fill the unused area on the right of the output
4410     line.
4411
4412     As a matter of convenience to the user, many usual backslashed
4413     escape sequences from the C language are recognized and converted
4414     to the corresponding characters by ‘ptx’ itself.
4415
4416‘-W REGEXP’
4417‘--word-regexp=REGEXP’
4418
4419     This option selects which regular expression will describe each
4420     keyword.  By default, if GNU extensions are enabled, a word is a
4421     sequence of letters; the REGEXP used is ‘\w+’.  When GNU extensions
4422     are disabled, a word is by default anything which ends with a
4423     space, a tab or a newline; the REGEXP used is ‘[^ \t\n]+’.
4424
4425     An empty REGEXP is equivalent to not using this option.  *Note
4426     Syntax of Regular Expressions: (emacs)Regexps.
4427
4428     As a matter of convenience to the user, many usual backslashed
4429     escape sequences, as found in the C language, are recognized and
4430     converted to the corresponding characters by ‘ptx’ itself.
4431
4432
4433File: coreutils.info,  Node: Output formatting in ptx,  Next: Compatibility in ptx,  Prev: Input processing in ptx,  Up: ptx invocation
4434
44357.5.4 Output formatting
4436-----------------------
4437
4438Output format is mainly controlled by the ‘-O’ and ‘-T’ options
4439described in the table below.  When neither ‘-O’ nor ‘-T’ are selected,
4440and if GNU extensions are enabled, the program chooses an output format
4441suitable for a dumb terminal.  Each keyword occurrence is output to the
4442center of one line, surrounded by its left and right contexts.  Each
4443field is properly justified, so the concordance output can be readily
4444observed.  As a special feature, if automatic references are selected by
4445option ‘-A’ and are output before the left context, that is, if option
4446‘-R’ is _not_ selected, then a colon is added after the reference; this
4447nicely interfaces with GNU Emacs ‘next-error’ processing.  In this
4448default output format, each white space character, like newline and tab,
4449is merely changed to exactly one space, with no special attempt to
4450compress consecutive spaces.  This might change in the future.  Except
4451for those white space characters, every other character of the
4452underlying set of 256 characters is transmitted verbatim.
4453
4454   Output format is further controlled by the following options.
4455
4456‘-g NUMBER’
4457‘--gap-size=NUMBER’
4458
4459     Select the size of the minimum white space gap between the fields
4460     on the output line.
4461
4462‘-w NUMBER’
4463‘--width=NUMBER’
4464
4465     Select the maximum output width of each final line.  If references
4466     are used, they are included or excluded from the maximum output
4467     width depending on the value of option ‘-R’.  If this option is not
4468     selected, that is, when references are output before the left
4469     context, the maximum output width takes into account the maximum
4470     length of all references.  If this option is selected, that is,
4471     when references are output after the right context, the maximum
4472     output width does not take into account the space taken by
4473     references, nor the gap that precedes them.
4474
4475‘-A’
4476‘--auto-reference’
4477
4478     Select automatic references.  Each input line will have an
4479     automatic reference made up of the file name and the line ordinal,
4480     with a single colon between them.  However, the file name will be
4481     empty when standard input is being read.  If both ‘-A’ and ‘-r’ are
4482     selected, then the input reference is still read and skipped, but
4483     the automatic reference is used at output time, overriding the
4484     input reference.
4485
4486‘-R’
4487‘--right-side-refs’
4488
4489     In the default output format, when option ‘-R’ is not used, any
4490     references produced by the effect of options ‘-r’ or ‘-A’ are
4491     placed to the far right of output lines, after the right context.
4492     With default output format, when the ‘-R’ option is specified,
4493     references are rather placed at the beginning of each output line,
4494     before the left context.  For any other output format, option ‘-R’
4495     is ignored, with one exception: with ‘-R’ the width of references
4496     is _not_ taken into account in total output width given by ‘-w’.
4497
4498     This option is automatically selected whenever GNU extensions are
4499     disabled.
4500
4501‘-F STRING’
4502‘--flag-truncation=STRING’
4503
4504     This option will request that any truncation in the output be
4505     reported using the string STRING.  Most output fields theoretically
4506     extend towards the beginning or the end of the current line, or
4507     current sentence, as selected with option ‘-S’.  But there is a
4508     maximum allowed output line width, changeable through option ‘-w’,
4509     which is further divided into space for various output fields.
4510     When a field has to be truncated because it cannot extend beyond
4511     the beginning or the end of the current line to fit in, then a
4512     truncation occurs.  By default, the string used is a single slash,
4513     as in ‘-F /’.
4514
4515     STRING may have more than one character, as in ‘-F ...’.  Also, in
4516     the particular case when STRING is empty (‘-F ""’), truncation
4517     flagging is disabled, and no truncation marks are appended in this
4518     case.
4519
4520     As a matter of convenience to the user, many usual backslashed
4521     escape sequences, as found in the C language, are recognized and
4522     converted to the corresponding characters by ‘ptx’ itself.
4523
4524‘-M STRING’
4525‘--macro-name=STRING’
4526
4527     Select another STRING to be used instead of ‘xx’, while generating
4528     output suitable for ‘nroff’, ‘troff’ or TeX.
4529
4530‘-O’
4531‘--format=roff’
4532
4533     Choose an output format suitable for ‘nroff’ or ‘troff’ processing.
4534     Each output line will look like:
4535
4536          .xx "TAIL" "BEFORE" "KEYWORD_AND_AFTER" "HEAD" "REF"
4537
4538     so it will be possible to write a ‘.xx’ roff macro to take care of
4539     the output typesetting.  This is the default output format when GNU
4540     extensions are disabled.  Option ‘-M’ can be used to change ‘xx’ to
4541     another macro name.
4542
4543     In this output format, each non-graphical character, like newline
4544     and tab, is merely changed to exactly one space, with no special
4545     attempt to compress consecutive spaces.  Each quote character ‘"’
4546     is doubled so it will be correctly processed by ‘nroff’ or ‘troff’.
4547
4548‘-T’
4549‘--format=tex’
4550
4551     Choose an output format suitable for TeX processing.  Each output
4552     line will look like:
4553
4554          \xx {TAIL}{BEFORE}{KEYWORD}{AFTER}{HEAD}{REF}
4555
4556     so it will be possible to write a ‘\xx’ definition to take care of
4557     the output typesetting.  Note that when references are not being
4558     produced, that is, neither option ‘-A’ nor option ‘-r’ is selected,
4559     the last parameter of each ‘\xx’ call is inhibited.  Option ‘-M’
4560     can be used to change ‘xx’ to another macro name.
4561
4562     In this output format, some special characters, like ‘$’, ‘%’, ‘&’,
4563     ‘#’ and ‘_’ are automatically protected with a backslash.  Curly
4564     brackets ‘{’, ‘}’ are protected with a backslash and a pair of
4565     dollar signs (to force mathematical mode).  The backslash itself
4566     produces the sequence ‘\backslash{}’.  Circumflex and tilde
4567     diacritical marks produce the sequence ‘^\{ }’ and ‘~\{ }’
4568     respectively.  Other diacriticized characters of the underlying
4569     character set produce an appropriate TeX sequence as far as
4570     possible.  The other non-graphical characters, like newline and
4571     tab, and all other characters which are not part of ASCII, are
4572     merely changed to exactly one space, with no special attempt to
4573     compress consecutive spaces.  Let me know how to improve this
4574     special character processing for TeX.
4575
4576
4577File: coreutils.info,  Node: Compatibility in ptx,  Prev: Output formatting in ptx,  Up: ptx invocation
4578
45797.5.5 The GNU extensions to ‘ptx’
4580---------------------------------
4581
4582This version of ‘ptx’ contains a few features which do not exist in
4583System V ‘ptx’.  These extra features are suppressed by using the ‘-G’
4584command line option, unless overridden by other command line options.
4585Some GNU extensions cannot be recovered by overriding, so the simple
4586rule is to avoid ‘-G’ if you care about GNU extensions.  Here are the
4587differences between this program and System V ‘ptx’.
4588
4589   • This program can read many input files at once, it always writes
4590     the resulting concordance on standard output.  On the other hand,
4591     System V ‘ptx’ reads only one file and sends the result to standard
4592     output or, if a second FILE parameter is given on the command, to
4593     that FILE.
4594
4595     Having output parameters not introduced by options is a dangerous
4596     practice which GNU avoids as far as possible.  So, for using ‘ptx’
4597     portably between GNU and System V, you should always use it with a
4598     single input file, and always expect the result on standard output.
4599     You might also want to automatically configure in a ‘-G’ option to
4600     ‘ptx’ calls in products using ‘ptx’, if the configurator finds that
4601     the installed ‘ptx’ accepts ‘-G’.
4602
4603   • The only options available in System V ‘ptx’ are options ‘-b’,
4604     ‘-f’, ‘-g’, ‘-i’, ‘-o’, ‘-r’, ‘-t’ and ‘-w’.  All other options are
4605     GNU extensions and are not repeated in this enumeration.  Moreover,
4606     some options have a slightly different meaning when GNU extensions
4607     are enabled, as explained below.
4608
4609   • By default, concordance output is not formatted for ‘troff’ or
4610     ‘nroff’.  It is rather formatted for a dumb terminal.  ‘troff’ or
4611     ‘nroff’ output may still be selected through option ‘-O’.
4612
4613   • Unless ‘-R’ option is used, the maximum reference width is
4614     subtracted from the total output line width.  With GNU extensions
4615     disabled, width of references is not taken into account in the
4616     output line width computations.
4617
4618   • All 256 bytes, even ASCII NUL bytes, are always read and processed
4619     from input file with no adverse effect, even if GNU extensions are
4620     disabled.  However, System V ‘ptx’ does not accept 8-bit
4621     characters, a few control characters are rejected, and the tilde
4622     ‘~’ is also rejected.
4623
4624   • Input line length is only limited by available memory, even if GNU
4625     extensions are disabled.  However, System V ‘ptx’ processes only
4626     the first 200 characters in each line.
4627
4628   • The break (non-word) characters default to be every character
4629     except all letters of the underlying character set, diacriticized
4630     or not.  When GNU extensions are disabled, the break characters
4631     default to space, tab and newline only.
4632
4633   • The program makes better use of output line width.  If GNU
4634     extensions are disabled, the program rather tries to imitate System
4635     V ‘ptx’, but still, there are some slight disposition glitches this
4636     program does not completely reproduce.
4637
4638   • The user can specify both an Ignore file and an Only file.  This is
4639     not allowed with System V ‘ptx’.
4640
4641
4642File: coreutils.info,  Node: tsort invocation,  Prev: ptx invocation,  Up: Operating on sorted files
4643
46447.6 ‘tsort’: Topological sort
4645=============================
4646
4647‘tsort’ performs a topological sort on the given FILE, or standard input
4648if no input file is given or for a FILE of ‘-’.  For more details and
4649some history, see *note tsort background::.  Synopsis:
4650
4651     tsort [OPTION] [FILE]
4652
4653   ‘tsort’ reads its input as pairs of strings, separated by blanks,
4654indicating a partial ordering.  The output is a total ordering that
4655corresponds to the given partial ordering.
4656
4657   For example
4658
4659     tsort <<EOF
4660     a b c
4661     d
4662     e f
4663     b c d e
4664     EOF
4665
4666will produce the output
4667
4668     a
4669     b
4670     c
4671     d
4672     e
4673     f
4674
4675   Consider a more realistic example.  You have a large set of functions
4676all in one file, and they may all be declared static except one.
4677Currently that one (say ‘main’) is the first function defined in the
4678file, and the ones it calls directly follow it, followed by those they
4679call, etc.  Let’s say that you are determined to take advantage of
4680prototypes, so you have to choose between declaring all of those
4681functions (which means duplicating a lot of information from the
4682definitions) and rearranging the functions so that as many as possible
4683are defined before they are used.  One way to automate the latter
4684process is to get a list for each function of the functions it calls
4685directly.  Many programs can generate such lists.  They describe a call
4686graph.  Consider the following list, in which a given line indicates
4687that the function on the left calls the one on the right directly.
4688
4689     main parse_options
4690     main tail_file
4691     main tail_forever
4692     tail_file pretty_name
4693     tail_file write_header
4694     tail_file tail
4695     tail_forever recheck
4696     tail_forever pretty_name
4697     tail_forever write_header
4698     tail_forever dump_remainder
4699     tail tail_lines
4700     tail tail_bytes
4701     tail_lines start_lines
4702     tail_lines dump_remainder
4703     tail_lines file_lines
4704     tail_lines pipe_lines
4705     tail_bytes xlseek
4706     tail_bytes start_bytes
4707     tail_bytes dump_remainder
4708     tail_bytes pipe_bytes
4709     file_lines dump_remainder
4710     recheck pretty_name
4711
4712   then you can use ‘tsort’ to produce an ordering of those functions
4713that satisfies your requirement.
4714
4715     example$ tsort call-graph | tac
4716     dump_remainder
4717     start_lines
4718     file_lines
4719     pipe_lines
4720     xlseek
4721     start_bytes
4722     pipe_bytes
4723     tail_lines
4724     tail_bytes
4725     pretty_name
4726     write_header
4727     tail
4728     recheck
4729     parse_options
4730     tail_file
4731     tail_forever
4732     main
4733
4734   ‘tsort’ detects any cycles in the input and writes the first cycle
4735encountered to standard error.
4736
4737   Note that for a given partial ordering, generally there is no unique
4738total ordering.  In the context of the call graph above, the function
4739‘parse_options’ may be placed anywhere in the list as long as it
4740precedes ‘main’.
4741
4742   The only options are ‘--help’ and ‘--version’.  *Note Common
4743options::.
4744
4745   An exit status of zero indicates success, and a nonzero value
4746indicates failure.
4747
4748* Menu:
4749
4750* tsort background::            Where tsort came from.
4751
4752
4753File: coreutils.info,  Node: tsort background,  Up: tsort invocation
4754
47557.6.1 ‘tsort’: Background
4756-------------------------
4757
4758‘tsort’ exists because very early versions of the Unix linker processed
4759an archive file exactly once, and in order.  As ‘ld’ read each object in
4760the archive, it decided whether it was needed in the program based on
4761whether it defined any symbols which were undefined at that point in the
4762link.
4763
4764   This meant that dependencies within the archive had to be handled
4765specially.  For example, ‘scanf’ probably calls ‘read’.  That means that
4766in a single pass through an archive, it was important for ‘scanf.o’ to
4767appear before read.o, because otherwise a program which calls ‘scanf’
4768but not ‘read’ might end up with an unexpected unresolved reference to
4769‘read’.
4770
4771   The way to address this problem was to first generate a set of
4772dependencies of one object file on another.  This was done by a shell
4773script called ‘lorder’.  The GNU tools don’t provide a version of
4774lorder, as far as I know, but you can still find it in BSD
4775distributions.
4776
4777   Then you ran ‘tsort’ over the ‘lorder’ output, and you used the
4778resulting sort to define the order in which you added objects to the
4779archive.
4780
4781   This whole procedure has been obsolete since about 1980, because Unix
4782archives now contain a symbol table (traditionally built by ‘ranlib’,
4783now generally built by ‘ar’ itself), and the Unix linker uses the symbol
4784table to effectively make multiple passes over an archive file.
4785
4786   Anyhow, that’s where tsort came from.  To solve an old problem with
4787the way the linker handled archive files, which has since been solved in
4788different ways.
4789
4790
4791File: coreutils.info,  Node: Operating on fields,  Next: Operating on characters,  Prev: Operating on sorted files,  Up: Top
4792
47938 Operating on fields
4794*********************
4795
4796* Menu:
4797
4798* cut invocation::              Print selected parts of lines.
4799* paste invocation::            Merge lines of files.
4800* join invocation::             Join lines on a common field.
4801
4802
4803File: coreutils.info,  Node: cut invocation,  Next: paste invocation,  Up: Operating on fields
4804
48058.1 ‘cut’: Print selected parts of lines
4806========================================
4807
4808‘cut’ writes to standard output selected parts of each line of each
4809input file, or standard input if no files are given or for a file name
4810of ‘-’.  Synopsis:
4811
4812     cut OPTION... [FILE]...
4813
4814   In the table which follows, the BYTE-LIST, CHARACTER-LIST, and
4815FIELD-LIST are one or more numbers or ranges (two numbers separated by a
4816dash) separated by commas.  Bytes, characters, and fields are numbered
4817starting at 1.  Incomplete ranges may be given: ‘-M’ means ‘1-M’; ‘N-’
4818means ‘N’ through end of line or last field.  The list elements can be
4819repeated, can overlap, and can be specified in any order; but the
4820selected input is written in the same order that it is read, and is
4821written exactly once.
4822
4823   The program accepts the following options.  Also see *note Common
4824options::.
4825
4826‘-b BYTE-LIST’
4827‘--bytes=BYTE-LIST’
4828     Select for printing only the bytes in positions listed in
4829     BYTE-LIST.  Tabs and backspaces are treated like any other
4830     character; they take up 1 byte.  If an output delimiter is
4831     specified, (see the description of ‘--output-delimiter’), then
4832     output that string between ranges of selected bytes.
4833
4834‘-c CHARACTER-LIST’
4835‘--characters=CHARACTER-LIST’
4836     Select for printing only the characters in positions listed in
4837     CHARACTER-LIST.  The same as ‘-b’ for now, but internationalization
4838     will change that.  Tabs and backspaces are treated like any other
4839     character; they take up 1 character.  If an output delimiter is
4840     specified, (see the description of ‘--output-delimiter’), then
4841     output that string between ranges of selected bytes.
4842
4843‘-f FIELD-LIST’
4844‘--fields=FIELD-LIST’
4845     Select for printing only the fields listed in FIELD-LIST.  Fields
4846     are separated by a TAB character by default.  Also print any line
4847     that contains no delimiter character, unless the ‘--only-delimited’
4848     (‘-s’) option is specified.
4849
4850     Note ‘awk’ supports more sophisticated field processing, like
4851     reordering fields, and handling fields aligned with blank
4852     characters.  By default ‘awk’ uses (and discards) runs of blank
4853     characters to separate fields, and ignores leading and trailing
4854     blanks.
4855          awk '{print $2}'      # print the second field
4856          awk '{print $(NF-1)}' # print the penultimate field
4857          awk '{print $2,$1}'   # reorder the first two fields
4858     Note while ‘cut’ accepts field specifications in arbitrary order,
4859     output is always in the order encountered in the file.
4860
4861     In the unlikely event that ‘awk’ is unavailable, one can use the
4862     ‘join’ command, to process blank characters as ‘awk’ does above.
4863          join -a1 -o 1.2     - /dev/null # print the second field
4864          join -a1 -o 1.2,1.1 - /dev/null # reorder the first two fields
4865
4866‘-d INPUT_DELIM_BYTE’
4867‘--delimiter=INPUT_DELIM_BYTE’
4868     With ‘-f’, use the first byte of INPUT_DELIM_BYTE as the input
4869     fields separator (default is TAB).
4870
4871‘-n’
4872     Do not split multi-byte characters (no-op for now).
4873
4874‘-s’
4875‘--only-delimited’
4876     For ‘-f’, do not print lines that do not contain the field
4877     separator character.  Normally, any line without a field separator
4878     is printed verbatim.
4879
4880‘--output-delimiter=OUTPUT_DELIM_STRING’
4881     With ‘-f’, output fields are separated by OUTPUT_DELIM_STRING.  The
4882     default with ‘-f’ is to use the input delimiter.  When using ‘-b’
4883     or ‘-c’ to select ranges of byte or character offsets (as opposed
4884     to ranges of fields), output OUTPUT_DELIM_STRING between
4885     non-overlapping ranges of selected bytes.
4886
4887‘--complement’
4888     This option is a GNU extension.  Select for printing the complement
4889     of the bytes, characters or fields selected with the ‘-b’, ‘-c’ or
4890     ‘-f’ options.  In other words, do _not_ print the bytes, characters
4891     or fields specified via those options.  This option is useful when
4892     you have many fields and want to print all but a few of them.
4893
4894‘-z’
4895‘--zero-terminated’
4896     Delimit items with a zero byte rather than a newline (ASCII LF).
4897     I.e., treat input as items separated by ASCII NUL and terminate
4898     output items with ASCII NUL. This option can be useful in
4899     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
4900     do the same in order to reliably handle arbitrary file names (even
4901     those containing blanks or other special characters).
4902
4903   An exit status of zero indicates success, and a nonzero value
4904indicates failure.
4905
4906
4907File: coreutils.info,  Node: paste invocation,  Next: join invocation,  Prev: cut invocation,  Up: Operating on fields
4908
49098.2 ‘paste’: Merge lines of files
4910=================================
4911
4912‘paste’ writes to standard output lines consisting of sequentially
4913corresponding lines of each given file, separated by a TAB character.
4914Standard input is used for a file name of ‘-’ or if no input files are
4915given.
4916
4917   Synopsis:
4918
4919     paste [OPTION]... [FILE]...
4920
4921   For example, with:
4922     $ cat num2
4923     1
4924     2
4925     $ cat let3
4926     a
4927     b
4928     c
4929
4930   Take lines sequentially from each file:
4931     $ paste num2 let3
4932     1       a
4933     2       b
4934             c
4935
4936   Duplicate lines from a file:
4937     $ paste num2 let3 num2
4938     1       a      1
4939     2       b      2
4940             c
4941
4942   Intermix lines from stdin:
4943     $ paste - let3 - < num2
4944     1       a      2
4945             b
4946             c
4947
4948   Join consecutive lines with a space:
4949     $ seq 4 | paste -d ' ' - -
4950     1 2
4951     3 4
4952
4953   The program accepts the following options.  Also see *note Common
4954options::.
4955
4956‘-s’
4957‘--serial’
4958     Paste the lines of one file at a time rather than one line from
4959     each file.  Using the above example data:
4960
4961          $ paste -s num2 let3
4962          1       2
4963          a       b       c
4964
4965‘-d DELIM-LIST’
4966‘--delimiters=DELIM-LIST’
4967     Consecutively use the characters in DELIM-LIST instead of TAB to
4968     separate merged lines.  When DELIM-LIST is exhausted, start again
4969     at its beginning.  Using the above example data:
4970
4971          $ paste -d '%_' num2 let3 num2
4972          1%a_1
4973          2%b_2
4974          %c_
4975
4976‘-z’
4977‘--zero-terminated’
4978     Delimit items with a zero byte rather than a newline (ASCII LF).
4979     I.e., treat input as items separated by ASCII NUL and terminate
4980     output items with ASCII NUL. This option can be useful in
4981     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
4982     do the same in order to reliably handle arbitrary file names (even
4983     those containing blanks or other special characters).
4984
4985   An exit status of zero indicates success, and a nonzero value
4986indicates failure.
4987
4988
4989File: coreutils.info,  Node: join invocation,  Prev: paste invocation,  Up: Operating on fields
4990
49918.3 ‘join’: Join lines on a common field
4992========================================
4993
4994‘join’ writes to standard output a line for each pair of input lines
4995that have identical join fields.  Synopsis:
4996
4997     join [OPTION]... FILE1 FILE2
4998
4999   Either FILE1 or FILE2 (but not both) can be ‘-’, meaning standard
5000input.  FILE1 and FILE2 should be sorted on the join fields.
5001
5002     $ cat file1
5003     a 1
5004     b 2
5005     e 5
5006
5007     $ cat file2
5008     a X
5009     e Y
5010     f Z
5011
5012     $ join file1 file2
5013     a 1 X
5014     e 5 Y
5015
5016‘join’’s default behavior (when no options are given):
5017   • the join field is the first field in each line;
5018   • fields in the input are separated by one or more blanks, with
5019     leading blanks on the line ignored;
5020   • fields in the output are separated by a space;
5021   • each output line consists of the join field, the remaining fields
5022     from FILE1, then the remaining fields from FILE2.
5023
5024* Menu:
5025
5026* General options in join::      Options which affect general program behavior.
5027* Sorting files for join::       Using ‘sort’ before ‘join’.
5028* Working with fields::          Joining on different fields.
5029* Paired and unpaired lines::    Controlling ‘join’’s field matching.
5030* Header lines::                 Working with header lines in files.
5031* Set operations::               Union, Intersection and Difference of files.
5032
5033
5034File: coreutils.info,  Node: General options in join,  Next: Sorting files for join,  Up: join invocation
5035
50368.3.1 General options
5037---------------------
5038
5039The program accepts the following options.  Also see *note Common
5040options::.
5041
5042‘-a FILE-NUMBER’
5043     Print a line for each unpairable line in file FILE-NUMBER (either
5044     ‘1’ or ‘2’), in addition to the normal output.
5045
5046‘--check-order’
5047     Fail with an error message if either input file is wrongly ordered.
5048
5049‘--nocheck-order’
5050     Do not check that both input files are in sorted order.  This is
5051     the default.
5052
5053‘-e STRING’
5054     Replace those output fields that are missing in the input with
5055     STRING.  I.e., missing fields specified with the ‘-12jo’ options.
5056
5057‘--header’
5058     Treat the first line of each input file as a header line.  The
5059     header lines will be joined and printed as the first output line.
5060     If ‘-o’ is used to specify output format, the header line will be
5061     printed according to the specified format.  The header lines will
5062     not be checked for ordering even if ‘--check-order’ is specified.
5063     Also if the header lines from each file do not match, the heading
5064     fields from the first file will be used.
5065
5066‘-i’
5067‘--ignore-case’
5068     Ignore differences in case when comparing keys.  With this option,
5069     the lines of the input files must be ordered in the same way.  Use
5070     ‘sort -f’ to produce this ordering.
5071
5072‘-1 FIELD’
5073     Join on field FIELD (a positive integer) of file 1.
5074
5075‘-2 FIELD’
5076     Join on field FIELD (a positive integer) of file 2.
5077
5078‘-j FIELD’
5079     Equivalent to ‘-1 FIELD -2 FIELD’.
5080
5081‘-o FIELD-LIST’
5082‘-o auto’
5083     If the keyword ‘auto’ is specified, infer the output format from
5084     the first line in each file.  This is the same as the default
5085     output format but also ensures the same number of fields are output
5086     for each line.  Missing fields are replaced with the ‘-e’ option
5087     and extra fields are discarded.
5088
5089     Otherwise, construct each output line according to the format in
5090     FIELD-LIST.  Each element in FIELD-LIST is either the single
5091     character ‘0’ or has the form M.N where the file number, M, is ‘1’
5092     or ‘2’ and N is a positive field number.
5093
5094     A field specification of ‘0’ denotes the join field.  In most
5095     cases, the functionality of the ‘0’ field spec may be reproduced
5096     using the explicit M.N that corresponds to the join field.
5097     However, when printing unpairable lines (using either of the ‘-a’
5098     or ‘-v’ options), there is no way to specify the join field using
5099     M.N in FIELD-LIST if there are unpairable lines in both files.  To
5100     give ‘join’ that functionality, POSIX invented the ‘0’ field
5101     specification notation.
5102
5103     The elements in FIELD-LIST are separated by commas or blanks.
5104     Blank separators typically need to be quoted for the shell.  For
5105     example, the commands ‘join -o 1.2,2.2’ and ‘join -o '1.2 2.2'’ are
5106     equivalent.
5107
5108     All output lines—including those printed because of any -a or -v
5109     option—are subject to the specified FIELD-LIST.
5110
5111‘-t CHAR’
5112     Use character CHAR as the input and output field separator.  Treat
5113     as significant each occurrence of CHAR in the input file.  Use
5114     ‘sort -t CHAR’, without the ‘-b’ option of ‘sort’, to produce this
5115     ordering.  If ‘join -t ''’ is specified, the whole line is
5116     considered, matching the default operation of sort.  If ‘-t '\0'’
5117     is specified then the ASCII NUL character is used to delimit the
5118     fields.
5119
5120‘-v FILE-NUMBER’
5121     Print a line for each unpairable line in file FILE-NUMBER (either
5122     ‘1’ or ‘2’), instead of the normal output.
5123
5124‘-z’
5125‘--zero-terminated’
5126     Delimit items with a zero byte rather than a newline (ASCII LF).
5127     I.e., treat input as items separated by ASCII NUL and terminate
5128     output items with ASCII NUL. This option can be useful in
5129     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
5130     do the same in order to reliably handle arbitrary file names (even
5131     those containing blanks or other special characters).  Note with
5132     ‘-z’ the newline character is treated as a field separator.
5133
5134   An exit status of zero indicates success, and a nonzero value
5135indicates failure.
5136
5137   If the ‘--check-order’ option is given, unsorted inputs will cause a
5138fatal error message.  If the option ‘--nocheck-order’ is given, unsorted
5139inputs will never cause an error message.  If neither of these options
5140is given, wrongly sorted inputs are diagnosed only if an input file is
5141found to contain unpairable lines, and when both input files are non
5142empty.  If an input file is diagnosed as being unsorted, the ‘join’
5143command will exit with a nonzero status (and the output should not be
5144used).
5145
5146   Forcing ‘join’ to process wrongly sorted input files containing
5147unpairable lines by specifying ‘--nocheck-order’ is not guaranteed to
5148produce any particular output.  The output will probably not correspond
5149with whatever you hoped it would be.
5150
5151
5152File: coreutils.info,  Node: Sorting files for join,  Next: Working with fields,  Prev: General options in join,  Up: join invocation
5153
51548.3.2 Pre-sorting
5155-----------------
5156
5157‘join’ requires sorted input files.  Each input file should be sorted
5158according to the key (=field/column number) used in ‘join’.  The
5159recommended sorting option is ‘sort -k 1b,1’ (assuming the desired key
5160is in the first column).
5161
5162Typical usage:
5163     $ sort -k 1b,1 file1 > file1.sorted
5164     $ sort -k 1b,1 file2 > file2.sorted
5165     $ join file1.sorted file2.sorted > file3
5166
5167   Normally, the sort order is that of the collating sequence specified
5168by the ‘LC_COLLATE’ locale.  Unless the ‘-t’ option is given, the sort
5169comparison ignores blanks at the start of the join field, as in ‘sort
5170-b’.  If the ‘--ignore-case’ option is given, the sort comparison
5171ignores the case of characters in the join field, as in ‘sort -f’:
5172
5173     $ sort -k 1bf,1 file1 > file1.sorted
5174     $ sort -k 1bf,1 file2 > file2.sorted
5175     $ join --ignore-case file1.sorted file2.sorted > file3
5176
5177   The ‘sort’ and ‘join’ commands should use consistent locales and
5178options if the output of ‘sort’ is fed to ‘join’.  You can use a command
5179like ‘sort -k 1b,1’ to sort a file on its default join field, but if you
5180select a non-default locale, join field, separator, or comparison
5181options, then you should do so consistently between ‘join’ and ‘sort’.
5182
5183To avoid any locale-related issues, it is recommended to use the ‘C’
5184locale for both commands:
5185
5186     $ LC_ALL=C sort -k 1b,1 file1 > file1.sorted
5187     $ LC_ALL=C sort -k 1b,1 file2 > file2.sorted
5188     $ LC_ALL=C join file1.sorted file2.sorted > file3
5189
5190
5191File: coreutils.info,  Node: Working with fields,  Next: Paired and unpaired lines,  Prev: Sorting files for join,  Up: join invocation
5192
51938.3.3 Working with fields
5194-------------------------
5195
5196Use ‘-1’,‘-2’ to set the key fields for each of the input files.  Ensure
5197the preceding ‘sort’ commands operated on the same fields.
5198
5199The following example joins two files, using the values from seventh
5200field of the first file and the third field of the second file:
5201
5202     $ sort -k 7b,7 file1 > file1.sorted
5203     $ sort -k 3b,3 file2 > file2.sorted
5204     $ join -1 7 -2 3 file1.sorted file2.sorted > file3
5205
5206If the field number is the same for both files, use ‘-j’:
5207
5208     $ sort -k4b,4 file1 > file1.sorted
5209     $ sort -k4b,4 file2 > file2.sorted
5210     $ join -j4    file1.sorted file2.sorted > file3
5211
5212Both ‘sort’ and ‘join’ operate of whitespace-delimited fields.  To
5213specify a different delimiter, use ‘-t’ in _both_:
5214
5215     $ sort -t, -k3b,3 file1 > file1.sorted
5216     $ sort -t, -k3b,3 file2 > file2.sorted
5217     $ join -t, -j3    file1.sorted file2.sorted > file3
5218
5219To specify a tab (ASCII 0x09) character instead of whitespace, use (1):
5220
5221     $ sort -t$'\t' -k3b,3 file1 > file1.sorted
5222     $ sort -t$'\t' -k3b,3 file2 > file2.sorted
5223     $ join -t$'\t' -j3    file1.sorted file2.sorted > file3
5224
5225If ‘join -t ''’ is specified then the whole line is considered which
5226matches the default operation of sort:
5227
5228     $ sort file1 > file1.sorted
5229     $ sort file2 > file2.sorted
5230     $ join -t '' file1.sorted file2.sorted > file3
5231
5232   ---------- Footnotes ----------
5233
5234   (1) the ‘$'\t'’ is supported in most modern shells.  For older
5235shells, use a literal tab
5236
5237
5238File: coreutils.info,  Node: Paired and unpaired lines,  Next: Header lines,  Prev: Working with fields,  Up: join invocation
5239
52408.3.4 Controlling ‘join’’s field matching
5241-----------------------------------------
5242
5243In this section the ‘sort’ commands are omitted for brevity.  Sorting
5244the files before joining is still required.
5245
5246   ‘join’’s default behavior is to print only lines common to both input
5247files.  Use ‘-a’ and ‘-v’ to print unpairable lines from one or both
5248files.
5249
5250All examples below use the following two (pre-sorted) input files:
5251
5252     $ cat file1                          $ cat file2
5253     a 1                                  a A
5254     b 2                                  c C
5255
5256Command                              Outcome
5257
5258--------------------------------------------------------------------------
5259     $ join file1 file2              common lines (_intersection_)
5260     a 1 A
5261     $ join -a 1 file1 file2         common lines _and_ unpaired lines
5262     a 1 A                           from the first file
5263     b 2
5264     $ join -a 2 file1 file2         common lines _and_ unpaired lines
5265     a 1 A                           from the second file
5266     c C
5267     $ join -a 1 -a 2 file1 file2    all lines (paired and unpaired)
5268     a 1 A                           from both files (_union_).
5269     b 2                             see note below regarding ‘-o
5270     c C                             auto’.
5271
5272     $ join -v 1 file1 file2         unpaired lines from the first file
5273     b 2                             (_difference_)
5274
5275     $ join -v 2 file1 file2         unpaired lines from the second
5276     c C                             file (_difference_)
5277
5278     $ join -v 1 -v 2 file1 file2    unpaired lines from both files,
5279     b 2                             omitting common lines (_symmetric
5280     c C                             difference_).
5281
5282
5283The ‘-o auto -e X’ options are useful when dealing with unpaired lines.
5284The following example prints all lines (common and unpaired) from both
5285files.  Without ‘-o auto’ it is not easy to discern which fields
5286originate from which file:
5287
5288     $ join -a 1 -a 2 file1 file2
5289     a 1 A
5290     b 2
5291     c C
5292
5293     $ join -o auto -e X -a 1 -a 2 file1 file2
5294     a 1 A
5295     b 2 X
5296     c X C
5297
5298   If the input has no unpairable lines, a GNU extension is available;
5299the sort order can be any order that considers two fields to be equal if
5300and only if the sort comparison described above considers them to be
5301equal.  For example:
5302
5303     $ cat file1
5304     a a1
5305     c c1
5306     b b1
5307
5308     $ cat file2
5309     a a2
5310     c c2
5311     b b2
5312
5313     $ join file1 file2
5314     a a1 a2
5315     c c1 c2
5316     b b1 b2
5317
5318
5319File: coreutils.info,  Node: Header lines,  Next: Set operations,  Prev: Paired and unpaired lines,  Up: join invocation
5320
53218.3.5 Header lines
5322------------------
5323
5324The ‘--header’ option can be used when the files to join have a header
5325line which is not sorted:
5326
5327     $ cat file1
5328     Name     Age
5329     Alice    25
5330     Charlie  34
5331
5332     $ cat file2
5333     Name   Country
5334     Alice  France
5335     Bob    Spain
5336
5337     $ join --header -o auto -e NA -a1 -a2 file1 file2
5338     Name     Age   Country
5339     Alice    25    France
5340     Bob      NA    Spain
5341     Charlie  34    NA
5342
5343   To sort a file with a header line, use GNU ‘sed -u’.  The following
5344example sort the files but keeps the first line of each file in place:
5345
5346     $ ( sed -u 1q ; sort -k2b,2 ) < file1 > file1.sorted
5347     $ ( sed -u 1q ; sort -k2b,2 ) < file2 > file2.sorted
5348     $ join --header -o auto -e NA -a1 -a2 file1.sorted file2.sorted > file3
5349
5350
5351File: coreutils.info,  Node: Set operations,  Prev: Header lines,  Up: join invocation
5352
53538.3.6 Union, Intersection and Difference of files
5354-------------------------------------------------
5355
5356Combine ‘sort’, ‘uniq’ and ‘join’ to perform the equivalent of set
5357operations on files:
5358
5359Command                              outcome
5360--------------------------------------------------------------------------
5361‘sort -u file1 file2’                Union of unsorted files
5362
5363‘sort file1 file2 | uniq -d’         Intersection of unsorted files
5364
5365‘sort file1 file1 file2 | uniq -u’   Difference of unsorted files
5366
5367‘sort file1 file2 | uniq -u’         Symmetric Difference of unsorted
5368                                     files
5369
5370‘join -t '' -a1 -a2 file1 file2’     Union of sorted files
5371
5372‘join -t '' file1 file2’             Intersection of sorted files
5373
5374‘join -t '' -v2 file1 file2’         Difference of sorted files
5375
5376‘join -t '' -v1 -v2 file1 file2’     Symmetric Difference of sorted
5377                                     files
5378
5379
5380   All examples above operate on entire lines and not on specific
5381fields: ‘sort’ without ‘-k’ and ‘join -t ''’ both consider entire lines
5382as the key.
5383
5384
5385File: coreutils.info,  Node: Operating on characters,  Next: Directory listing,  Prev: Operating on fields,  Up: Top
5386
53879 Operating on characters
5388*************************
5389
5390These commands operate on individual characters.
5391
5392* Menu:
5393
5394* tr invocation::               Translate, squeeze, and/or delete characters.
5395* expand invocation::           Convert tabs to spaces.
5396* unexpand invocation::         Convert spaces to tabs.
5397
5398
5399File: coreutils.info,  Node: tr invocation,  Next: expand invocation,  Up: Operating on characters
5400
54019.1 ‘tr’: Translate, squeeze, and/or delete characters
5402======================================================
5403
5404Synopsis:
5405
5406     tr [OPTION]... SET1 [SET2]
5407
5408   ‘tr’ copies standard input to standard output, performing one of the
5409following operations:
5410
5411   • translate, and optionally squeeze repeated characters in the
5412     result,
5413   • squeeze repeated characters,
5414   • delete characters,
5415   • delete characters, then squeeze repeated characters from the
5416     result.
5417
5418   The SET1 and (if given) SET2 arguments define ordered sets of
5419characters, referred to below as SET1 and SET2.  These sets are the
5420characters of the input that ‘tr’ operates on.  The ‘--complement’
5421(‘-c’, ‘-C’) option replaces SET1 with its complement (all of the
5422characters that are not in SET1).
5423
5424   Currently ‘tr’ fully supports only single-byte characters.
5425Eventually it will support multibyte characters; when it does, the ‘-C’
5426option will cause it to complement the set of characters, whereas ‘-c’
5427will cause it to complement the set of values.  This distinction will
5428matter only when some values are not characters, and this is possible
5429only in locales using multibyte encodings when the input contains
5430encoding errors.
5431
5432   The program accepts the ‘--help’ and ‘--version’ options.  *Note
5433Common options::.  Options must precede operands.
5434
5435   An exit status of zero indicates success, and a nonzero value
5436indicates failure.
5437
5438* Menu:
5439
5440* Character sets::              Specifying sets of characters.
5441* Translating::                 Changing one set of characters to another.
5442* Squeezing and deleting::      Removing characters.
5443
5444
5445File: coreutils.info,  Node: Character sets,  Next: Translating,  Up: tr invocation
5446
54479.1.1 Specifying sets of characters
5448-----------------------------------
5449
5450The format of the SET1 and SET2 arguments resembles the format of
5451regular expressions; however, they are not regular expressions, only
5452lists of characters.  Most characters simply represent themselves in
5453these strings, but the strings can contain the shorthands listed below,
5454for convenience.  Some of them can be used only in SET1 or SET2, as
5455noted below.
5456
5457Backslash escapes
5458
5459     The following backslash escape sequences are recognized:
5460
5461     ‘\a’
5462          Control-G.
5463     ‘\b’
5464          Control-H.
5465     ‘\f’
5466          Control-L.
5467     ‘\n’
5468          Control-J.
5469     ‘\r’
5470          Control-M.
5471     ‘\t’
5472          Control-I.
5473     ‘\v’
5474          Control-K.
5475     ‘\OOO’
5476          The 8-bit character with the value given by OOO, which is 1 to
5477          3 octal digits.  Note that ‘\400’ is interpreted as the
5478          two-byte sequence, ‘\040’ ‘0’.
5479     ‘\\’
5480          A backslash.
5481
5482     While a backslash followed by a character not listed above is
5483     interpreted as that character, the backslash also effectively
5484     removes any special significance, so it is useful to escape ‘[’,
5485     ‘]’, ‘*’, and ‘-’.
5486
5487Ranges
5488
5489     The notation ‘M-N’ expands to all of the characters from M through
5490     N, in ascending order.  M should collate before N; if it doesn’t,
5491     an error results.  As an example, ‘0-9’ is the same as
5492     ‘0123456789’.
5493
5494     GNU ‘tr’ does not support the System V syntax that uses square
5495     brackets to enclose ranges.  Translations specified in that format
5496     sometimes work as expected, since the brackets are often
5497     transliterated to themselves.  However, they should be avoided
5498     because they sometimes behave unexpectedly.  For example, ‘tr -d
5499     '[0-9]'’ deletes brackets as well as digits.
5500
5501     Many historically common and even accepted uses of ranges are not
5502     portable.  For example, on EBCDIC hosts using the ‘A-Z’ range will
5503     not do what most would expect because ‘A’ through ‘Z’ are not
5504     contiguous as they are in ASCII.  If you can rely on a POSIX
5505     compliant version of ‘tr’, then the best way to work around this is
5506     to use character classes (see below).  Otherwise, it is most
5507     portable (and most ugly) to enumerate the members of the ranges.
5508
5509Repeated characters
5510
5511     The notation ‘[C*N]’ in SET2 expands to N copies of character C.
5512     Thus, ‘[y*6]’ is the same as ‘yyyyyy’.  The notation ‘[C*]’ in
5513     STRING2 expands to as many copies of C as are needed to make SET2
5514     as long as SET1.  If N begins with ‘0’, it is interpreted in octal,
5515     otherwise in decimal.
5516
5517Character classes
5518
5519     The notation ‘[:CLASS:]’ expands to all of the characters in the
5520     (predefined) class CLASS.  The characters expand in no particular
5521     order, except for the ‘upper’ and ‘lower’ classes, which expand in
5522     ascending order.  When the ‘--delete’ (‘-d’) and
5523     ‘--squeeze-repeats’ (‘-s’) options are both given, any character
5524     class can be used in SET2.  Otherwise, only the character classes
5525     ‘lower’ and ‘upper’ are accepted in SET2, and then only if the
5526     corresponding character class (‘upper’ and ‘lower’, respectively)
5527     is specified in the same relative position in SET1.  Doing this
5528     specifies case conversion.  The class names are given below; an
5529     error results when an invalid class name is given.
5530
5531     ‘alnum’
5532          Letters and digits.
5533     ‘alpha’
5534          Letters.
5535     ‘blank’
5536          Horizontal whitespace.
5537     ‘cntrl’
5538          Control characters.
5539     ‘digit’
5540          Digits.
5541     ‘graph’
5542          Printable characters, not including space.
5543     ‘lower’
5544          Lowercase letters.
5545     ‘print’
5546          Printable characters, including space.
5547     ‘punct’
5548          Punctuation characters.
5549     ‘space’
5550          Horizontal or vertical whitespace.
5551     ‘upper’
5552          Uppercase letters.
5553     ‘xdigit’
5554          Hexadecimal digits.
5555
5556Equivalence classes
5557
5558     The syntax ‘[=C=]’ expands to all of the characters that are
5559     equivalent to C, in no particular order.  Equivalence classes are a
5560     relatively recent invention intended to support non-English
5561     alphabets.  But there seems to be no standard way to define them or
5562     determine their contents.  Therefore, they are not fully
5563     implemented in GNU ‘tr’; each character’s equivalence class
5564     consists only of that character, which is of no particular use.
5565
5566
5567File: coreutils.info,  Node: Translating,  Next: Squeezing and deleting,  Prev: Character sets,  Up: tr invocation
5568
55699.1.2 Translating
5570-----------------
5571
5572‘tr’ performs translation when SET1 and SET2 are both given and the
5573‘--delete’ (‘-d’) option is not given.  ‘tr’ translates each character
5574of its input that is in SET1 to the corresponding character in SET2.
5575Characters not in SET1 are passed through unchanged.  When a character
5576appears more than once in SET1 and the corresponding characters in SET2
5577are not all the same, only the final one is used.  For example, these
5578two commands are equivalent:
5579
5580     tr aaa xyz
5581     tr a z
5582
5583   A common use of ‘tr’ is to convert lowercase characters to uppercase.
5584This can be done in many ways.  Here are three of them:
5585
5586     tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
5587     tr a-z A-Z
5588     tr '[:lower:]' '[:upper:]'
5589
5590But note that using ranges like ‘a-z’ above is not portable.
5591
5592   When ‘tr’ is performing translation, SET1 and SET2 typically have the
5593same length.  If SET1 is shorter than SET2, the extra characters at the
5594end of SET2 are ignored.
5595
5596   On the other hand, making SET1 longer than SET2 is not portable;
5597POSIX says that the result is undefined.  In this situation, BSD ‘tr’
5598pads SET2 to the length of SET1 by repeating the last character of SET2
5599as many times as necessary.  System V ‘tr’ truncates SET1 to the length
5600of SET2.
5601
5602   By default, GNU ‘tr’ handles this case like BSD ‘tr’.  When the
5603‘--truncate-set1’ (‘-t’) option is given, GNU ‘tr’ handles this case
5604like the System V ‘tr’ instead.  This option is ignored for operations
5605other than translation.
5606
5607   Acting like System V ‘tr’ in this case breaks the relatively common
5608BSD idiom:
5609
5610     tr -cs A-Za-z0-9 '\012'
5611
5612because it converts only zero bytes (the first element in the complement
5613of SET1), rather than all non-alphanumerics, to newlines.
5614
5615By the way, the above idiom is not portable because it uses ranges, and
5616it assumes that the octal code for newline is 012.  Assuming a POSIX
5617compliant ‘tr’, here is a better way to write it:
5618
5619     tr -cs '[:alnum:]' '[\n*]'
5620
5621
5622File: coreutils.info,  Node: Squeezing and deleting,  Prev: Translating,  Up: tr invocation
5623
56249.1.3 Squeezing repeats and deleting
5625------------------------------------
5626
5627When given just the ‘--delete’ (‘-d’) option, ‘tr’ removes any input
5628characters that are in SET1.
5629
5630   When given just the ‘--squeeze-repeats’ (‘-s’) option and not
5631translating, ‘tr’ replaces each input sequence of a repeated character
5632that is in SET1 with a single occurrence of that character.
5633
5634   When given both ‘--delete’ and ‘--squeeze-repeats’, ‘tr’ first
5635performs any deletions using SET1, then squeezes repeats from any
5636remaining characters using SET2.
5637
5638   The ‘--squeeze-repeats’ option may also be used when translating, in
5639which case ‘tr’ first performs translation, then squeezes repeats from
5640any remaining characters using SET2.
5641
5642   Here are some examples to illustrate various combinations of options:
5643
5644   • Remove all zero bytes:
5645
5646          tr -d '\0'
5647
5648   • Put all words on lines by themselves.  This converts all
5649     non-alphanumeric characters to newlines, then squeezes each string
5650     of repeated newlines into a single newline:
5651
5652          tr -cs '[:alnum:]' '[\n*]'
5653
5654   • Convert each sequence of repeated newlines to a single newline.
5655     I.e., delete blank lines:
5656
5657          tr -s '\n'
5658
5659   • Find doubled occurrences of words in a document.  For example,
5660     people often write “the the” with the repeated words separated by a
5661     newline.  The Bourne shell script below works first by converting
5662     each sequence of punctuation and blank characters to a single
5663     newline.  That puts each “word” on a line by itself.  Next it maps
5664     all uppercase characters to lower case, and finally it runs ‘uniq’
5665     with the ‘-d’ option to print out only the words that were
5666     repeated.
5667
5668          #!/bin/sh
5669          cat -- "$@" \
5670            | tr -s '[:punct:][:blank:]' '[\n*]' \
5671            | tr '[:upper:]' '[:lower:]' \
5672            | uniq -d
5673
5674   • Deleting a small set of characters is usually straightforward.  For
5675     example, to remove all ‘a’s, ‘x’s, and ‘M’s you would do this:
5676
5677          tr -d axM
5678
5679     However, when ‘-’ is one of those characters, it can be tricky
5680     because ‘-’ has special meanings.  Performing the same task as
5681     above but also removing all ‘-’ characters, we might try ‘tr -d
5682     -axM’, but that would fail because ‘tr’ would try to interpret ‘-a’
5683     as a command-line option.  Alternatively, we could try putting the
5684     hyphen inside the string, ‘tr -d a-xM’, but that wouldn’t work
5685     either because it would make ‘tr’ interpret ‘a-x’ as the range of
5686     characters ‘a’...‘x’ rather than the three.  One way to solve the
5687     problem is to put the hyphen at the end of the list of characters:
5688
5689          tr -d axM-
5690
5691     Or you can use ‘--’ to terminate option processing:
5692
5693          tr -d -- -axM
5694
5695     More generally, use the character class notation ‘[=c=]’ with ‘-’
5696     (or any other character) in place of the ‘c’:
5697
5698          tr -d '[=-=]axM'
5699
5700     Note how single quotes are used in the above example to protect the
5701     square brackets from interpretation by a shell.
5702
5703
5704File: coreutils.info,  Node: expand invocation,  Next: unexpand invocation,  Prev: tr invocation,  Up: Operating on characters
5705
57069.2 ‘expand’: Convert tabs to spaces
5707====================================
5708
5709‘expand’ writes the contents of each given FILE, or standard input if
5710none are given or for a FILE of ‘-’, to standard output, with tab
5711characters converted to the appropriate number of spaces.  Synopsis:
5712
5713     expand [OPTION]... [FILE]...
5714
5715   By default, ‘expand’ converts all tabs to spaces.  It preserves
5716backspace characters in the output; they decrement the column count for
5717tab calculations.  The default action is equivalent to ‘-t 8’ (set tabs
5718every 8 columns).
5719
5720   The program accepts the following options.  Also see *note Common
5721options::.
5722
5723‘-t TAB1[,TAB2]...’
5724‘--tabs=TAB1[,TAB2]...’
5725     If only one tab stop is given, set the tabs TAB1 spaces apart
5726     (default is 8).  Otherwise, set the tabs at columns TAB1, TAB2, ...
5727     (numbered from 0), and replace any tabs beyond the last tab stop
5728     given with single spaces.  Tab stops can be separated by blanks as
5729     well as by commas.
5730
5731     As a GNU extension the last TAB specified can be prefixed with a
5732     ‘/’ to indicate a tab size to use for remaining positions.  For
5733     example, ‘--tabs=2,4,/8’ will set tab stops at position 2 and 4,
5734     and every multiple of 8 after that.
5735
5736     Also the last TAB specified can be prefixed with a ‘+’ to indicate
5737     a tab size to use for remaining positions, offset from the final
5738     explicitly specified tab stop.  For example, to ignore the 1
5739     character gutter present in diff output, one can specify a 1
5740     character offset using ‘--tabs=1,+8’, which will set tab stops at
5741     positions 1,9,17,...
5742
5743     For compatibility, GNU ‘expand’ also accepts the obsolete option
5744     syntax, ‘-T1[,T2]...’.  New scripts should use ‘-t T1[,T2]...’
5745     instead.
5746
5747‘-i’
5748‘--initial’
5749     Only convert initial tabs (those that precede all non-space or
5750     non-tab characters) on each line to spaces.
5751
5752   An exit status of zero indicates success, and a nonzero value
5753indicates failure.
5754
5755
5756File: coreutils.info,  Node: unexpand invocation,  Prev: expand invocation,  Up: Operating on characters
5757
57589.3 ‘unexpand’: Convert spaces to tabs
5759======================================
5760
5761‘unexpand’ writes the contents of each given FILE, or standard input if
5762none are given or for a FILE of ‘-’, to standard output, converting
5763blanks at the beginning of each line into as many tab characters as
5764needed.  In the default POSIX locale, a “blank” is a space or a tab;
5765other locales may specify additional blank characters.  Synopsis:
5766
5767     unexpand [OPTION]... [FILE]...
5768
5769   By default, ‘unexpand’ converts only initial blanks (those that
5770precede all non-blank characters) on each line.  It preserves backspace
5771characters in the output; they decrement the column count for tab
5772calculations.  By default, tabs are set at every 8th column.
5773
5774   The program accepts the following options.  Also see *note Common
5775options::.
5776
5777‘-t TAB1[,TAB2]...’
5778‘--tabs=TAB1[,TAB2]...’
5779     If only one tab stop is given, set the tabs TAB1 columns apart
5780     instead of the default 8.  Otherwise, set the tabs at columns TAB1,
5781     TAB2, ... (numbered from 0), and leave blanks beyond the tab stops
5782     given unchanged.  Tab stops can be separated by blanks as well as
5783     by commas.
5784
5785     As a GNU extension the last TAB specified can be prefixed with a
5786     ‘/’ to indicate a tab size to use for remaining positions.  For
5787     example, ‘--tabs=2,4,/8’ will set tab stops at position 2 and 4,
5788     and every multiple of 8 after that.
5789
5790     Also the last TAB specified can be prefixed with a ‘+’ to indicate
5791     a tab size to use for remaining positions, offset from the final
5792     explicitly specified tab stop.  For example, to ignore the 1
5793     character gutter present in diff output, one can specify a 1
5794     character offset using ‘--tabs=1,+8’, which will set tab stops at
5795     positions 1,9,17,...
5796
5797     This option implies the ‘-a’ option.
5798
5799     For compatibility, GNU ‘unexpand’ supports the obsolete option
5800     syntax, ‘-TAB1[,TAB2]...’, where tab stops must be separated by
5801     commas.  (Unlike ‘-t’, this obsolete option does not imply ‘-a’.)
5802     New scripts should use ‘--first-only -t TAB1[,TAB2]...’ instead.
5803
5804‘-a’
5805‘--all’
5806     Also convert all sequences of two or more blanks just before a tab
5807     stop, even if they occur after non-blank characters in a line.
5808
5809   An exit status of zero indicates success, and a nonzero value
5810indicates failure.
5811
5812
5813File: coreutils.info,  Node: Directory listing,  Next: Basic operations,  Prev: Operating on characters,  Up: Top
5814
581510 Directory listing
5816********************
5817
5818This chapter describes the ‘ls’ command and its variants ‘dir’ and
5819‘vdir’, which list information about files.
5820
5821* Menu:
5822
5823* ls invocation::               List directory contents.
5824* dir invocation::              Briefly ls.
5825* vdir invocation::             Verbosely ls.
5826* dircolors invocation::        Color setup for ls, etc.
5827
5828
5829File: coreutils.info,  Node: ls invocation,  Next: dir invocation,  Up: Directory listing
5830
583110.1 ‘ls’: List directory contents
5832==================================
5833
5834The ‘ls’ program lists information about files (of any type, including
5835directories).  Options and file arguments can be intermixed arbitrarily,
5836as usual.
5837
5838   For non-option command-line arguments that are directories, by
5839default ‘ls’ lists the contents of directories, not recursively, and
5840omitting files with names beginning with ‘.’.  For other non-option
5841arguments, by default ‘ls’ lists just the file name.  If no non-option
5842argument is specified, ‘ls’ operates on the current directory, acting as
5843if it had been invoked with a single argument of ‘.’.
5844
5845   By default, the output is sorted alphabetically, according to the
5846locale settings in effect.(1)  If standard output is a terminal, the
5847output is in columns (sorted vertically) and control characters are
5848output as question marks; otherwise, the output is listed one per line
5849and control characters are output as-is.
5850
5851   Because ‘ls’ is such a fundamental program, it has accumulated many
5852options over the years.  They are described in the subsections below;
5853within each section, options are listed alphabetically (ignoring case).
5854The division of options into the subsections is not absolute, since some
5855options affect more than one aspect of ‘ls’’s operation.
5856
5857   Exit status:
5858
5859     0 success
5860     1 minor problems  (e.g., failure to access a file or directory not
5861       specified as a command line argument.  This happens when listing a
5862       directory in which entries are actively being removed or renamed.)
5863     2 serious trouble (e.g., memory exhausted, invalid option, failure
5864       to access a file or directory specified as a command line argument
5865       or a directory loop)
5866
5867   Also see *note Common options::.
5868
5869* Menu:
5870
5871* Which files are listed::
5872* What information is listed::
5873* Sorting the output::
5874* General output formatting::
5875* Formatting file timestamps::
5876* Formatting the file names::
5877
5878   ---------- Footnotes ----------
5879
5880   (1) If you use a non-POSIX locale (e.g., by setting ‘LC_ALL’ to
5881‘en_US’), then ‘ls’ may produce output that is sorted differently than
5882you’re accustomed to.  In that case, set the ‘LC_ALL’ environment
5883variable to ‘C’.
5884
5885
5886File: coreutils.info,  Node: Which files are listed,  Next: What information is listed,  Up: ls invocation
5887
588810.1.1 Which files are listed
5889-----------------------------
5890
5891These options determine which files ‘ls’ lists information for.  By
5892default, ‘ls’ lists files and the contents of any directories on the
5893command line, except that in directories it ignores files whose names
5894start with ‘.’.
5895
5896‘-a’
5897‘--all’
5898     In directories, do not ignore file names that start with ‘.’.
5899
5900‘-A’
5901‘--almost-all’
5902     In directories, do not ignore all file names that start with ‘.’;
5903     ignore only ‘.’ and ‘..’.  The ‘--all’ (‘-a’) option overrides this
5904     option.
5905
5906‘-B’
5907‘--ignore-backups’
5908     In directories, ignore files that end with ‘~’.  This option is
5909     equivalent to ‘--ignore='*~' --ignore='.*~'’.
5910
5911‘-d’
5912‘--directory’
5913     List just the names of directories, as with other types of files,
5914     rather than listing their contents.  Do not follow symbolic links
5915     listed on the command line unless the ‘--dereference-command-line’
5916     (‘-H’), ‘--dereference’ (‘-L’), or
5917     ‘--dereference-command-line-symlink-to-dir’ options are specified.
5918
5919‘-H’
5920‘--dereference-command-line’
5921     If a command line argument specifies a symbolic link, show
5922     information for the file the link references rather than for the
5923     link itself.
5924
5925‘--dereference-command-line-symlink-to-dir’
5926     Do not dereference symbolic links, with one exception: if a command
5927     line argument specifies a symbolic link that refers to a directory,
5928     show information for that directory rather than for the link
5929     itself.  This is the default behavior when no other
5930     dereferencing-related option has been specified (‘--classify’
5931     (‘-F’), ‘--directory’ (‘-d’), (‘-l’), ‘--dereference’ (‘-L’), or
5932     ‘--dereference-command-line’ (‘-H’)).
5933
5934‘--group-directories-first’
5935     Group all the directories before the files and then sort the
5936     directories and the files separately using the selected sort key
5937     (see –sort option).  That is, this option specifies a primary sort
5938     key, and the –sort option specifies a secondary key.  However, any
5939     use of ‘--sort=none’ (‘-U’) disables this option altogether.
5940
5941‘--hide=PATTERN’
5942     In directories, ignore files whose names match the shell pattern
5943     PATTERN, unless the ‘--all’ (‘-a’) or ‘--almost-all’ (‘-A’) is also
5944     given.  This option acts like ‘--ignore=PATTERN’ except that it has
5945     no effect if ‘--all’ (‘-a’) or ‘--almost-all’ (‘-A’) is also given.
5946
5947     This option can be useful in shell aliases.  For example, if ‘lx’
5948     is an alias for ‘ls --hide='*~'’ and ‘ly’ is an alias for ‘ls
5949     --ignore='*~'’, then the command ‘lx -A’ lists the file ‘README~’
5950     even though ‘ly -A’ would not.
5951
5952‘-I PATTERN’
5953‘--ignore=PATTERN’
5954     In directories, ignore files whose names match the shell pattern
5955     (not regular expression) PATTERN.  As in the shell, an initial ‘.’
5956     in a file name does not match a wildcard at the start of PATTERN.
5957     Sometimes it is useful to give this option several times.  For
5958     example,
5959
5960          $ ls --ignore='.??*' --ignore='.[^.]' --ignore='#*'
5961
5962     The first option ignores names of length 3 or more that start with
5963     ‘.’, the second ignores all two-character names that start with ‘.’
5964     except ‘..’, and the third ignores names that start with ‘#’.
5965
5966‘-L’
5967‘--dereference’
5968     When showing file information for a symbolic link, show information
5969     for the file the link references rather than the link itself.
5970     However, even with this option, ‘ls’ still prints the name of the
5971     link itself, not the name of the file that the link points to.
5972
5973‘-R’
5974‘--recursive’
5975     List the contents of all directories recursively.
5976
5977
5978File: coreutils.info,  Node: What information is listed,  Next: Sorting the output,  Prev: Which files are listed,  Up: ls invocation
5979
598010.1.2 What information is listed
5981---------------------------------
5982
5983These options affect the information that ‘ls’ displays.  By default,
5984only file names are shown.
5985
5986‘--author’
5987     List each file’s author when producing long format directory
5988     listings.  In GNU/Hurd, file authors can differ from their owners,
5989     but in other operating systems the two are the same.
5990
5991‘-D’
5992‘--dired’
5993     With the long listing (‘-l’) format, print an additional line after
5994     the main output:
5995
5996          //DIRED// BEG1 END1 BEG2 END2 ...
5997
5998     The BEGN and ENDN are unsigned integers that record the byte
5999     position of the beginning and end of each file name in the output.
6000     This makes it easy for Emacs to find the names, even when they
6001     contain unusual characters such as space or newline, without fancy
6002     searching.
6003
6004     If directories are being listed recursively (‘-R’), output a
6005     similar line with offsets for each subdirectory name:
6006
6007          //SUBDIRED// BEG1 END1 ...
6008
6009     Finally, output a line of the form:
6010
6011          //DIRED-OPTIONS// --quoting-style=WORD
6012
6013     where WORD is the quoting style (*note Formatting the file
6014     names::).
6015
6016     Here is an actual example:
6017
6018          $ mkdir -p a/sub/deeper a/sub2
6019          $ touch a/f1 a/f2
6020          $ touch a/sub/deeper/file
6021          $ ls -gloRF --dired a
6022            a:
6023            total 8
6024            -rw-r--r-- 1    0 Jun 10 12:27 f1
6025            -rw-r--r-- 1    0 Jun 10 12:27 f2
6026            drwxr-xr-x 3 4096 Jun 10 12:27 sub/
6027            drwxr-xr-x 2 4096 Jun 10 12:27 sub2/
6028
6029            a/sub:
6030            total 4
6031            drwxr-xr-x 2 4096 Jun 10 12:27 deeper/
6032
6033            a/sub/deeper:
6034            total 0
6035            -rw-r--r-- 1 0 Jun 10 12:27 file
6036
6037            a/sub2:
6038            total 0
6039          //DIRED// 48 50 84 86 120 123 158 162 217 223 282 286
6040          //SUBDIRED// 2 3 167 172 228 240 290 296
6041          //DIRED-OPTIONS// --quoting-style=literal
6042
6043     Note that the pairs of offsets on the ‘//DIRED//’ line above
6044     delimit these names: ‘f1’, ‘f2’, ‘sub’, ‘sub2’, ‘deeper’, ‘file’.
6045     The offsets on the ‘//SUBDIRED//’ line delimit the following
6046     directory names: ‘a’, ‘a/sub’, ‘a/sub/deeper’, ‘a/sub2’.
6047
6048     Here is an example of how to extract the fifth entry name,
6049     ‘deeper’, corresponding to the pair of offsets, 222 and 228:
6050
6051          $ ls -gloRF --dired a > out
6052          $ dd bs=1 skip=222 count=6 < out 2>/dev/null; echo
6053          deeper
6054
6055     Note that although the listing above includes a trailing slash for
6056     the ‘deeper’ entry, the offsets select the name without the
6057     trailing slash.  However, if you invoke ‘ls’ with ‘--dired’ along
6058     with an option like ‘--escape’ (aka ‘-b’) and operate on a file
6059     whose name contains special characters, notice that the backslash
6060     _is_ included:
6061
6062          $ touch 'a b'
6063          $ ls -blog --dired 'a b'
6064            -rw-r--r-- 1 0 Jun 10 12:28 a\ b
6065          //DIRED// 30 34
6066          //DIRED-OPTIONS// --quoting-style=escape
6067
6068     If you use a quoting style that adds quote marks (e.g.,
6069     ‘--quoting-style=c’), then the offsets include the quote marks.  So
6070     beware that the user may select the quoting style via the
6071     environment variable ‘QUOTING_STYLE’.  Hence, applications using
6072     ‘--dired’ should either specify an explicit
6073     ‘--quoting-style=literal’ option (aka ‘-N’ or ‘--literal’) on the
6074     command line, or else be prepared to parse the escaped names.
6075
6076‘--full-time’
6077     Produce long format directory listings, and list times in full.  It
6078     is equivalent to using ‘--format=long’ with ‘--time-style=full-iso’
6079     (*note Formatting file timestamps::).
6080
6081‘-g’
6082     Produce long format directory listings, but don’t display owner
6083     information.
6084
6085‘-G’
6086‘--no-group’
6087     Inhibit display of group information in a long format directory
6088     listing.  (This is the default in some non-GNU versions of ‘ls’, so
6089     we provide this option for compatibility.)
6090
6091‘-h’
6092‘--human-readable’
6093     Append a size letter to each size, such as ‘M’ for mebibytes.
6094     Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes.
6095     This option is equivalent to ‘--block-size=human-readable’.  Use
6096     the ‘--si’ option if you prefer powers of 1000.
6097
6098‘-i’
6099‘--inode’
6100     Print the inode number (also called the file serial number and
6101     index number) of each file to the left of the file name.  (This
6102     number uniquely identifies each file within a particular file
6103     system.)
6104
6105‘-l’
6106‘--format=long’
6107‘--format=verbose’
6108     In addition to the name of each file, print the file type, file
6109     mode bits, number of hard links, owner name, group name, size, and
6110     timestamp (*note Formatting file timestamps::), normally the
6111     modification timestamp (the mtime, *note File timestamps::).  If
6112     the owner or group name cannot be determined, print the owner or
6113     group ID instead, right-justified as a cue that it is a number
6114     rather than a textual name.  Print question marks for other
6115     information that cannot be determined.
6116
6117     Normally the size is printed as a byte count without punctuation,
6118     but this can be overridden (*note Block size::).  For example, ‘-h’
6119     prints an abbreviated, human-readable count, and
6120     ‘--block-size="'1"’ prints a byte count with the thousands
6121     separator of the current locale.
6122
6123     For each directory that is listed, preface the files with a line
6124     ‘total BLOCKS’, where BLOCKS is the total disk allocation for all
6125     files in that directory.  The block size currently defaults to 1024
6126     bytes, but this can be overridden (*note Block size::).  The BLOCKS
6127     computed counts each hard link separately; this is arguably a
6128     deficiency.
6129
6130     The file type is one of the following characters:
6131
6132     ‘-’
6133          regular file
6134     ‘b’
6135          block special file
6136     ‘c’
6137          character special file
6138     ‘C’
6139          high performance (“contiguous data”) file
6140     ‘d’
6141          directory
6142     ‘D’
6143          door (Solaris 2.5 and up)
6144     ‘l’
6145          symbolic link
6146     ‘M’
6147          off-line (“migrated”) file (Cray DMF)
6148     ‘n’
6149          network special file (HP-UX)
6150     ‘p’
6151          FIFO (named pipe)
6152     ‘P’
6153          port (Solaris 10 and up)
6154     ‘s’
6155          socket
6156     ‘?’
6157          some other file type
6158
6159     The file mode bits listed are similar to symbolic mode
6160     specifications (*note Symbolic Modes::).  But ‘ls’ combines
6161     multiple bits into the third character of each set of permissions
6162     as follows:
6163
6164     ‘s’
6165          If the set-user-ID or set-group-ID bit and the corresponding
6166          executable bit are both set.
6167
6168     ‘S’
6169          If the set-user-ID or set-group-ID bit is set but the
6170          corresponding executable bit is not set.
6171
6172     ‘t’
6173          If the restricted deletion flag or sticky bit, and the
6174          other-executable bit, are both set.  The restricted deletion
6175          flag is another name for the sticky bit.  *Note Mode
6176          Structure::.
6177
6178     ‘T’
6179          If the restricted deletion flag or sticky bit is set but the
6180          other-executable bit is not set.
6181
6182     ‘x’
6183          If the executable bit is set and none of the above apply.
6184
6185     ‘-’
6186          Otherwise.
6187
6188     Following the file mode bits is a single character that specifies
6189     whether an alternate access method such as an access control list
6190     applies to the file.  When the character following the file mode
6191     bits is a space, there is no alternate access method.  When it is a
6192     printing character, then there is such a method.
6193
6194     GNU ‘ls’ uses a ‘.’ character to indicate a file with a security
6195     context, but no other alternate access method.
6196
6197     A file with any other combination of alternate access methods is
6198     marked with a ‘+’ character.
6199
6200‘-n’
6201‘--numeric-uid-gid’
6202     Produce long format directory listings, but display right-justified
6203     numeric user and group IDs instead of left-justified owner and
6204     group names.
6205
6206‘-o’
6207     Produce long format directory listings, but don’t display group
6208     information.  It is equivalent to using ‘--format=long’ with
6209     ‘--no-group’ .
6210
6211‘-s’
6212‘--size’
6213     Print the disk allocation of each file to the left of the file
6214     name.  This is the amount of disk space used by the file, which is
6215     usually a bit more than the file’s size, but it can be less if the
6216     file has holes.
6217
6218     Normally the disk allocation is printed in units of 1024 bytes, but
6219     this can be overridden (*note Block size::).
6220
6221     For files that are NFS-mounted from an HP-UX system to a BSD
6222     system, this option reports sizes that are half the correct values.
6223     On HP-UX systems, it reports sizes that are twice the correct
6224     values for files that are NFS-mounted from BSD systems.  This is
6225     due to a flaw in HP-UX; it also affects the HP-UX ‘ls’ program.
6226
6227‘--si’
6228     Append an SI-style abbreviation to each size, such as ‘M’ for
6229     megabytes.  Powers of 1000 are used, not 1024; ‘M’ stands for
6230     1,000,000 bytes.  This option is equivalent to ‘--block-size=si’.
6231     Use the ‘-h’ or ‘--human-readable’ option if you prefer powers of
6232     1024.
6233
6234‘-Z’
6235‘--context’
6236     Display the SELinux security context or ‘?’ if none is found.  When
6237     used with the ‘-l’ option, print the security context to the left
6238     of the size column.
6239
6240
6241File: coreutils.info,  Node: Sorting the output,  Next: General output formatting,  Prev: What information is listed,  Up: ls invocation
6242
624310.1.3 Sorting the output
6244-------------------------
6245
6246These options change the order in which ‘ls’ sorts the information it
6247outputs.  By default, sorting is done by character code (e.g., ASCII
6248order).
6249
6250‘-c’
6251‘--time=ctime’
6252‘--time=status’
6253     If the long listing format (e.g., ‘-l’, ‘-o’) is being used, print
6254     the status change timestamp (the ctime) instead of the mtime.  When
6255     explicitly sorting by time (‘--sort=time’ or ‘-t’) or when not
6256     using a long listing format, sort according to the ctime.  *Note
6257     File timestamps::.
6258
6259‘-f’
6260     Primarily, like ‘-U’—do not sort; list the files in whatever order
6261     they are stored in the directory.  But also enable ‘-a’ (list all
6262     files) and disable ‘-l’, ‘--color’, and ‘-s’ (if they were
6263     specified before the ‘-f’).
6264
6265‘-r’
6266‘--reverse’
6267     Reverse whatever the sorting method is—e.g., list files in reverse
6268     alphabetical order, youngest first, smallest first, or whatever.
6269
6270‘-S’
6271‘--sort=size’
6272     Sort by file size, largest first.
6273
6274‘-t’
6275‘--sort=time’
6276     Sort by modification timestamp (mtime) by default, newest first.
6277     The timestamp to order by can be changed with the ‘--time’ option.
6278     *Note File timestamps::.
6279
6280‘-u’
6281‘--time=atime’
6282‘--time=access’
6283‘--time=use’
6284     If the long listing format (e.g., ‘--format=long’) is being used,
6285     print the last access timestamp (the atime).  When explicitly
6286     sorting by time (‘--sort=time’ or ‘-t’) or when not using a long
6287     listing format, sort according to the atime.  *Note File
6288     timestamps::.
6289
6290‘--time=birth’
6291‘--time=creation’
6292     If the long listing format (e.g., ‘--format=long’) is being used,
6293     print the file creation timestamp if available.  When explicitly
6294     sorting by time (‘--sort=time’ or ‘-t’) or when not using a long
6295     listing format, sort according to the birth time.  *Note File
6296     timestamps::.
6297
6298‘-U’
6299‘--sort=none’
6300     Do not sort; list the files in whatever order they are stored in
6301     the directory.  (Do not do any of the other unrelated things that
6302     ‘-f’ does.)  This is especially useful when listing very large
6303     directories, since not doing any sorting can be noticeably faster.
6304
6305‘-v’
6306‘--sort=version’
6307     Sort by version name and number, lowest first.  It behaves like a
6308     default sort, except that each sequence of decimal digits is
6309     treated numerically as an index/version number.  (*Note Version
6310     sort ordering::.)
6311
6312‘-X’
6313‘--sort=extension’
6314     Sort directory contents alphabetically by file extension
6315     (characters after the last ‘.’); files with no extension are sorted
6316     first.
6317
6318
6319File: coreutils.info,  Node: General output formatting,  Next: Formatting file timestamps,  Prev: Sorting the output,  Up: ls invocation
6320
632110.1.4 General output formatting
6322--------------------------------
6323
6324These options affect the appearance of the overall output.
6325
6326‘-1’
6327‘--format=single-column’
6328     List one file per line.  This is the default for ‘ls’ when standard
6329     output is not a terminal.  See also the ‘-b’ and ‘-q’ options to
6330     suppress direct output of newline characters within a file name.
6331
6332‘-C’
6333‘--format=vertical’
6334     List files in columns, sorted vertically.  This is the default for
6335     ‘ls’ if standard output is a terminal.  It is always the default
6336     for the ‘dir’ program.  GNU ‘ls’ uses variable width columns to
6337     display as many files as possible in the fewest lines.
6338
6339‘--color [=WHEN]’
6340     Specify whether to use color for distinguishing file types.  WHEN
6341     may be omitted, or one of:
6342        • none - Do not use color at all.  This is the default.
6343        • auto - Only use color if standard output is a terminal.
6344        • always - Always use color.
6345     Specifying ‘--color’ and no WHEN is equivalent to ‘--color=always’.
6346     If piping a colorized listing through a pager like ‘less’, use the
6347     ‘-R’ option to pass the color codes to the terminal.
6348
6349     Note that using the ‘--color’ option may incur a noticeable
6350     performance penalty when run in a directory with very many entries,
6351     because the default settings require that ‘ls’ ‘stat’ every single
6352     file it lists.  However, if you would like most of the file-type
6353     coloring but can live without the other coloring options (e.g.,
6354     executable, orphan, sticky, other-writable, capability), use
6355     ‘dircolors’ to set the ‘LS_COLORS’ environment variable like this,
6356          eval $(dircolors -p | perl -pe \
6357            's/^((CAP|S[ET]|O[TR]|M|E)\w+).*/$1 00/' | dircolors -)
6358     and on a ‘dirent.d_type’-capable file system, ‘ls’ will perform
6359     only one ‘stat’ call per command line argument.
6360
6361‘-F’
6362‘--classify’
6363‘--indicator-style=classify’
6364     Append a character to each file name indicating the file type.
6365     Also, for regular files that are executable, append ‘*’.  The file
6366     type indicators are ‘/’ for directories, ‘@’ for symbolic links,
6367     ‘|’ for FIFOs, ‘=’ for sockets, ‘>’ for doors, and nothing for
6368     regular files.  Do not follow symbolic links listed on the command
6369     line unless the ‘--dereference-command-line’ (‘-H’),
6370     ‘--dereference’ (‘-L’), or
6371     ‘--dereference-command-line-symlink-to-dir’ options are specified.
6372
6373‘--file-type’
6374‘--indicator-style=file-type’
6375     Append a character to each file name indicating the file type.
6376     This is like ‘-F’, except that executables are not marked.
6377
6378‘--hyperlink [=WHEN]’
6379     Output codes recognized by some terminals to link to files using
6380     the ‘file://’ URI format.  WHEN may be omitted, or one of:
6381        • none - Do not use hyperlinks at all.  This is the default.
6382        • auto - Only use hyperlinks if standard output is a terminal.
6383        • always - Always use hyperlinks.
6384     Specifying ‘--hyperlink’ and no WHEN is equivalent to
6385     ‘--hyperlink=always’.
6386
6387‘--indicator-style=WORD’
6388     Append a character indicator with style WORD to entry names, as
6389     follows:
6390
6391     ‘none’
6392          Do not append any character indicator; this is the default.
6393     ‘slash’
6394          Append ‘/’ for directories.  This is the same as the ‘-p’
6395          option.
6396     ‘file-type’
6397          Append ‘/’ for directories, ‘@’ for symbolic links, ‘|’ for
6398          FIFOs, ‘=’ for sockets, and nothing for regular files.  This
6399          is the same as the ‘--file-type’ option.
6400     ‘classify’
6401          Append ‘*’ for executable regular files, otherwise behave as
6402          for ‘file-type’.  This is the same as the ‘-F’ or ‘--classify’
6403          option.
6404
6405‘-k’
6406‘--kibibytes’
6407     Set the default block size to its normal value of 1024 bytes,
6408     overriding any contrary specification in environment variables
6409     (*note Block size::).  If ‘--block-size’, ‘-h’, ‘--human-readable’,
6410     or ‘--si’ options are used, they take precedence over ‘-k’ or
6411     ‘--kibibytes’ even if ‘-k’ or ‘--kibibytes’ is placed after the
6412     other options.
6413
6414     The ‘-k’ or ‘--kibibytes’ option affects the per-directory block
6415     count written by the ‘-l’ and similar options, and the size written
6416     by the ‘-s’ or ‘--size’ option.  It does not affect the file size
6417     written by ‘-l’.
6418
6419‘-m’
6420‘--format=commas’
6421     List files horizontally, with as many as will fit on each line,
6422     separated by ‘, ’ (a comma and a space).
6423
6424‘-p’
6425‘--indicator-style=slash’
6426     Append a ‘/’ to directory names.
6427
6428‘-x’
6429‘--format=across’
6430‘--format=horizontal’
6431     List the files in columns, sorted horizontally.
6432
6433‘-T COLS’
6434‘--tabsize=COLS’
6435     Assume that each tab stop is COLS columns wide.  The default is 8.
6436     ‘ls’ uses tabs where possible in the output, for efficiency.  If
6437     COLS is zero, do not use tabs at all.
6438
6439     Some terminal emulators might not properly align columns to the
6440     right of a TAB following a non-ASCII byte.  You can avoid that
6441     issue by using the ‘-T0’ option or put ‘TABSIZE=0’ in your
6442     environment, to tell ‘ls’ to align using spaces, not tabs.
6443
6444‘-w COLS’
6445‘--width=COLS’
6446     Assume the screen is COLS columns wide.  The default is taken from
6447     the terminal settings if possible; otherwise the environment
6448     variable ‘COLUMNS’ is used if it is set; otherwise the default is
6449     80.  With a COLS value of ‘0’, there is no limit on the length of
6450     the output line, and that single output line will be delimited with
6451     spaces, not tabs.
6452
6453
6454File: coreutils.info,  Node: Formatting file timestamps,  Next: Formatting the file names,  Prev: General output formatting,  Up: ls invocation
6455
645610.1.5 Formatting file timestamps
6457---------------------------------
6458
6459By default, file timestamps are listed in abbreviated form, using a date
6460like ‘Mar 30  2002’ for non-recent timestamps, and a date-without-year
6461and time like ‘Mar 30 23:45’ for recent timestamps.  This format can
6462change depending on the current locale as detailed below.
6463
6464   A timestamp is considered to be “recent” if it is less than six
6465months old, and is not dated in the future.  If a timestamp dated today
6466is not listed in recent form, the timestamp is in the future, which
6467means you probably have clock skew problems which may break programs
6468like ‘make’ that rely on file timestamps.  *Note File timestamps::.
6469
6470   Timestamps are listed according to the time zone rules specified by
6471the ‘TZ’ environment variable, or by the system default rules if ‘TZ’ is
6472not set.  *Note Specifying the Time Zone with ‘TZ’: (libc)TZ Variable.
6473
6474   The following option changes how file timestamps are printed.
6475
6476‘--time-style=STYLE’
6477     List timestamps in style STYLE.  The STYLE should be one of the
6478     following:
6479
6480     ‘+FORMAT’
6481          List timestamps using FORMAT, where FORMAT is interpreted like
6482          the format argument of ‘date’ (*note date invocation::).  For
6483          example, ‘--time-style="+%Y-%m-%d %H:%M:%S"’ causes ‘ls’ to
6484          list timestamps like ‘2002-03-30 23:45:56’.  As with ‘date’,
6485          FORMAT’s interpretation is affected by the ‘LC_TIME’ locale
6486          category.
6487
6488          If FORMAT contains two format strings separated by a newline,
6489          the former is used for non-recent files and the latter for
6490          recent files; if you want output columns to line up, you may
6491          need to insert spaces in one of the two formats.
6492
6493     ‘full-iso’
6494          List timestamps in full using ISO 8601-like date, time, and
6495          time zone components with nanosecond precision, e.g.,
6496          ‘2002-03-30 23:45:56.477817180 -0700’.  This style is
6497          equivalent to ‘+%Y-%m-%d %H:%M:%S.%N %z’.
6498
6499          This is useful because the time output includes all the
6500          information that is available from the operating system.  For
6501          example, this can help explain ‘make’’s behavior, since GNU
6502          ‘make’ uses the full timestamp to determine whether a file is
6503          out of date.
6504
6505     ‘long-iso’
6506          List ISO 8601 date and time components with minute precision,
6507          e.g., ‘2002-03-30 23:45’.  These timestamps are shorter than
6508          ‘full-iso’ timestamps, and are usually good enough for
6509          everyday work.  This style is equivalent to ‘+%Y-%m-%d %H:%M’.
6510
6511     ‘iso’
6512          List ISO 8601 dates for non-recent timestamps (e.g.,
6513          ‘2002-03-30 ’), and ISO 8601-like month, day, hour, and minute
6514          for recent timestamps (e.g., ‘03-30 23:45’).  These timestamps
6515          are uglier than ‘long-iso’ timestamps, but they carry nearly
6516          the same information in a smaller space and their brevity
6517          helps ‘ls’ output fit within traditional 80-column output
6518          lines.  The following two ‘ls’ invocations are equivalent:
6519
6520               newline='
6521               '
6522               ls -l --time-style="+%Y-%m-%d $newline%m-%d %H:%M"
6523               ls -l --time-style="iso"
6524
6525     ‘locale’
6526          List timestamps in a locale-dependent form.  For example, a
6527          Finnish locale might list non-recent timestamps like ‘maalis
6528          30  2002’ and recent timestamps like ‘maalis 30 23:45’.
6529          Locale-dependent timestamps typically consume more space than
6530          ‘iso’ timestamps and are harder for programs to parse because
6531          locale conventions vary so widely, but they are easier for
6532          many people to read.
6533
6534          The ‘LC_TIME’ locale category specifies the timestamp format.
6535          The default POSIX locale uses timestamps like ‘Mar 30  2002’
6536          and ‘Mar 30 23:45’; in this locale, the following two ‘ls’
6537          invocations are equivalent:
6538
6539               newline='
6540               '
6541               ls -l --time-style="+%b %e  %Y$newline%b %e %H:%M"
6542               ls -l --time-style="locale"
6543
6544          Other locales behave differently.  For example, in a German
6545          locale, ‘--time-style="locale"’ might be equivalent to
6546          ‘--time-style="+%e. %b %Y $newline%e. %b %H:%M"’ and might
6547          generate timestamps like ‘30. Mär 2002 ’ and ‘30. Mär 23:45’.
6548
6549     ‘posix-STYLE’
6550          List POSIX-locale timestamps if the ‘LC_TIME’ locale category
6551          is POSIX, STYLE timestamps otherwise.  For example, the
6552          ‘posix-long-iso’ style lists timestamps like ‘Mar 30  2002’
6553          and ‘Mar 30 23:45’ when in the POSIX locale, and like
6554          ‘2002-03-30 23:45’ otherwise.
6555
6556   You can specify the default value of the ‘--time-style’ option with
6557the environment variable ‘TIME_STYLE’; if ‘TIME_STYLE’ is not set the
6558default style is ‘locale’.  GNU Emacs 21.3 and later use the ‘--dired’
6559option and therefore can parse any date format, but if you are using
6560Emacs 21.1 or 21.2 and specify a non-POSIX locale you may need to set
6561‘TIME_STYLE="posix-long-iso"’.
6562
6563   To avoid certain denial-of-service attacks, timestamps that would be
6564longer than 1000 bytes may be treated as errors.
6565
6566
6567File: coreutils.info,  Node: Formatting the file names,  Prev: Formatting file timestamps,  Up: ls invocation
6568
656910.1.6 Formatting the file names
6570--------------------------------
6571
6572These options change how file names themselves are printed.
6573
6574‘-b’
6575‘--escape’
6576‘--quoting-style=escape’
6577     Quote nongraphic characters in file names using alphabetic and
6578     octal backslash sequences like those used in C.
6579
6580‘-N’
6581‘--literal’
6582‘--quoting-style=literal’
6583     Do not quote file names.  However, with ‘ls’ nongraphic characters
6584     are still printed as question marks if the output is a terminal and
6585     you do not specify the ‘--show-control-chars’ option.
6586
6587‘-q’
6588‘--hide-control-chars’
6589     Print question marks instead of nongraphic characters in file
6590     names.  This is the default if the output is a terminal and the
6591     program is ‘ls’.
6592
6593‘-Q’
6594‘--quote-name’
6595‘--quoting-style=c’
6596     Enclose file names in double quotes and quote nongraphic characters
6597     as in C.
6598
6599‘--quoting-style=WORD’
6600     Use style WORD to quote file names and other strings that may
6601     contain arbitrary characters.  The WORD should be one of the
6602     following:
6603
6604     ‘literal’
6605          Output strings as-is; this is the same as the ‘-N’ or
6606          ‘--literal’ option.
6607     ‘shell’
6608          Quote strings for the shell if they contain shell
6609          metacharacters or would cause ambiguous output.  The quoting
6610          is suitable for POSIX-compatible shells like ‘bash’, but it
6611          does not always work for incompatible shells like ‘csh’.
6612     ‘shell-always’
6613          Quote strings for the shell, even if they would normally not
6614          require quoting.
6615     ‘shell-escape’
6616          Like ‘shell’, but also quoting non-printable characters using
6617          the POSIX proposed ‘$''’ syntax suitable for most shells.
6618     ‘shell-escape-always’
6619          Like ‘shell-escape’, but quote strings even if they would
6620          normally not require quoting.
6621     ‘c’
6622          Quote strings as for C character string literals, including
6623          the surrounding double-quote characters; this is the same as
6624          the ‘-Q’ or ‘--quote-name’ option.
6625     ‘escape’
6626          Quote strings as for C character string literals, except omit
6627          the surrounding double-quote characters; this is the same as
6628          the ‘-b’ or ‘--escape’ option.
6629     ‘clocale’
6630          Quote strings as for C character string literals, except use
6631          surrounding quotation marks appropriate for the locale.
6632     ‘locale’
6633          Quote strings as for C character string literals, except use
6634          surrounding quotation marks appropriate for the locale, and
6635          quote 'like this' instead of "like this" in the default C
6636          locale.  This looks nicer on many displays.
6637
6638     You can specify the default value of the ‘--quoting-style’ option
6639     with the environment variable ‘QUOTING_STYLE’.  If that environment
6640     variable is not set, the default value is ‘shell-escape’ when the
6641     output is a terminal, and ‘literal’ otherwise.
6642
6643‘--show-control-chars’
6644     Print nongraphic characters as-is in file names.  This is the
6645     default unless the output is a terminal and the program is ‘ls’.
6646
6647
6648File: coreutils.info,  Node: dir invocation,  Next: vdir invocation,  Prev: ls invocation,  Up: Directory listing
6649
665010.2 ‘dir’: Briefly list directory contents
6651===========================================
6652
6653‘dir’ is equivalent to ‘ls -C -b’; that is, by default files are listed
6654in columns, sorted vertically, and special characters are represented by
6655backslash escape sequences.
6656
6657   *Note ‘ls’: ls invocation.
6658
6659
6660File: coreutils.info,  Node: vdir invocation,  Next: dircolors invocation,  Prev: dir invocation,  Up: Directory listing
6661
666210.3 ‘vdir’: Verbosely list directory contents
6663==============================================
6664
6665‘vdir’ is equivalent to ‘ls -l -b’; that is, by default files are listed
6666in long format and special characters are represented by backslash
6667escape sequences.
6668
6669   *Note ‘ls’: ls invocation.
6670
6671
6672File: coreutils.info,  Node: dircolors invocation,  Prev: vdir invocation,  Up: Directory listing
6673
667410.4 ‘dircolors’: Color setup for ‘ls’
6675======================================
6676
6677‘dircolors’ outputs a sequence of shell commands to set up the terminal
6678for color output from ‘ls’ (and ‘dir’, etc.).  Typical usage:
6679
6680     eval "$(dircolors [OPTION]... [FILE])"
6681
6682   If FILE is specified, ‘dircolors’ reads it to determine which colors
6683to use for which file types and extensions.  Otherwise, a precompiled
6684database is used.  For details on the format of these files, run
6685‘dircolors --print-database’.
6686
6687   To make ‘dircolors’ read a ‘~/.dircolors’ file if it exists, you can
6688put the following lines in your ‘~/.bashrc’ (or adapt them to your
6689favorite shell):
6690
6691     d=.dircolors
6692     test -r $d && eval "$(dircolors $d)"
6693
6694   The output is a shell command to set the ‘LS_COLORS’ environment
6695variable.  You can specify the shell syntax to use on the command line,
6696or ‘dircolors’ will guess it from the value of the ‘SHELL’ environment
6697variable.
6698
6699   The program accepts the following options.  Also see *note Common
6700options::.
6701
6702‘-b’
6703‘--sh’
6704‘--bourne-shell’
6705     Output Bourne shell commands.  This is the default if the ‘SHELL’
6706     environment variable is set and does not end with ‘csh’ or ‘tcsh’.
6707
6708‘-c’
6709‘--csh’
6710‘--c-shell’
6711     Output C shell commands.  This is the default if ‘SHELL’ ends with
6712     ‘csh’ or ‘tcsh’.
6713
6714‘-p’
6715‘--print-database’
6716     Print the (compiled-in) default color configuration database.  This
6717     output is itself a valid configuration file, and is fairly
6718     descriptive of the possibilities.
6719
6720   An exit status of zero indicates success, and a nonzero value
6721indicates failure.
6722
6723
6724File: coreutils.info,  Node: Basic operations,  Next: Special file types,  Prev: Directory listing,  Up: Top
6725
672611 Basic operations
6727*******************
6728
6729This chapter describes the commands for basic file manipulation:
6730copying, moving (renaming), and deleting (removing).
6731
6732* Menu:
6733
6734* cp invocation::               Copy files.
6735* dd invocation::               Convert and copy a file.
6736* install invocation::          Copy files and set attributes.
6737* mv invocation::               Move (rename) files.
6738* rm invocation::               Remove files or directories.
6739* shred invocation::            Remove files more securely.
6740
6741
6742File: coreutils.info,  Node: cp invocation,  Next: dd invocation,  Up: Basic operations
6743
674411.1 ‘cp’: Copy files and directories
6745=====================================
6746
6747‘cp’ copies files (or, optionally, directories).  The copy is completely
6748independent of the original.  You can either copy one file to another,
6749or copy arbitrarily many files to a destination directory.  Synopses:
6750
6751     cp [OPTION]... [-T] SOURCE DEST
6752     cp [OPTION]... SOURCE... DIRECTORY
6753     cp [OPTION]... -t DIRECTORY SOURCE...
6754
6755   • If two file names are given, ‘cp’ copies the first file to the
6756     second.
6757
6758   • If the ‘--target-directory’ (‘-t’) option is given, or failing that
6759     if the last file is a directory and the ‘--no-target-directory’
6760     (‘-T’) option is not given, ‘cp’ copies each SOURCE file to the
6761     specified directory, using the SOURCEs’ names.
6762
6763   Generally, files are written just as they are read.  For exceptions,
6764see the ‘--sparse’ option below.
6765
6766   By default, ‘cp’ does not copy directories.  However, the ‘-R’, ‘-a’,
6767and ‘-r’ options cause ‘cp’ to copy recursively by descending into
6768source directories and copying files to corresponding destination
6769directories.
6770
6771   When copying from a symbolic link, ‘cp’ normally follows the link
6772only when not copying recursively or when ‘--link’ (‘-l’) is used.  This
6773default can be overridden with the ‘--archive’ (‘-a’), ‘-d’,
6774‘--dereference’ (‘-L’), ‘--no-dereference’ (‘-P’), and ‘-H’ options.  If
6775more than one of these options is specified, the last one silently
6776overrides the others.
6777
6778   When copying to a symbolic link, ‘cp’ follows the link only when it
6779refers to an existing regular file.  However, when copying to a dangling
6780symbolic link, ‘cp’ refuses by default, and fails with a diagnostic,
6781since the operation is inherently dangerous.  This behavior is contrary
6782to historical practice and to POSIX.  Set ‘POSIXLY_CORRECT’ to make ‘cp’
6783attempt to create the target of a dangling destination symlink, in spite
6784of the possible risk.  Also, when an option like ‘--backup’ or ‘--link’
6785acts to rename or remove the destination before copying, ‘cp’ renames or
6786removes the symbolic link rather than the file it points to.
6787
6788   By default, ‘cp’ copies the contents of special files only when not
6789copying recursively.  This default can be overridden with the
6790‘--copy-contents’ option.
6791
6792   ‘cp’ generally refuses to copy a file onto itself, with the following
6793exception: if ‘--force --backup’ is specified with SOURCE and DEST
6794identical, and referring to a regular file, ‘cp’ will make a backup
6795file, either regular or numbered, as specified in the usual ways (*note
6796Backup options::).  This is useful when you simply want to make a backup
6797of an existing file before changing it.
6798
6799   The program accepts the following options.  Also see *note Common
6800options::.
6801
6802‘-a’
6803‘--archive’
6804     Preserve as much as possible of the structure and attributes of the
6805     original files in the copy (but do not attempt to preserve internal
6806     directory structure; i.e., ‘ls -U’ may list the entries in a copied
6807     directory in a different order).  Try to preserve SELinux security
6808     context and extended attributes (xattr), but ignore any failure to
6809     do that and print no corresponding diagnostic.  Equivalent to ‘-dR
6810     --preserve=all’ with the reduced diagnostics.
6811
6812‘--attributes-only’
6813     Copy only the specified attributes of the source file to the
6814     destination.  If the destination already exists, do not alter its
6815     contents.  See the ‘--preserve’ option for controlling which
6816     attributes to copy.
6817
6818‘-b’
6819‘--backup[=METHOD]’
6820     *Note Backup options::.  Make a backup of each file that would
6821     otherwise be overwritten or removed.  As a special case, ‘cp’ makes
6822     a backup of SOURCE when the force and backup options are given and
6823     SOURCE and DEST are the same name for an existing, regular file.
6824     One useful application of this combination of options is this tiny
6825     Bourne shell script:
6826
6827          #!/bin/sh
6828          # Usage: backup FILE...
6829          # Create a GNU-style backup of each listed FILE.
6830          fail=0
6831          for i; do
6832            cp --backup --force --preserve=all -- "$i" "$i" || fail=1
6833          done
6834          exit $fail
6835
6836‘--copy-contents’
6837     If copying recursively, copy the contents of any special files
6838     (e.g., FIFOs and device files) as if they were regular files.  This
6839     means trying to read the data in each source file and writing it to
6840     the destination.  It is usually a mistake to use this option, as it
6841     normally has undesirable effects on special files like FIFOs and
6842     the ones typically found in the ‘/dev’ directory.  In most cases,
6843     ‘cp -R --copy-contents’ will hang indefinitely trying to read from
6844     FIFOs and special files like ‘/dev/console’, and it will fill up
6845     your destination disk if you use it to copy ‘/dev/zero’.  This
6846     option has no effect unless copying recursively, and it does not
6847     affect the copying of symbolic links.
6848
6849‘-d’
6850     Copy symbolic links as symbolic links rather than copying the files
6851     that they point to, and preserve hard links between source files in
6852     the copies.  Equivalent to ‘--no-dereference --preserve=links’.
6853
6854‘-f’
6855‘--force’
6856     When copying without this option and an existing destination file
6857     cannot be opened for writing, the copy fails.  However, with
6858     ‘--force’, when a destination file cannot be opened, ‘cp’ then
6859     tries to recreate the file by first removing it.  Note ‘--force’
6860     alone will not remove dangling symlinks.  When this option is
6861     combined with ‘--link’ (‘-l’) or ‘--symbolic-link’ (‘-s’), the
6862     destination link is replaced, and unless ‘--backup’ (‘-b’) is also
6863     given there is no brief moment when the destination does not exist.
6864     Also see the description of ‘--remove-destination’.
6865
6866     This option is independent of the ‘--interactive’ or ‘-i’ option:
6867     neither cancels the effect of the other.
6868
6869     This option is ignored when the ‘--no-clobber’ or ‘-n’ option is
6870     also used.
6871
6872‘-H’
6873     If a command line argument specifies a symbolic link, then copy the
6874     file it points to rather than the symbolic link itself.  However,
6875     copy (preserving its nature) any symbolic link that is encountered
6876     via recursive traversal.
6877
6878‘-i’
6879‘--interactive’
6880     When copying a file other than a directory, prompt whether to
6881     overwrite an existing destination file.  The ‘-i’ option overrides
6882     a previous ‘-n’ option.
6883
6884‘-l’
6885‘--link’
6886     Make hard links instead of copies of non-directories.
6887
6888‘-L’
6889‘--dereference’
6890     Follow symbolic links when copying from them.  With this option,
6891     ‘cp’ cannot create a symbolic link.  For example, a symlink (to
6892     regular file) in the source tree will be copied to a regular file
6893     in the destination tree.
6894
6895‘-n’
6896‘--no-clobber’
6897     Do not overwrite an existing file; silently do nothing instead.
6898     This option overrides a previous ‘-i’ option.  This option is
6899     mutually exclusive with ‘-b’ or ‘--backup’ option.
6900
6901‘-P’
6902‘--no-dereference’
6903     Copy symbolic links as symbolic links rather than copying the files
6904     that they point to.  This option affects only symbolic links in the
6905     source; symbolic links in the destination are always followed if
6906     possible.
6907
6908‘-p’
6909‘--preserve[=ATTRIBUTE_LIST]’
6910     Preserve the specified attributes of the original files.  If
6911     specified, the ATTRIBUTE_LIST must be a comma-separated list of one
6912     or more of the following strings:
6913
6914     ‘mode’
6915          Preserve the file mode bits and access control lists.
6916     ‘ownership’
6917          Preserve the owner and group.  On most modern systems, only
6918          users with appropriate privileges may change the owner of a
6919          file, and ordinary users may preserve the group ownership of a
6920          file only if they happen to be a member of the desired group.
6921     ‘timestamps’
6922          Preserve the times of last access and last modification, when
6923          possible.  On older systems, it is not possible to preserve
6924          these attributes when the affected file is a symbolic link.
6925          However, many systems now provide the ‘utimensat’ function,
6926          which makes it possible even for symbolic links.
6927     ‘links’
6928          Preserve in the destination files any links between
6929          corresponding source files.  Note that with ‘-L’ or ‘-H’, this
6930          option can convert symbolic links to hard links.  For example,
6931               $ mkdir c; : > a; ln -s a b; cp -aH a b c; ls -i1 c
6932               74161745 a
6933               74161745 b
6934          Note the inputs: ‘b’ is a symlink to regular file ‘a’, yet the
6935          files in destination directory, ‘c/’, are hard-linked.  Since
6936          ‘-a’ implies ‘--no-dereference’ it would copy the symlink, but
6937          the later ‘-H’ tells ‘cp’ to dereference the command line
6938          arguments where it then sees two files with the same inode
6939          number.  Then the ‘--preserve=links’ option also implied by
6940          ‘-a’ will preserve the perceived hard link.
6941
6942          Here is a similar example that exercises ‘cp’’s ‘-L’ option:
6943               $ mkdir b c; (cd b; : > a; ln -s a b); cp -aL b c; ls -i1 c/b
6944               74163295 a
6945               74163295 b
6946
6947     ‘context’
6948          Preserve SELinux security context of the file, or fail with
6949          full diagnostics.
6950     ‘xattr’
6951          Preserve extended attributes of the file, or fail with full
6952          diagnostics.  If ‘cp’ is built without xattr support, ignore
6953          this option.  If SELinux context, ACLs or Capabilities are
6954          implemented using xattrs, they are preserved implicitly by
6955          this option as well, i.e., even without specifying
6956          ‘--preserve=mode’ or ‘--preserve=context’.
6957     ‘all’
6958          Preserve all file attributes.  Equivalent to specifying all of
6959          the above, but with the difference that failure to preserve
6960          SELinux security context or extended attributes does not
6961          change ‘cp’’s exit status.  In contrast to ‘-a’, all but
6962          ‘Operation not supported’ warnings are output.
6963
6964     Using ‘--preserve’ with no ATTRIBUTE_LIST is equivalent to
6965     ‘--preserve=mode,ownership,timestamps’.
6966
6967     In the absence of this option, the permissions of existing
6968     destination files are unchanged.  Each new file is created with the
6969     mode of the corresponding source file minus the set-user-ID,
6970     set-group-ID, and sticky bits as the create mode; the operating
6971     system then applies either the umask or a default ACL, possibly
6972     resulting in a more restrictive file mode.  *Note File
6973     permissions::.
6974
6975‘--no-preserve=ATTRIBUTE_LIST’
6976     Do not preserve the specified attributes.  The ATTRIBUTE_LIST has
6977     the same form as for ‘--preserve’.
6978
6979‘--parents’
6980     Form the name of each destination file by appending to the target
6981     directory a slash and the specified name of the source file.  The
6982     last argument given to ‘cp’ must be the name of an existing
6983     directory.  For example, the command:
6984
6985          cp --parents a/b/c existing_dir
6986
6987     copies the file ‘a/b/c’ to ‘existing_dir/a/b/c’, creating any
6988     missing intermediate directories.
6989
6990‘-R’
6991‘-r’
6992‘--recursive’
6993     Copy directories recursively.  By default, do not follow symbolic
6994     links in the source unless used together with the ‘--link’ (‘-l’)
6995     option; see the ‘--archive’ (‘-a’), ‘-d’, ‘--dereference’ (‘-L’),
6996     ‘--no-dereference’ (‘-P’), and ‘-H’ options.  Special files are
6997     copied by creating a destination file of the same type as the
6998     source; see the ‘--copy-contents’ option.  It is not portable to
6999     use ‘-r’ to copy symbolic links or special files.  On some non-GNU
7000     systems, ‘-r’ implies the equivalent of ‘-L’ and ‘--copy-contents’
7001     for historical reasons.  Also, it is not portable to use ‘-R’ to
7002     copy symbolic links unless you also specify ‘-P’, as POSIX allows
7003     implementations that dereference symbolic links by default.
7004
7005‘--reflink[=WHEN]’
7006     Perform a lightweight, copy-on-write (COW) copy, if supported by
7007     the file system.  Once it has succeeded, beware that the source and
7008     destination files share the same disk data blocks as long as they
7009     remain unmodified.  Thus, if a disk I/O error affects data blocks
7010     of one of the files, the other suffers the same fate.
7011
7012     The WHEN value can be one of the following:
7013
7014     ‘always’
7015          The default behavior: if the copy-on-write operation is not
7016          supported then report the failure for each file and exit with
7017          a failure status.
7018
7019     ‘auto’
7020          If the copy-on-write operation is not supported then fall back
7021          to the standard copy behavior.
7022
7023     ‘never’
7024          Disable copy-on-write operation and use the standard copy
7025          behavior.
7026
7027     This option is overridden by the ‘--link’, ‘--symbolic-link’ and
7028     ‘--attributes-only’ options, thus allowing it to be used to
7029     configure the default data copying behavior for ‘cp’.  For example,
7030     with the following alias, ‘cp’ will use the minimum amount of space
7031     supported by the file system.
7032
7033          alias cp='cp --reflink=auto --sparse=always'
7034
7035‘--remove-destination’
7036     Remove each existing destination file before attempting to open it
7037     (contrast with ‘-f’ above).
7038
7039‘--sparse=WHEN’
7040     A “sparse file” contains “holes”—a sequence of zero bytes that does
7041     not occupy any physical disk blocks; the ‘read’ system call reads
7042     these as zeros.  This can both save considerable disk space and
7043     increase speed, since many binary files contain lots of consecutive
7044     zero bytes.  By default, ‘cp’ detects holes in input source files
7045     via a crude heuristic and makes the corresponding output file
7046     sparse as well.  Only regular files may be sparse.
7047
7048     The WHEN value can be one of the following:
7049
7050     ‘auto’
7051          The default behavior: if the input file is sparse, attempt to
7052          make the output file sparse, too.  However, if an output file
7053          exists but refers to a non-regular file, then do not attempt
7054          to make it sparse.
7055
7056     ‘always’
7057          For each sufficiently long sequence of zero bytes in the input
7058          file, attempt to create a corresponding hole in the output
7059          file, even if the input file does not appear to be sparse.
7060          This is useful when the input file resides on a file system
7061          that does not support sparse files (for example, ‘efs’ file
7062          systems in SGI IRIX 5.3 and earlier), but the output file is
7063          on a type of file system that does support them.  Holes may be
7064          created only in regular files, so if the destination file is
7065          of some other type, ‘cp’ does not even try to make it sparse.
7066
7067     ‘never’
7068          Never make the output file sparse.  This is useful in creating
7069          a file for use with the ‘mkswap’ command, since such a file
7070          must not have any holes.
7071
7072‘--strip-trailing-slashes’
7073     Remove any trailing slashes from each SOURCE argument.  *Note
7074     Trailing slashes::.
7075
7076‘-s’
7077‘--symbolic-link’
7078     Make symbolic links instead of copies of non-directories.  All
7079     source file names must be absolute (starting with ‘/’) unless the
7080     destination files are in the current directory.  This option merely
7081     results in an error message on systems that do not support symbolic
7082     links.
7083
7084‘-S SUFFIX’
7085‘--suffix=SUFFIX’
7086     Append SUFFIX to each backup file made with ‘-b’.  *Note Backup
7087     options::.
7088
7089‘-t DIRECTORY’
7090‘--target-directory=DIRECTORY’
7091     Specify the destination DIRECTORY.  *Note Target directory::.
7092
7093‘-T’
7094‘--no-target-directory’
7095     Do not treat the last operand specially when it is a directory or a
7096     symbolic link to a directory.  *Note Target directory::.
7097
7098‘-u’
7099‘--update’
7100     Do not copy a non-directory that has an existing destination with
7101     the same or newer modification timestamp.  If timestamps are being
7102     preserved, the comparison is to the source timestamp truncated to
7103     the resolutions of the destination file system and of the system
7104     calls used to update timestamps; this avoids duplicate work if
7105     several ‘cp -pu’ commands are executed with the same source and
7106     destination.  This option is ignored if the ‘-n’ or ‘--no-clobber’
7107     option is also specified.  Also, if ‘--preserve=links’ is also
7108     specified (like with ‘cp -au’ for example), that will take
7109     precedence; consequently, depending on the order that files are
7110     processed from the source, newer files in the destination may be
7111     replaced, to mirror hard links in the source.
7112
7113‘-v’
7114‘--verbose’
7115     Print the name of each file before copying it.
7116
7117‘-x’
7118‘--one-file-system’
7119     Skip subdirectories that are on different file systems from the one
7120     that the copy started on.  However, mount point directories _are_
7121     copied.
7122
7123‘-Z’
7124‘--context[=CONTEXT]’
7125     Without a specified CONTEXT, adjust the SELinux security context
7126     according to the system default type for destination files,
7127     similarly to the ‘restorecon’ command.  The long form of this
7128     option with a specific context specified, will set the context for
7129     newly created files only.  With a specified context, if both
7130     SELinux and SMACK are disabled, a warning is issued.  This option
7131     is mutually exclusive with the ‘--preserve=context’ option, and
7132     overrides the ‘--preserve=all’ and ‘-a’ options.
7133
7134   An exit status of zero indicates success, and a nonzero value
7135indicates failure.
7136
7137
7138File: coreutils.info,  Node: dd invocation,  Next: install invocation,  Prev: cp invocation,  Up: Basic operations
7139
714011.2 ‘dd’: Convert and copy a file
7141==================================
7142
7143‘dd’ copies a file (from standard input to standard output, by default)
7144with a changeable I/O block size, while optionally performing
7145conversions on it.  Synopses:
7146
7147     dd [OPERAND]...
7148     dd OPTION
7149
7150   The only options are ‘--help’ and ‘--version’.  *Note Common
7151options::.  ‘dd’ accepts the following operands, whose syntax was
7152inspired by the DD (data definition) statement of OS/360 JCL.
7153
7154‘if=FILE’
7155     Read from FILE instead of standard input.
7156
7157‘of=FILE’
7158     Write to FILE instead of standard output.  Unless ‘conv=notrunc’ is
7159     given, ‘dd’ truncates FILE to zero bytes (or the size specified
7160     with ‘seek=’).
7161
7162‘ibs=BYTES’
7163     Set the input block size to BYTES.  This makes ‘dd’ read BYTES per
7164     block.  The default is 512 bytes.
7165
7166‘obs=BYTES’
7167     Set the output block size to BYTES.  This makes ‘dd’ write BYTES
7168     per block.  The default is 512 bytes.
7169
7170‘bs=BYTES’
7171     Set both input and output block sizes to BYTES.  This makes ‘dd’
7172     read and write BYTES per block, overriding any ‘ibs’ and ‘obs’
7173     settings.  In addition, if no data-transforming ‘conv’ operand is
7174     specified, input is copied to the output as soon as it’s read, even
7175     if it is smaller than the block size.
7176
7177‘cbs=BYTES’
7178     Set the conversion block size to BYTES.  When converting
7179     variable-length records to fixed-length ones (‘conv=block’) or the
7180     reverse (‘conv=unblock’), use BYTES as the fixed record length.
7181
7182‘skip=N’
7183     Skip N ‘ibs’-byte blocks in the input file before copying.  If
7184     ‘iflag=skip_bytes’ is specified, N is interpreted as a byte count
7185     rather than a block count.
7186
7187‘seek=N’
7188     Skip N ‘obs’-byte blocks in the output file before copying.  if
7189     ‘oflag=seek_bytes’ is specified, N is interpreted as a byte count
7190     rather than a block count.
7191
7192‘count=N’
7193     Copy N ‘ibs’-byte blocks from the input file, instead of everything
7194     until the end of the file.  if ‘iflag=count_bytes’ is specified, N
7195     is interpreted as a byte count rather than a block count.  Note if
7196     the input may return short reads as could be the case when reading
7197     from a pipe for example, ‘iflag=fullblock’ will ensure that
7198     ‘count=’ corresponds to complete input blocks rather than the
7199     traditional POSIX specified behavior of counting input read
7200     operations.
7201
7202‘status=LEVEL’
7203     Specify the amount of information printed.  If this operand is
7204     given multiple times, the last one takes precedence.  The LEVEL
7205     value can be one of the following:
7206
7207     ‘none’
7208          Do not print any informational or warning messages to stderr.
7209          Error messages are output as normal.
7210
7211     ‘noxfer’
7212          Do not print the final transfer rate and volume statistics
7213          that normally make up the last status line.
7214
7215     ‘progress’
7216          Print the transfer rate and volume statistics on stderr, when
7217          processing each input block.  Statistics are output on a
7218          single line at most once every second, but updates can be
7219          delayed when waiting on I/O.
7220
7221     Transfer information is normally output to stderr upon receipt of
7222     the ‘INFO’ signal or when ‘dd’ exits, and defaults to the following
7223     form in the C locale:
7224
7225          7287+1 records in
7226          116608+0 records out
7227          59703296 bytes (60 MB, 57 MiB) copied, 0.0427974 s, 1.4 GB/s
7228
7229     The notation ‘W+P’ stands for W whole blocks and P partial blocks.
7230     A partial block occurs when a read or write operation succeeds but
7231     transfers less data than the block size.  An additional line like
7232     ‘1 truncated record’ or ‘10 truncated records’ is output after the
7233     ‘records out’ line if ‘conv=block’ processing truncated one or more
7234     input records.
7235
7236‘conv=CONVERSION[,CONVERSION]...’
7237     Convert the file as specified by the CONVERSION argument(s).  (No
7238     spaces around any comma(s).)
7239
7240     Conversions:
7241
7242     ‘ascii’
7243          Convert EBCDIC to ASCII, using the conversion table specified
7244          by POSIX.  This provides a 1:1 translation for all 256 bytes.
7245          This implies ‘conv=unblock’; input is converted to ASCII
7246          before trailing spaces are deleted.
7247
7248     ‘ebcdic’
7249          Convert ASCII to EBCDIC.  This is the inverse of the ‘ascii’
7250          conversion.  This implies ‘conv=block’; trailing spaces are
7251          added before being converted to EBCDIC.
7252
7253     ‘ibm’
7254          This acts like ‘conv=ebcdic’, except it uses the alternate
7255          conversion table specified by POSIX.  This is not a 1:1
7256          translation, but reflects common historical practice for ‘~’,
7257          ‘[’, and ‘]’.
7258
7259          The ‘ascii’, ‘ebcdic’, and ‘ibm’ conversions are mutually
7260          exclusive.  If you use any of these conversions, you should
7261          also use the ‘cbs=’ operand.
7262
7263     ‘block’
7264          For each line in the input, output ‘cbs’ bytes, replacing the
7265          input newline with a space and truncating or padding input
7266          lines with spaces as necessary.
7267
7268     ‘unblock’
7269          Remove any trailing spaces in each ‘cbs’-sized input block,
7270          and append a newline.
7271
7272          The ‘block’ and ‘unblock’ conversions are mutually exclusive.
7273
7274     ‘lcase’
7275          Change uppercase letters to lowercase.
7276
7277     ‘ucase’
7278          Change lowercase letters to uppercase.
7279
7280          The ‘lcase’ and ‘ucase’ conversions are mutually exclusive.
7281
7282     ‘sparse’
7283          Try to seek rather than write NUL output blocks.  On a file
7284          system that supports sparse files, this will create sparse
7285          output when extending the output file.  Be careful when using
7286          this conversion in conjunction with ‘conv=notrunc’ or
7287          ‘oflag=append’.  With ‘conv=notrunc’, existing data in the
7288          output file corresponding to NUL blocks from the input, will
7289          be untouched.  With ‘oflag=append’ the seeks performed will be
7290          ineffective.  Similarly, when the output is a device rather
7291          than a file, NUL input blocks are not copied, and therefore
7292          this conversion is most useful with virtual or pre zeroed
7293          devices.
7294
7295     ‘swab’
7296          Swap every pair of input bytes.  GNU ‘dd’, unlike others,
7297          works when an odd number of bytes are read—the last byte is
7298          simply copied (since there is nothing to swap it with).
7299
7300     ‘sync’
7301          Pad every input block to size of ‘ibs’ with trailing zero
7302          bytes.  When used with ‘block’ or ‘unblock’, pad with spaces
7303          instead of zero bytes.
7304
7305     The following “conversions” are really file flags and don’t affect
7306     internal processing:
7307
7308     ‘excl’
7309          Fail if the output file already exists; ‘dd’ must create the
7310          output file itself.
7311
7312     ‘nocreat’
7313          Do not create the output file; the output file must already
7314          exist.
7315
7316          The ‘excl’ and ‘nocreat’ conversions are mutually exclusive.
7317
7318     ‘notrunc’
7319          Do not truncate the output file.
7320
7321     ‘noerror’
7322          Continue after read errors.
7323
7324     ‘fdatasync’
7325          Synchronize output data just before finishing.  This forces a
7326          physical write of output data.
7327
7328     ‘fsync’
7329          Synchronize output data and metadata just before finishing.
7330          This forces a physical write of output data and metadata.
7331
7332‘iflag=FLAG[,FLAG]...’
7333     Access the input file using the flags specified by the FLAG
7334     argument(s).  (No spaces around any comma(s).)
7335
7336‘oflag=FLAG[,FLAG]...’
7337     Access the output file using the flags specified by the FLAG
7338     argument(s).  (No spaces around any comma(s).)
7339
7340     Here are the flags.  Not every flag is supported on every operating
7341     system.
7342
7343     ‘append’
7344          Write in append mode, so that even if some other process is
7345          writing to this file, every ‘dd’ write will append to the
7346          current contents of the file.  This flag makes sense only for
7347          output.  If you combine this flag with the ‘of=FILE’ operand,
7348          you should also specify ‘conv=notrunc’ unless you want the
7349          output file to be truncated before being appended to.
7350
7351     ‘cio’
7352          Use concurrent I/O mode for data.  This mode performs direct
7353          I/O and drops the POSIX requirement to serialize all I/O to
7354          the same file.  A file cannot be opened in CIO mode and with a
7355          standard open at the same time.
7356
7357     ‘direct’
7358          Use direct I/O for data, avoiding the buffer cache.  Note that
7359          the kernel may impose restrictions on read or write buffer
7360          sizes.  For example, with an ext4 destination file system and
7361          a Linux-based kernel, using ‘oflag=direct’ will cause writes
7362          to fail with ‘EINVAL’ if the output buffer size is not a
7363          multiple of 512.
7364
7365     ‘directory’
7366
7367          Fail unless the file is a directory.  Most operating systems
7368          do not allow I/O to a directory, so this flag has limited
7369          utility.
7370
7371     ‘dsync’
7372          Use synchronized I/O for data.  For the output file, this
7373          forces a physical write of output data on each write.  For the
7374          input file, this flag can matter when reading from a remote
7375          file that has been written to synchronously by some other
7376          process.  Metadata (e.g., last-access and last-modified time)
7377          is not necessarily synchronized.
7378
7379     ‘sync’
7380          Use synchronized I/O for both data and metadata.
7381
7382     ‘nocache’
7383          Request to discard the system data cache for a file.  When
7384          count=0 all cached data for the file is specified, otherwise
7385          the cache is dropped for the processed portion of the file.
7386          Also when count=0, failure to discard the cache is diagnosed
7387          and reflected in the exit status.
7388
7389          Note data that is not already persisted to storage will not be
7390          discarded from cache, so note the use of the ‘sync’
7391          conversions in the examples below, which are used to maximize
7392          the effectiveness of the ‘nocache’ flag.
7393
7394          Here are some usage examples:
7395
7396               # Advise to drop cache for whole file
7397               dd if=ifile iflag=nocache count=0
7398
7399               # Ensure drop cache for the whole file
7400               dd of=ofile oflag=nocache conv=notrunc,fdatasync count=0
7401
7402               # Advise to drop cache for part of file
7403               # Note the kernel will only consider complete and
7404               # already persisted pages.
7405               dd if=ifile iflag=nocache skip=10 count=10 of=/dev/null
7406
7407               # Stream data using just the read-ahead cache.
7408               # See also the ‘direct’ flag.
7409               dd if=ifile of=ofile iflag=nocache oflag=nocache,sync
7410
7411     ‘nonblock’
7412          Use non-blocking I/O.
7413
7414     ‘noatime’
7415          Do not update the file’s access timestamp.  *Note File
7416          timestamps::.  Some older file systems silently ignore this
7417          flag, so it is a good idea to test it on your files before
7418          relying on it.
7419
7420     ‘noctty’
7421          Do not assign the file to be a controlling terminal for ‘dd’.
7422          This has no effect when the file is not a terminal.  On many
7423          hosts (e.g., GNU/Linux hosts), this flag has no effect at all.
7424
7425     ‘nofollow’
7426          Do not follow symbolic links.
7427
7428     ‘nolinks’
7429          Fail if the file has multiple hard links.
7430
7431     ‘binary’
7432          Use binary I/O.  This flag has an effect only on nonstandard
7433          platforms that distinguish binary from text I/O.
7434
7435     ‘text’
7436          Use text I/O.  Like ‘binary’, this flag has no effect on
7437          standard platforms.
7438
7439     ‘fullblock’
7440          Accumulate full blocks from input.  The ‘read’ system call may
7441          return early if a full block is not available.  When that
7442          happens, continue calling ‘read’ to fill the remainder of the
7443          block.  This flag can be used only with ‘iflag’.  This flag is
7444          useful with pipes for example as they may return short reads.
7445          In that case, this flag is needed to ensure that a ‘count=’
7446          argument is interpreted as a block count rather than a count
7447          of read operations.
7448
7449     ‘count_bytes’
7450          Interpret the ‘count=’ operand as a byte count, rather than a
7451          block count, which allows specifying a length that is not a
7452          multiple of the I/O block size.  This flag can be used only
7453          with ‘iflag’.
7454
7455     ‘skip_bytes’
7456          Interpret the ‘skip=’ operand as a byte count, rather than a
7457          block count, which allows specifying an offset that is not a
7458          multiple of the I/O block size.  This flag can be used only
7459          with ‘iflag’.
7460
7461     ‘seek_bytes’
7462          Interpret the ‘seek=’ operand as a byte count, rather than a
7463          block count, which allows specifying an offset that is not a
7464          multiple of the I/O block size.  This flag can be used only
7465          with ‘oflag’.
7466
7467     These flags are not supported on all systems, and ‘dd’ rejects
7468     attempts to use them when they are not supported.  When reading
7469     from standard input or writing to standard output, the ‘nofollow’
7470     and ‘noctty’ flags should not be specified, and the other flags
7471     (e.g., ‘nonblock’) can affect how other processes behave with the
7472     affected file descriptors, even after ‘dd’ exits.
7473
7474   The numeric-valued strings above (N and BYTES) can be followed by a
7475multiplier: ‘b’=512, ‘c’=1, ‘w’=2, ‘xM’=M, or any of the standard block
7476size suffixes like ‘k’=1024 (*note Block size::).
7477
7478   Any block size you specify via ‘bs=’, ‘ibs=’, ‘obs=’, ‘cbs=’ should
7479not be too large—values larger than a few megabytes are generally
7480wasteful or (as in the gigabyte..exabyte case) downright
7481counterproductive or error-inducing.
7482
7483   To process data that is at an offset or size that is not a multiple
7484of the I/O block size, you can use the ‘skip_bytes’, ‘seek_bytes’ and
7485‘count_bytes’ flags.  Alternatively the traditional method of separate
7486‘dd’ invocations can be used.  For example, the following shell commands
7487copy data in 512 KiB blocks between a disk and a tape, but do not save
7488or restore a 4 KiB label at the start of the disk:
7489
7490     disk=/dev/rdsk/c0t1d0s2
7491     tape=/dev/rmt/0
7492
7493     # Copy all but the label from disk to tape.
7494     (dd bs=4k skip=1 count=0 && dd bs=512k) <$disk >$tape
7495
7496     # Copy from tape back to disk, but leave the disk label alone.
7497     (dd bs=4k seek=1 count=0 && dd bs=512k) <$tape >$disk
7498
7499   For failing disks, other tools come with a great variety of extra
7500functionality to ease the saving of as much data as possible before the
7501disk finally dies, e.g.  GNU ‘ddrescue’
7502(https://www.gnu.org/software/ddrescue/).  However, in some cases such a
7503tool is not available or the administrator feels more comfortable with
7504the handling of ‘dd’.  As a simple rescue method, call ‘dd’ as shown in
7505the following example: the operand ‘conv=noerror,sync’ is used to
7506continue after read errors and to pad out bad reads with NULs, while
7507‘iflag=fullblock’ caters for short reads (which traditionally never
7508occur on disk based devices):
7509
7510     # Rescue data from an (unmounted!) partition of a failing disk.
7511     dd conv=noerror,sync iflag=fullblock </dev/sda1 > /mnt/rescue.img
7512
7513   Sending an ‘INFO’ signal (or ‘USR1’ signal where that is unavailable)
7514to a running ‘dd’ process makes it print I/O statistics to standard
7515error and then resume copying.  In the example below, ‘dd’ is run in the
7516background to copy 5GB of data.  The ‘kill’ command makes it output
7517intermediate I/O statistics, and when ‘dd’ completes normally or is
7518killed by the ‘SIGINT’ signal, it outputs the final statistics.
7519
7520     # Ignore the signal so we never inadvertently terminate the dd child.
7521     # Note this is not needed when SIGINFO is available.
7522     trap '' USR1
7523
7524     # Run dd with the fullblock iflag to avoid short reads
7525     # which can be triggered by reception of signals.
7526     dd iflag=fullblock if=/dev/zero of=/dev/null count=5000000 bs=1000 & pid=$!
7527
7528     # Output stats every second.
7529     while kill -s USR1 $pid 2>/dev/null; do sleep 1; done
7530
7531   The above script will output in the following format:
7532
7533     3441325+0 records in
7534     3441325+0 records out
7535     3441325000 bytes (3.4 GB, 3.2 GiB) copied, 1.00036 s, 3.4 GB/s
7536     5000000+0 records in
7537     5000000+0 records out
7538     5000000000 bytes (5.0 GB, 4.7 GiB) copied, 1.44433 s, 3.5 GB/s
7539
7540   The ‘status=progress’ operand periodically updates the last line of
7541the transfer statistics above.
7542
7543   On systems lacking the ‘INFO’ signal ‘dd’ responds to the ‘USR1’
7544signal instead, unless the ‘POSIXLY_CORRECT’ environment variable is
7545set.
7546
7547   An exit status of zero indicates success, and a nonzero value
7548indicates failure.
7549
7550
7551File: coreutils.info,  Node: install invocation,  Next: mv invocation,  Prev: dd invocation,  Up: Basic operations
7552
755311.3 ‘install’: Copy files and set attributes
7554=============================================
7555
7556‘install’ copies files while setting their file mode bits and, if
7557possible, their owner and group.  Synopses:
7558
7559     install [OPTION]... [-T] SOURCE DEST
7560     install [OPTION]... SOURCE... DIRECTORY
7561     install [OPTION]... -t DIRECTORY SOURCE...
7562     install [OPTION]... -d DIRECTORY...
7563
7564   • If two file names are given, ‘install’ copies the first file to the
7565     second.
7566
7567   • If the ‘--target-directory’ (‘-t’) option is given, or failing that
7568     if the last file is a directory and the ‘--no-target-directory’
7569     (‘-T’) option is not given, ‘install’ copies each SOURCE file to
7570     the specified directory, using the SOURCEs’ names.
7571
7572   • If the ‘--directory’ (‘-d’) option is given, ‘install’ creates each
7573     DIRECTORY and any missing parent directories.  Parent directories
7574     are created with mode ‘u=rwx,go=rx’ (755), regardless of the ‘-m’
7575     option or the current umask.  *Note Directory Setuid and Setgid::,
7576     for how the set-user-ID and set-group-ID bits of parent directories
7577     are inherited.
7578
7579   ‘install’ is similar to ‘cp’, but allows you to control the
7580attributes of destination files.  It is typically used in Makefiles to
7581copy programs into their destination directories.  It refuses to copy
7582files onto themselves.
7583
7584   ‘install’ never preserves extended attributes (xattr).
7585
7586   The program accepts the following options.  Also see *note Common
7587options::.
7588
7589‘-b’
7590‘--backup[=METHOD]’
7591     *Note Backup options::.  Make a backup of each file that would
7592     otherwise be overwritten or removed.
7593
7594‘-C’
7595‘--compare’
7596     Compare each pair of source and destination files, and if the
7597     destination has identical content and any specified owner, group,
7598     permissions, and possibly SELinux context, then do not modify the
7599     destination at all.  Note this option is best used in conjunction
7600     with ‘--user’, ‘--group’ and ‘--mode’ options, lest ‘install’
7601     incorrectly determines the default attributes that installed files
7602     would have (as it doesn’t consider setgid directories and POSIX
7603     default ACLs for example).  This could result in redundant copies
7604     or attributes that are not reset to the correct defaults.
7605
7606‘-c’
7607     Ignored; for compatibility with old Unix versions of ‘install’.
7608
7609‘-D’
7610     Create any missing parent directories of DEST, then copy SOURCE to
7611     DEST.  Explicitly specifying the ‘--target-directory=DIR’ will
7612     similarly ensure the presence of that hierarchy before copying
7613     SOURCE arguments.
7614
7615‘-d’
7616‘--directory’
7617     Create any missing parent directories, giving them the default
7618     attributes.  Then create each given directory, setting their owner,
7619     group and mode as given on the command line or to the defaults.
7620
7621‘-g GROUP’
7622‘--group=GROUP’
7623     Set the group ownership of installed files or directories to GROUP.
7624     The default is the process’s current group.  GROUP may be either a
7625     group name or a numeric group ID.
7626
7627‘-m MODE’
7628‘--mode=MODE’
7629     Set the file mode bits for the installed file or directory to MODE,
7630     which can be either an octal number, or a symbolic mode as in
7631     ‘chmod’, with ‘a=’ (no access allowed to anyone) as the point of
7632     departure (*note File permissions::).  The default mode is
7633     ‘u=rwx,go=rx,a-s’—read, write, and execute for the owner, read and
7634     execute for group and other, and with set-user-ID and set-group-ID
7635     disabled.  This default is not quite the same as ‘755’, since it
7636     disables instead of preserving set-user-ID and set-group-ID on
7637     directories.  *Note Directory Setuid and Setgid::.
7638
7639‘-o OWNER’
7640‘--owner=OWNER’
7641     If ‘install’ has appropriate privileges (is run as root), set the
7642     ownership of installed files or directories to OWNER.  The default
7643     is ‘root’.  OWNER may be either a user name or a numeric user ID.
7644
7645‘--preserve-context’
7646     Preserve the SELinux security context of files and directories.
7647     Failure to preserve the context in all of the files or directories
7648     will result in an exit status of 1.  If SELinux is disabled then
7649     print a warning and ignore the option.
7650
7651‘-p’
7652‘--preserve-timestamps’
7653     Set the time of last access and the time of last modification of
7654     each installed file to match those of each corresponding original
7655     file.  When a file is installed without this option, its last
7656     access and last modification timestamps are both set to the time of
7657     installation.  This option is useful if you want to use the last
7658     modification timestamps of installed files to keep track of when
7659     they were last built as opposed to when they were last installed.
7660
7661‘-s’
7662‘--strip’
7663     Strip the symbol tables from installed binary executables.
7664
7665‘--strip-program=PROGRAM’
7666     Program used to strip binaries.
7667
7668‘-S SUFFIX’
7669‘--suffix=SUFFIX’
7670     Append SUFFIX to each backup file made with ‘-b’.  *Note Backup
7671     options::.
7672
7673‘-t DIRECTORY’
7674‘--target-directory=DIRECTORY’
7675     Specify the destination DIRECTORY.  *Note Target directory::.  Also
7676     specifying the ‘-D’ option will ensure the directory is present.
7677
7678‘-T’
7679‘--no-target-directory’
7680     Do not treat the last operand specially when it is a directory or a
7681     symbolic link to a directory.  *Note Target directory::.
7682
7683‘-v’
7684‘--verbose’
7685     Print the name of each file before copying it.
7686
7687‘-Z’
7688‘--context[=CONTEXT]’
7689     Without a specified CONTEXT, adjust the SELinux security context
7690     according to the system default type for destination files,
7691     similarly to the ‘restorecon’ command.  The long form of this
7692     option with a specific context specified, will set the context for
7693     newly created files only.  With a specified context, if both
7694     SELinux and SMACK are disabled, a warning is issued.  This option
7695     is mutually exclusive with the ‘--preserve-context’ option.
7696
7697   An exit status of zero indicates success, and a nonzero value
7698indicates failure.
7699
7700
7701File: coreutils.info,  Node: mv invocation,  Next: rm invocation,  Prev: install invocation,  Up: Basic operations
7702
770311.4 ‘mv’: Move (rename) files
7704==============================
7705
7706‘mv’ moves or renames files (or directories).  Synopses:
7707
7708     mv [OPTION]... [-T] SOURCE DEST
7709     mv [OPTION]... SOURCE... DIRECTORY
7710     mv [OPTION]... -t DIRECTORY SOURCE...
7711
7712   • If two file names are given, ‘mv’ moves the first file to the
7713     second.
7714
7715   • If the ‘--target-directory’ (‘-t’) option is given, or failing that
7716     if the last file is a directory and the ‘--no-target-directory’
7717     (‘-T’) option is not given, ‘mv’ moves each SOURCE file to the
7718     specified directory, using the SOURCEs’ names.
7719
7720   ‘mv’ can move any type of file from one file system to another.
7721Prior to version ‘4.0’ of the fileutils, ‘mv’ could move only regular
7722files between file systems.  For example, now ‘mv’ can move an entire
7723directory hierarchy including special device files from one partition to
7724another.  It first uses some of the same code that’s used by ‘cp -a’ to
7725copy the requested directories and files, then (assuming the copy
7726succeeded) it removes the originals.  If the copy fails, then the part
7727that was copied to the destination partition is removed.  If you were to
7728copy three directories from one partition to another and the copy of the
7729first directory succeeded, but the second didn’t, the first would be
7730left on the destination partition and the second and third would be left
7731on the original partition.
7732
7733   ‘mv’ always tries to copy extended attributes (xattr), which may
7734include SELinux context, ACLs or Capabilities.  Upon failure all but
7735‘Operation not supported’ warnings are output.
7736
7737   If a destination file exists but is normally unwritable, standard
7738input is a terminal, and the ‘-f’ or ‘--force’ option is not given, ‘mv’
7739prompts the user for whether to replace the file.  (You might own the
7740file, or have write permission on its directory.)  If the response is
7741not affirmative, the file is skipped.
7742
7743   _Warning_: Avoid specifying a source name with a trailing slash, when
7744it might be a symlink to a directory.  Otherwise, ‘mv’ may do something
7745very surprising, since its behavior depends on the underlying rename
7746system call.  On a system with a modern Linux-based kernel, it fails
7747with ‘errno=ENOTDIR’.  However, on other systems (at least FreeBSD 6.1
7748and Solaris 10) it silently renames not the symlink but rather the
7749directory referenced by the symlink.  *Note Trailing slashes::.
7750
7751   _Note_: ‘mv’ will only replace empty directories in the destination.
7752Conflicting populated directories are skipped with a diagnostic.
7753
7754   The program accepts the following options.  Also see *note Common
7755options::.
7756
7757‘-b’
7758‘--backup[=METHOD]’
7759     *Note Backup options::.  Make a backup of each file that would
7760     otherwise be overwritten or removed.
7761
7762‘-f’
7763‘--force’
7764     Do not prompt the user before removing a destination file.  If you
7765     specify more than one of the ‘-i’, ‘-f’, ‘-n’ options, only the
7766     final one takes effect.
7767
7768‘-i’
7769‘--interactive’
7770     Prompt whether to overwrite each existing destination file,
7771     regardless of its permissions.  If the response is not affirmative,
7772     the file is skipped.  If you specify more than one of the ‘-i’,
7773     ‘-f’, ‘-n’ options, only the final one takes effect.
7774
7775‘-n’
7776‘--no-clobber’
7777     Do not overwrite an existing file; silently do nothing instead.  If
7778     you specify more than one of the ‘-i’, ‘-f’, ‘-n’ options, only the
7779     final one takes effect.  This option is mutually exclusive with
7780     ‘-b’ or ‘--backup’ option.
7781
7782‘-u’
7783‘--update’
7784     Do not move a non-directory that has an existing destination with
7785     the same or newer modification timestamp.  If the move is across
7786     file system boundaries, the comparison is to the source timestamp
7787     truncated to the resolutions of the destination file system and of
7788     the system calls used to update timestamps; this avoids duplicate
7789     work if several ‘mv -u’ commands are executed with the same source
7790     and destination.  This option is ignored if the ‘-n’ or
7791     ‘--no-clobber’ option is also specified.
7792
7793‘-v’
7794‘--verbose’
7795     Print the name of each file before moving it.
7796
7797‘--strip-trailing-slashes’
7798     Remove any trailing slashes from each SOURCE argument.  *Note
7799     Trailing slashes::.
7800
7801‘-S SUFFIX’
7802‘--suffix=SUFFIX’
7803     Append SUFFIX to each backup file made with ‘-b’.  *Note Backup
7804     options::.
7805
7806‘-t DIRECTORY’
7807‘--target-directory=DIRECTORY’
7808     Specify the destination DIRECTORY.  *Note Target directory::.
7809
7810‘-T’
7811‘--no-target-directory’
7812     Do not treat the last operand specially when it is a directory or a
7813     symbolic link to a directory.  *Note Target directory::.
7814
7815‘-Z’
7816‘--context’
7817     This option functions similarly to the ‘restorecon’ command, by
7818     adjusting the SELinux security context according to the system
7819     default type for destination files and each created directory.
7820
7821   An exit status of zero indicates success, and a nonzero value
7822indicates failure.
7823
7824
7825File: coreutils.info,  Node: rm invocation,  Next: shred invocation,  Prev: mv invocation,  Up: Basic operations
7826
782711.5 ‘rm’: Remove files or directories
7828======================================
7829
7830‘rm’ removes each given FILE.  By default, it does not remove
7831directories.  Synopsis:
7832
7833     rm [OPTION]... [FILE]...
7834
7835   If the ‘-I’ or ‘--interactive=once’ option is given, and there are
7836more than three files or the ‘-r’, ‘-R’, or ‘--recursive’ are given,
7837then ‘rm’ prompts the user for whether to proceed with the entire
7838operation.  If the response is not affirmative, the entire command is
7839aborted.
7840
7841   Otherwise, if a file is unwritable, standard input is a terminal, and
7842the ‘-f’ or ‘--force’ option is not given, or the ‘-i’ or
7843‘--interactive=always’ option _is_ given, ‘rm’ prompts the user for
7844whether to remove the file.  If the response is not affirmative, the
7845file is skipped.
7846
7847   Any attempt to remove a file whose last file name component is ‘.’ or
7848‘..’ is rejected without any prompting, as mandated by POSIX.
7849
7850   _Warning_: If you use ‘rm’ to remove a file, it is usually possible
7851to recover the contents of that file.  If you want more assurance that
7852the contents are unrecoverable, consider using ‘shred’.
7853
7854   The program accepts the following options.  Also see *note Common
7855options::.
7856
7857‘-d’
7858‘--dir’
7859     Remove the listed directories if they are empty.
7860
7861‘-f’
7862‘--force’
7863     Ignore nonexistent files and missing operands, and never prompt the
7864     user.  Ignore any previous ‘--interactive’ (‘-i’) option.
7865
7866‘-i’
7867     Prompt whether to remove each file.  If the response is not
7868     affirmative, the file is skipped.  Ignore any previous ‘--force’
7869     (‘-f’) option.  Equivalent to ‘--interactive=always’.
7870
7871‘-I’
7872     Prompt once whether to proceed with the command, if more than three
7873     files are named or if a recursive removal is requested.  Ignore any
7874     previous ‘--force’ (‘-f’) option.  Equivalent to
7875     ‘--interactive=once’.
7876
7877‘--interactive [=WHEN]’
7878     Specify when to issue an interactive prompt.  WHEN may be omitted,
7879     or one of:
7880        • never - Do not prompt at all.
7881        • once - Prompt once if more than three files are named or if a
7882          recursive removal is requested.  Equivalent to ‘-I’.
7883        • always - Prompt for every file being removed.  Equivalent to
7884          ‘-i’.
7885     ‘--interactive’ with no WHEN is equivalent to
7886     ‘--interactive=always’.
7887
7888‘--one-file-system’
7889     When removing a hierarchy recursively, skip any directory that is
7890     on a file system different from that of the corresponding command
7891     line argument.  This option is useful when removing a build
7892     “chroot” hierarchy, which normally contains no valuable data.
7893     However, it is not uncommon to bind-mount ‘/home’ into such a
7894     hierarchy, to make it easier to use one’s start-up file.  The catch
7895     is that it’s easy to forget to unmount ‘/home’.  Then, when you use
7896     ‘rm -rf’ to remove your normally throw-away chroot, that command
7897     will remove everything under ‘/home’, too.  Use the
7898     ‘--one-file-system’ option, and it will warn about and skip
7899     directories on other file systems.  Of course, this will not save
7900     your ‘/home’ if it and your chroot happen to be on the same file
7901     system.  See also ‘--preserve-root=all’ to protect command line
7902     arguments themselves.
7903
7904‘--preserve-root [=all]’
7905     Fail upon any attempt to remove the root directory, ‘/’, when used
7906     with the ‘--recursive’ option.  This is the default behavior.
7907     *Note Treating / specially::.  When ‘all’ is specified, reject any
7908     command line argument that is not on the same file system as its
7909     parent.
7910
7911‘--no-preserve-root’
7912     Do not treat ‘/’ specially when removing recursively.  This option
7913     is not recommended unless you really want to remove all the files
7914     on your computer.  *Note Treating / specially::.
7915
7916‘-r’
7917‘-R’
7918‘--recursive’
7919     Remove the listed directories and their contents recursively.
7920
7921‘-v’
7922‘--verbose’
7923     Print the name of each file before removing it.
7924
7925   One common question is how to remove files whose names begin with a
7926‘-’.  GNU ‘rm’, like every program that uses the ‘getopt’ function to
7927parse its arguments, lets you use the ‘--’ option to indicate that all
7928following arguments are non-options.  To remove a file called ‘-f’ in
7929the current directory, you could type either:
7930
7931     rm -- -f
7932
7933or:
7934
7935     rm ./-f
7936
7937   The Unix ‘rm’ program’s use of a single ‘-’ for this purpose predates
7938the development of the ‘getopt’ standard syntax.
7939
7940   An exit status of zero indicates success, and a nonzero value
7941indicates failure.
7942
7943
7944File: coreutils.info,  Node: shred invocation,  Prev: rm invocation,  Up: Basic operations
7945
794611.6 ‘shred’: Remove files more securely
7947========================================
7948
7949‘shred’ overwrites devices or files, to help prevent even extensive
7950forensics from recovering the data.
7951
7952   Ordinarily when you remove a file (*note rm invocation::), its data
7953and metadata are not actually destroyed.  Only the file’s directory
7954entry is removed, and the file’s storage is reclaimed only when no
7955process has the file open and no other directory entry links to the
7956file.  And even if file’s data and metadata’s storage space is freed for
7957further reuse, there are undelete utilities that will attempt to
7958reconstruct the file from the data in freed storage, and that can bring
7959the file back if the storage was not rewritten.
7960
7961   On a busy system with a nearly-full device, space can get reused in a
7962few seconds.  But there is no way to know for sure.  And although the
7963undelete utilities and already-existing processes require insider or
7964superuser access, you may be wary of the superuser, of processes running
7965on your behalf, or of attackers that can physically access the storage
7966device.  So if you have sensitive data, you may want to be sure that
7967recovery is not possible by plausible attacks like these.
7968
7969   The best way to remove something irretrievably is to destroy the
7970media it’s on with acid, melt it down, or the like.  For cheap removable
7971media this is often the preferred method.  However, some storage devices
7972are expensive or are harder to destroy, so the ‘shred’ utility tries to
7973achieve a similar effect non-destructively, by overwriting the file with
7974non-sensitive data.
7975
7976   *Please note* that ‘shred’ relies on a crucial assumption: that the
7977file system and hardware overwrite data in place.  Although this is
7978common and is the traditional way to do things, but many modern file
7979system designs do not satisfy this assumption.  Exceptions include:
7980
7981   • Log-structured or journaled file systems, such as ext3/ext4 (in
7982     ‘data=journal’ mode), Btrfs, NTFS, ReiserFS, XFS, ZFS, file systems
7983     supplied with AIX and Solaris, etc., when they are configured to
7984     journal data.
7985
7986   • File systems that write redundant data and carry on even if some
7987     writes fail, such as RAID-based file systems.
7988
7989   • File systems that make snapshots, such as Network Appliance’s NFS
7990     server.
7991
7992   • File systems that cache in temporary locations, such as NFS version
7993     3 clients.
7994
7995   • Compressed file systems.
7996
7997   For ext3 and ext4 file systems, ‘shred’ is less effective when the
7998file system is in ‘data=journal’ mode, which journals file data in
7999addition to just metadata.  In both the ‘data=ordered’ (default) and
8000‘data=writeback’ modes, ‘shred’ works as usual.  The ext3/ext4
8001journaling modes can be changed by adding the ‘data=something’ option to
8002the mount options for a particular file system in the ‘/etc/fstab’ file,
8003as documented in the ‘mount’ man page (‘man mount’).  Alternatively, if
8004you know how large the journal is, you can shred the journal by
8005shredding enough file data so that the journal cycles around and fills
8006up with shredded data.
8007
8008   If you are not sure how your file system operates, then you should
8009assume that it does not overwrite data in place, which means ‘shred’
8010cannot reliably operate on regular files in your file system.
8011
8012   Generally speaking, it is more reliable to shred a device than a
8013file, since this bypasses file system design issues mentioned above.
8014However, devices are also problematic for shredding, for reasons such as
8015the following:
8016
8017   • Solid-state storage devices (SSDs) typically do wear leveling to
8018     prolong service life, and this means writes are distributed to
8019     other blocks by the hardware, so “overwritten” data blocks are
8020     still present in the underlying device.
8021
8022   • Most storage devices map out bad blocks invisibly to the
8023     application; if the bad blocks contain sensitive data, ‘shred’
8024     won’t be able to destroy it.
8025
8026   • With some obsolete storage technologies, it may be possible to take
8027     (say) a floppy disk back to a laboratory and use a lot of sensitive
8028     (and expensive) equipment to look for the faint “echoes” of the
8029     original data underneath the overwritten data.  With these older
8030     technologies, if the file has been overwritten only once, it’s
8031     reputedly not even that hard.  Luckily, this kind of data recovery
8032     has become difficult, and there is no public evidence that today’s
8033     higher-density storage devices can be analyzed in this way.
8034
8035     The ‘shred’ command can use many overwrite passes, with data
8036     patterns chosen to maximize the damage they do to the old data.  By
8037     default the patterns are designed for best effect on hard drives
8038     using now-obsolete technology; for newer devices, a single pass
8039     should suffice.  For more details, see the source code and Peter
8040     Gutmann’s paper ‘Secure Deletion of Data from Magnetic and
8041     Solid-State Memory’
8042     (https://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html), from
8043     the proceedings of the Sixth USENIX Security Symposium (San Jose,
8044     California, July 22–25, 1996).
8045
8046   ‘shred’ makes no attempt to detect or report these problems, just as
8047it makes no attempt to do anything about backups.  However, since it is
8048more reliable to shred devices than files, ‘shred’ by default does not
8049deallocate or remove the output file.  This default is more suitable for
8050devices, which typically cannot be deallocated and should not be
8051removed.
8052
8053   Finally, consider the risk of backups and mirrors.  File system
8054backups and remote mirrors may contain copies of the file that cannot be
8055removed, and that will allow a shredded file to be recovered later.  So
8056if you keep any data you may later want to destroy using ‘shred’, be
8057sure that it is not backed up or mirrored.
8058
8059     shred [OPTION]... FILE[...]
8060
8061   The program accepts the following options.  Also see *note Common
8062options::.
8063
8064‘-f’
8065‘--force’
8066     Override file permissions if necessary to allow overwriting.
8067
8068‘-n NUMBER’
8069‘--iterations=NUMBER’
8070     By default, ‘shred’ uses 3 passes of overwrite.  You can reduce
8071     this to save time, or increase it if you think it’s appropriate.
8072     After 25 passes all of the internal overwrite patterns will have
8073     been used at least once.
8074
8075‘--random-source=FILE’
8076     Use FILE as a source of random data used to overwrite and to choose
8077     pass ordering.  *Note Random sources::.
8078
8079‘-s BYTES’
8080‘--size=BYTES’
8081     Shred the first BYTES bytes of the file.  The default is to shred
8082     the whole file.  BYTES can be followed by a size specification like
8083     ‘K’, ‘M’, or ‘G’ to specify a multiple.  *Note Block size::.
8084
8085‘-u’
8086‘--remove[=HOW]’
8087     After shredding a file, deallocate it (if possible) and then remove
8088     it.  If a file has multiple links, only the named links will be
8089     removed.  Often the file name is less sensitive than the file data,
8090     in which case the optional HOW parameter, supported with the long
8091     form option, gives control of how to more efficiently remove each
8092     directory entry.  The ‘unlink’ parameter will just use a standard
8093     unlink call, ‘wipe’ will also first obfuscate bytes in the name,
8094     and ‘wipesync’ will also sync each obfuscated byte in the name to
8095     disk.  Note ‘wipesync’ is the default method, but can be expensive,
8096     requiring a sync for every character in every file.  This can
8097     become significant with many files, or is redundant if your file
8098     system provides synchronous metadata updates.
8099
8100‘-v’
8101‘--verbose’
8102     Display to standard error all status updates as sterilization
8103     proceeds.
8104
8105‘-x’
8106‘--exact’
8107     By default, ‘shred’ rounds the size of a regular file up to the
8108     next multiple of the file system block size to fully erase the
8109     slack space in the last block of the file.  This space may contain
8110     portions of the current system memory on some systems for example.
8111     Use ‘--exact’ to suppress that behavior.  Thus, by default if you
8112     shred a 10-byte regular file on a system with 512-byte blocks, the
8113     resulting file will be 512 bytes long.  With this option, shred
8114     does not increase the apparent size of the file.
8115
8116‘-z’
8117‘--zero’
8118     Normally, the last pass that ‘shred’ writes is made up of random
8119     data.  If this would be conspicuous on your storage device (for
8120     example, because it looks like encrypted data), or you just think
8121     it’s tidier, the ‘--zero’ option adds an additional overwrite pass
8122     with all zero bits.  This is in addition to the number of passes
8123     specified by the ‘--iterations’ option.
8124
8125   You might use the following command to erase the file system you
8126created on a USB flash drive.  This command typically takes several
8127minutes, depending on the drive’s size and write speed.  On modern
8128storage devices a single pass should be adequate, and will take one
8129third the time of the default three-pass approach.
8130
8131     shred -v -n 1 /dev/sdd1
8132
8133   Similarly, to erase all data on a selected partition of your hard
8134disk, you could give a command like the following.
8135
8136     # 1 pass, write pseudo-random data; 3x faster than the default
8137     shred -v -n1 /dev/sda5
8138
8139   To be on the safe side, use at least one pass that overwrites using
8140pseudo-random data.  I.e., don’t be tempted to use ‘-n0 --zero’, in case
8141some disk controller optimizes the process of writing blocks of all
8142zeros, and thereby does not clear all bytes in a block.  Some SSDs may
8143do just that.
8144
8145   A FILE of ‘-’ denotes standard output.  The intended use of this is
8146to shred a removed temporary file.  For example:
8147
8148     i=$(mktemp)
8149     exec 3<>"$i"
8150     rm -- "$i"
8151     echo "Hello, world" >&3
8152     shred - >&3
8153     exec 3>-
8154
8155   However, the command ‘shred - >file’ does not shred the contents of
8156FILE, since the shell truncates FILE before invoking ‘shred’.  Use the
8157command ‘shred file’ or (if using a Bourne-compatible shell) the command
8158‘shred - 1<>file’ instead.
8159
8160   An exit status of zero indicates success, and a nonzero value
8161indicates failure.
8162
8163
8164File: coreutils.info,  Node: Special file types,  Next: Changing file attributes,  Prev: Basic operations,  Up: Top
8165
816612 Special file types
8167*********************
8168
8169This chapter describes commands which create special types of files (and
8170‘rmdir’, which removes directories, one special file type).
8171
8172   Although Unix-like operating systems have markedly fewer special file
8173types than others, not _everything_ can be treated only as the
8174undifferentiated byte stream of “normal files”.  For example, when a
8175file is created or removed, the system must record this information,
8176which it does in a “directory”—a special type of file.  Although you can
8177read directories as normal files, if you’re curious, in order for the
8178system to do its job it must impose a structure, a certain order, on the
8179bytes of the file.  Thus it is a “special” type of file.
8180
8181   Besides directories, other special file types include named pipes
8182(FIFOs), symbolic links, sockets, and so-called “special files”.
8183
8184* Menu:
8185
8186* link invocation::             Make a hard link via the link syscall
8187* ln invocation::               Make links between files.
8188* mkdir invocation::            Make directories.
8189* mkfifo invocation::           Make FIFOs (named pipes).
8190* mknod invocation::            Make block or character special files.
8191* readlink invocation::         Print value of a symlink or canonical file name.
8192* rmdir invocation::            Remove empty directories.
8193* unlink invocation::           Remove files via the unlink syscall
8194
8195
8196File: coreutils.info,  Node: link invocation,  Next: ln invocation,  Up: Special file types
8197
819812.1 ‘link’: Make a hard link via the link syscall
8199==================================================
8200
8201‘link’ creates a single hard link at a time.  It is a minimalist
8202interface to the system-provided ‘link’ function.  *Note (libc)Hard
8203Links::.  It avoids the bells and whistles of the more commonly-used
8204‘ln’ command (*note ln invocation::).  Synopsis:
8205
8206     link FILENAME LINKNAME
8207
8208   FILENAME must specify an existing file, and LINKNAME must specify a
8209nonexistent entry in an existing directory.  ‘link’ simply calls ‘link
8210(FILENAME, LINKNAME)’ to create the link.
8211
8212   On a GNU system, this command acts like ‘ln --directory
8213--no-target-directory FILENAME LINKNAME’.  However, the ‘--directory’
8214and ‘--no-target-directory’ options are not specified by POSIX, and the
8215‘link’ command is more portable in practice.
8216
8217   If FILENAME is a symbolic link, it is unspecified whether LINKNAME
8218will be a hard link to the symbolic link or to the target of the
8219symbolic link.  Use ‘ln -P’ or ‘ln -L’ to specify which behavior is
8220desired.
8221
8222   An exit status of zero indicates success, and a nonzero value
8223indicates failure.
8224
8225
8226File: coreutils.info,  Node: ln invocation,  Next: mkdir invocation,  Prev: link invocation,  Up: Special file types
8227
822812.2 ‘ln’: Make links between files
8229===================================
8230
8231‘ln’ makes links between files.  By default, it makes hard links; with
8232the ‘-s’ option, it makes symbolic (or “soft”) links.  Synopses:
8233
8234     ln [OPTION]... [-T] TARGET LINKNAME
8235     ln [OPTION]... TARGET
8236     ln [OPTION]... TARGET... DIRECTORY
8237     ln [OPTION]... -t DIRECTORY TARGET...
8238
8239   • If two file names are given, ‘ln’ creates a link to the first file
8240     from the second.
8241
8242   • If one TARGET is given, ‘ln’ creates a link to that file in the
8243     current directory.
8244
8245   • If the ‘--target-directory’ (‘-t’) option is given, or failing that
8246     if the last file is a directory and the ‘--no-target-directory’
8247     (‘-T’) option is not given, ‘ln’ creates a link to each TARGET file
8248     in the specified directory, using the TARGETs’ names.
8249
8250   Normally ‘ln’ does not replace existing files.  Use the ‘--force’
8251(‘-f’) option to replace them unconditionally, the ‘--interactive’
8252(‘-i’) option to replace them conditionally, and the ‘--backup’ (‘-b’)
8253option to rename them.  Unless the ‘--backup’ (‘-b’) option is used
8254there is no brief moment when the destination does not exist; this is an
8255extension to POSIX.
8256
8257   A “hard link” is another name for an existing file; the link and the
8258original are indistinguishable.  Technically speaking, they share the
8259same inode, and the inode contains all the information about a
8260file—indeed, it is not incorrect to say that the inode _is_ the file.
8261Most systems prohibit making a hard link to a directory; on those where
8262it is allowed, only the super-user can do so (and with caution, since
8263creating a cycle will cause problems to many other utilities).  Hard
8264links cannot cross file system boundaries.  (These restrictions are not
8265mandated by POSIX, however.)
8266
8267   “Symbolic links” (“symlinks” for short), on the other hand, are a
8268special file type (which not all kernels support: System V release 3
8269(and older) systems lack symlinks) in which the link file actually
8270refers to a different file, by name.  When most operations (opening,
8271reading, writing, and so on) are passed the symbolic link file, the
8272kernel automatically “dereferences” the link and operates on the target
8273of the link.  But some operations (e.g., removing) work on the link file
8274itself, rather than on its target.  The owner and group of a symlink are
8275not significant to file access performed through the link, but do have
8276implications on deleting a symbolic link from a directory with the
8277restricted deletion bit set.  On the GNU system, the mode of a symlink
8278has no significance and cannot be changed, but on some BSD systems, the
8279mode can be changed and will affect whether the symlink will be
8280traversed in file name resolution.  *Note (libc)Symbolic Links::.
8281
8282   Symbolic links can contain arbitrary strings; a “dangling symlink”
8283occurs when the string in the symlink does not resolve to a file.  There
8284are no restrictions against creating dangling symbolic links.  There are
8285trade-offs to using absolute or relative symlinks.  An absolute symlink
8286always points to the same file, even if the directory containing the
8287link is moved.  However, if the symlink is visible from more than one
8288machine (such as on a networked file system), the file pointed to might
8289not always be the same.  A relative symbolic link is resolved in
8290relation to the directory that contains the link, and is often useful in
8291referring to files on the same device without regards to what name that
8292device is mounted on when accessed via networked machines.
8293
8294   When creating a relative symlink in a different location than the
8295current directory, the resolution of the symlink will be different than
8296the resolution of the same string from the current directory.
8297Therefore, many users prefer to first change directories to the location
8298where the relative symlink will be created, so that tab-completion or
8299other file resolution will find the same target as what will be placed
8300in the symlink.
8301
8302   The program accepts the following options.  Also see *note Common
8303options::.
8304
8305‘-b’
8306‘--backup[=METHOD]’
8307     *Note Backup options::.  Make a backup of each file that would
8308     otherwise be overwritten or removed.
8309
8310‘-d’
8311‘-F’
8312‘--directory’
8313     Allow users with appropriate privileges to attempt to make hard
8314     links to directories.  However, note that this will probably fail
8315     due to system restrictions, even for the super-user.
8316
8317‘-f’
8318‘--force’
8319     Remove existing destination files.
8320
8321‘-i’
8322‘--interactive’
8323     Prompt whether to remove existing destination files.
8324
8325‘-L’
8326‘--logical’
8327     If ‘-s’ is not in effect, and the source file is a symbolic link,
8328     create the hard link to the file referred to by the symbolic link,
8329     rather than the symbolic link itself.
8330
8331‘-n’
8332‘--no-dereference’
8333     Do not treat the last operand specially when it is a symbolic link
8334     to a directory.  Instead, treat it as if it were a normal file.
8335
8336     When the destination is an actual directory (not a symlink to one),
8337     there is no ambiguity.  The link is created in that directory.  But
8338     when the specified destination is a symlink to a directory, there
8339     are two ways to treat the user’s request.  ‘ln’ can treat the
8340     destination just as it would a normal directory and create the link
8341     in it.  On the other hand, the destination can be viewed as a
8342     non-directory—as the symlink itself.  In that case, ‘ln’ must
8343     delete or backup that symlink before creating the new link.  The
8344     default is to treat a destination that is a symlink to a directory
8345     just like a directory.
8346
8347     This option is weaker than the ‘--no-target-directory’ (‘-T’)
8348     option, so it has no effect if both options are given.
8349
8350‘-P’
8351‘--physical’
8352     If ‘-s’ is not in effect, and the source file is a symbolic link,
8353     create the hard link to the symbolic link itself.  On platforms
8354     where this is not supported by the kernel, this option creates a
8355     symbolic link with identical contents; since symbolic link contents
8356     cannot be edited, any file name resolution performed through either
8357     link will be the same as if a hard link had been created.
8358
8359‘-r’
8360‘--relative’
8361     Make symbolic links relative to the link location.
8362
8363     Example:
8364
8365          ln -srv /a/file /tmp
8366          '/tmp/file' -> '../a/file'
8367
8368     Relative symbolic links are generated based on their canonicalized
8369     containing directory, and canonicalized targets.  I.e., all
8370     symbolic links in these file names will be resolved.  *Note
8371     realpath invocation::, which gives greater control over relative
8372     file name generation, as demonstrated in the following example:
8373
8374          ln--relative() {
8375            test "$1" = --no-symlinks && { nosym=$1; shift; }
8376            target="$1";
8377            test -d "$2" && link="$2/." || link="$2"
8378            rtarget="$(realpath $nosym -m "$target" \
8379                        --relative-to "$(dirname "$link")")"
8380            ln -s -v "$rtarget" "$link"
8381          }
8382
8383‘-s’
8384‘--symbolic’
8385     Make symbolic links instead of hard links.  This option merely
8386     produces an error message on systems that do not support symbolic
8387     links.
8388
8389‘-S SUFFIX’
8390‘--suffix=SUFFIX’
8391     Append SUFFIX to each backup file made with ‘-b’.  *Note Backup
8392     options::.
8393
8394‘-t DIRECTORY’
8395‘--target-directory=DIRECTORY’
8396     Specify the destination DIRECTORY.  *Note Target directory::.
8397
8398‘-T’
8399‘--no-target-directory’
8400     Do not treat the last operand specially when it is a directory or a
8401     symbolic link to a directory.  *Note Target directory::.
8402
8403‘-v’
8404‘--verbose’
8405     Print the name of each file after linking it successfully.
8406
8407   If ‘-L’ and ‘-P’ are both given, the last one takes precedence.  If
8408‘-s’ is also given, ‘-L’ and ‘-P’ are silently ignored.  If neither
8409option is given, then this implementation defaults to ‘-P’ if the system
8410‘link’ supports hard links to symbolic links (such as the GNU system),
8411and ‘-L’ if ‘link’ follows symbolic links (such as on BSD).
8412
8413   An exit status of zero indicates success, and a nonzero value
8414indicates failure.
8415
8416   Examples:
8417
8418     Bad Example:
8419
8420     # Create link ../a pointing to a in that directory.
8421     # Not really useful because it points to itself.
8422     ln -s a ..
8423
8424     Better Example:
8425
8426     # Change to the target before creating symlinks to avoid being confused.
8427     cd ..
8428     ln -s adir/a .
8429
8430     Bad Example:
8431
8432     # Hard coded file names don't move well.
8433     ln -s $(pwd)/a /some/dir/
8434
8435     Better Example:
8436
8437     # Relative file names survive directory moves and also
8438     # work across networked file systems.
8439     ln -s afile anotherfile
8440     ln -s ../adir/afile yetanotherfile
8441
8442
8443File: coreutils.info,  Node: mkdir invocation,  Next: mkfifo invocation,  Prev: ln invocation,  Up: Special file types
8444
844512.3 ‘mkdir’: Make directories
8446==============================
8447
8448‘mkdir’ creates directories with the specified names.  Synopsis:
8449
8450     mkdir [OPTION]... NAME...
8451
8452   ‘mkdir’ creates each directory NAME in the order given.  It reports
8453an error if NAME already exists, unless the ‘-p’ option is given and
8454NAME is a directory.
8455
8456   The program accepts the following options.  Also see *note Common
8457options::.
8458
8459‘-m MODE’
8460‘--mode=MODE’
8461     Set the file permission bits of created directories to MODE, which
8462     uses the same syntax as in ‘chmod’ and uses ‘a=rwx’ (read, write
8463     and execute allowed for everyone) for the point of the departure.
8464     *Note File permissions::.
8465
8466     Normally the directory has the desired file mode bits at the moment
8467     it is created.  As a GNU extension, MODE may also mention special
8468     mode bits, but in this case there may be a temporary window during
8469     which the directory exists but its special mode bits are incorrect.
8470     *Note Directory Setuid and Setgid::, for how the set-user-ID and
8471     set-group-ID bits of directories are inherited unless overridden in
8472     this way.
8473
8474‘-p’
8475‘--parents’
8476     Make any missing parent directories for each argument, setting
8477     their file permission bits to the umask modified by ‘u+wx’.  Ignore
8478     existing parent directories, and do not change their file
8479     permission bits.
8480
8481     To set the file permission bits of any newly-created parent
8482     directories to a value that includes ‘u+wx’, you can set the umask
8483     before invoking ‘mkdir’.  For example, if the shell command ‘(umask
8484     u=rwx,go=rx; mkdir -p P/Q)’ creates the parent ‘P’ it sets the
8485     parent’s permission bits to ‘u=rwx,go=rx’.  To set a parent’s
8486     special mode bits as well, you can invoke ‘chmod’ after ‘mkdir’.
8487     *Note Directory Setuid and Setgid::, for how the set-user-ID and
8488     set-group-ID bits of newly-created parent directories are
8489     inherited.
8490
8491‘-v’
8492‘--verbose’
8493     Print a message for each created directory.  This is most useful
8494     with ‘--parents’.
8495
8496‘-Z’
8497‘--context[=CONTEXT]’
8498     Without a specified CONTEXT, adjust the SELinux security context
8499     according to the system default type for destination files,
8500     similarly to the ‘restorecon’ command.  The long form of this
8501     option with a specific context specified, will set the context for
8502     newly created files only.  With a specified context, if both
8503     SELinux and SMACK are disabled, a warning is issued.
8504
8505   An exit status of zero indicates success, and a nonzero value
8506indicates failure.
8507
8508
8509File: coreutils.info,  Node: mkfifo invocation,  Next: mknod invocation,  Prev: mkdir invocation,  Up: Special file types
8510
851112.4 ‘mkfifo’: Make FIFOs (named pipes)
8512=======================================
8513
8514‘mkfifo’ creates FIFOs (also called “named pipes”) with the specified
8515names.  Synopsis:
8516
8517     mkfifo [OPTION] NAME...
8518
8519   A “FIFO” is a special file type that permits independent processes to
8520communicate.  One process opens the FIFO file for writing, and another
8521for reading, after which data can flow as with the usual anonymous pipe
8522in shells or elsewhere.
8523
8524   The program accepts the following options.  Also see *note Common
8525options::.
8526
8527‘-m MODE’
8528‘--mode=MODE’
8529     Set the mode of created FIFOs to MODE, which is symbolic as in
8530     ‘chmod’ and uses ‘a=rw’ (read and write allowed for everyone) for
8531     the point of departure.  MODE should specify only file permission
8532     bits.  *Note File permissions::.
8533
8534‘-Z’
8535‘--context[=CONTEXT]’
8536     Without a specified CONTEXT, adjust the SELinux security context
8537     according to the system default type for destination files,
8538     similarly to the ‘restorecon’ command.  The long form of this
8539     option with a specific context specified, will set the context for
8540     newly created files only.  With a specified context, if both
8541     SELinux and SMACK are disabled, a warning is issued.
8542
8543   An exit status of zero indicates success, and a nonzero value
8544indicates failure.
8545
8546
8547File: coreutils.info,  Node: mknod invocation,  Next: readlink invocation,  Prev: mkfifo invocation,  Up: Special file types
8548
854912.5 ‘mknod’: Make block or character special files
8550===================================================
8551
8552‘mknod’ creates a FIFO, character special file, or block special file
8553with the specified name.  Synopsis:
8554
8555     mknod [OPTION]... NAME TYPE [MAJOR MINOR]
8556
8557   Unlike the phrase “special file type” above, the term “special file”
8558has a technical meaning on Unix: something that can generate or receive
8559data.  Usually this corresponds to a physical piece of hardware, e.g., a
8560printer or a disk.  (These files are typically created at
8561system-configuration time.)  The ‘mknod’ command is what creates files
8562of this type.  Such devices can be read either a character at a time or
8563a “block” (many characters) at a time, hence we say there are “block
8564special” files and “character special” files.
8565
8566   Due to shell aliases and built-in ‘mknod’ functions, using an
8567unadorned ‘mknod’ interactively or in a script may get you different
8568functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
8569mknod ...’) to avoid interference from the shell.
8570
8571   The arguments after NAME specify the type of file to make:
8572
8573‘p’
8574     for a FIFO
8575
8576‘b’
8577     for a block special file
8578
8579‘c’
8580     for a character special file
8581
8582   When making a block or character special file, the major and minor
8583device numbers must be given after the file type.  If a major or minor
8584device number begins with ‘0x’ or ‘0X’, it is interpreted as
8585hexadecimal; otherwise, if it begins with ‘0’, as octal; otherwise, as
8586decimal.
8587
8588   The program accepts the following options.  Also see *note Common
8589options::.
8590
8591‘-m MODE’
8592‘--mode=MODE’
8593     Set the mode of created files to MODE, which is symbolic as in
8594     ‘chmod’ and uses ‘a=rw’ as the point of departure.  MODE should
8595     specify only file permission bits.  *Note File permissions::.
8596
8597‘-Z’
8598‘--context[=CONTEXT]’
8599     Without a specified CONTEXT, adjust the SELinux security context
8600     according to the system default type for destination files,
8601     similarly to the ‘restorecon’ command.  The long form of this
8602     option with a specific context specified, will set the context for
8603     newly created files only.  With a specified context, if both
8604     SELinux and SMACK are disabled, a warning is issued.
8605
8606   An exit status of zero indicates success, and a nonzero value
8607indicates failure.
8608
8609
8610File: coreutils.info,  Node: readlink invocation,  Next: rmdir invocation,  Prev: mknod invocation,  Up: Special file types
8611
861212.6 ‘readlink’: Print value of a symlink or canonical file name
8613================================================================
8614
8615‘readlink’ may work in one of two supported modes:
8616
8617‘Readlink mode’
8618
8619     ‘readlink’ outputs the value of the given symbolic links.  If
8620     ‘readlink’ is invoked with an argument other than the name of a
8621     symbolic link, it produces no output and exits with a nonzero exit
8622     code.
8623
8624‘Canonicalize mode’
8625
8626     ‘readlink’ outputs the absolute name of the given files which
8627     contain no ‘.’, ‘..’ components nor any repeated separators (‘/’)
8628     or symbolic links.  Note the ‘realpath’ command is the preferred
8629     command to use for canonicalization.  *Note realpath invocation::.
8630
8631     readlink [OPTION]... FILE...
8632
8633   By default, ‘readlink’ operates in readlink mode.
8634
8635   The program accepts the following options.  Also see *note Common
8636options::.
8637
8638‘-f’
8639‘--canonicalize’
8640     Activate canonicalize mode.  If any component of the file name
8641     except the last one is missing or unavailable, ‘readlink’ produces
8642     no output and exits with a nonzero exit code.  A trailing slash is
8643     ignored.
8644
8645‘-e’
8646‘--canonicalize-existing’
8647     Activate canonicalize mode.  If any component is missing or
8648     unavailable, ‘readlink’ produces no output and exits with a nonzero
8649     exit code.  A trailing slash requires that the name resolve to a
8650     directory.
8651
8652‘-m’
8653‘--canonicalize-missing’
8654     Activate canonicalize mode.  If any component is missing or
8655     unavailable, ‘readlink’ treats it as a directory.
8656
8657‘-n’
8658‘--no-newline’
8659     Do not print the output delimiter, when a single FILE is specified.
8660     Print a warning if specified along with multiple FILEs.
8661
8662‘-s’
8663‘-q’
8664‘--silent’
8665‘--quiet’
8666     Suppress most error messages.  On by default.
8667
8668‘-v’
8669‘--verbose’
8670     Report error messages.
8671
8672‘-z’
8673‘--zero’
8674     Output a zero byte (ASCII NUL) at the end of each line, rather than
8675     a newline.  This option enables other programs to parse the output
8676     even when that output would contain data with embedded newlines.
8677
8678   The ‘readlink’ utility first appeared in OpenBSD 2.1.
8679
8680   The ‘realpath’ command without options, operates like ‘readlink’ in
8681canonicalize mode.
8682
8683   An exit status of zero indicates success, and a nonzero value
8684indicates failure.
8685
8686
8687File: coreutils.info,  Node: rmdir invocation,  Next: unlink invocation,  Prev: readlink invocation,  Up: Special file types
8688
868912.7 ‘rmdir’: Remove empty directories
8690======================================
8691
8692‘rmdir’ removes empty directories.  Synopsis:
8693
8694     rmdir [OPTION]... DIRECTORY...
8695
8696   If any DIRECTORY argument does not refer to an existing empty
8697directory, it is an error.
8698
8699   The program accepts the following options.  Also see *note Common
8700options::.
8701
8702‘--ignore-fail-on-non-empty’
8703     Ignore each failure to remove a directory that is solely because
8704     the directory is non-empty.
8705
8706‘-p’
8707‘--parents’
8708     Remove DIRECTORY, then try to remove each component of DIRECTORY.
8709     So, for example, ‘rmdir -p a/b/c’ is similar to ‘rmdir a/b/c a/b
8710     a’.  As such, it fails if any of those directories turns out not to
8711     be empty.  Use the ‘--ignore-fail-on-non-empty’ option to make it
8712     so such a failure does not evoke a diagnostic and does not cause
8713     ‘rmdir’ to exit unsuccessfully.
8714
8715‘-v’
8716‘--verbose’
8717     Give a diagnostic for each successful removal.  DIRECTORY is
8718     removed.
8719
8720   *Note rm invocation::, for how to remove non-empty directories
8721(recursively).
8722
8723   An exit status of zero indicates success, and a nonzero value
8724indicates failure.
8725
8726
8727File: coreutils.info,  Node: unlink invocation,  Prev: rmdir invocation,  Up: Special file types
8728
872912.8 ‘unlink’: Remove files via the unlink syscall
8730==================================================
8731
8732‘unlink’ deletes a single specified file name.  It is a minimalist
8733interface to the system-provided ‘unlink’ function.  *Note
8734(libc)Deleting Files::.  Synopsis: It avoids the bells and whistles of
8735the more commonly-used ‘rm’ command (*note rm invocation::).
8736
8737     unlink FILENAME
8738
8739   On some systems ‘unlink’ can be used to delete the name of a
8740directory.  On others, it can be used that way only by a privileged
8741user.  In the GNU system ‘unlink’ can never delete the name of a
8742directory.
8743
8744   The ‘unlink’ command honors the ‘--help’ and ‘--version’ options.  To
8745remove a file whose name begins with ‘-’, prefix the name with ‘./’,
8746e.g., ‘unlink ./--help’.
8747
8748   An exit status of zero indicates success, and a nonzero value
8749indicates failure.
8750
8751
8752File: coreutils.info,  Node: Changing file attributes,  Next: Disk usage,  Prev: Special file types,  Up: Top
8753
875413 Changing file attributes
8755***************************
8756
8757A file is not merely its contents, a name, and a file type (*note
8758Special file types::).  A file also has an owner (a user ID), a group (a
8759group ID), permissions (what the owner can do with the file, what people
8760in the group can do, and what everyone else can do), various timestamps,
8761and other information.  Collectively, we call these a file’s
8762“attributes”.
8763
8764   These commands change file attributes.
8765
8766* Menu:
8767
8768* chown invocation::            Change file owners and groups.
8769* chgrp invocation::            Change file groups.
8770* chmod invocation::            Change access permissions.
8771* touch invocation::            Change file timestamps.
8772
8773
8774File: coreutils.info,  Node: chown invocation,  Next: chgrp invocation,  Up: Changing file attributes
8775
877613.1 ‘chown’: Change file owner and group
8777=========================================
8778
8779‘chown’ changes the user and/or group ownership of each given FILE to
8780NEW-OWNER or to the user and group of an existing reference file.
8781Synopsis:
8782
8783     chown [OPTION]... {NEW-OWNER | --reference=REF_FILE} FILE...
8784
8785   If used, NEW-OWNER specifies the new owner and/or group as follows
8786(with no embedded white space):
8787
8788     [OWNER] [ : [GROUP] ]
8789
8790   Specifically:
8791
8792OWNER
8793     If only an OWNER (a user name or numeric user ID) is given, that
8794     user is made the owner of each given file, and the files’ group is
8795     not changed.
8796
8797OWNER‘:’GROUP
8798     If the OWNER is followed by a colon and a GROUP (a group name or
8799     numeric group ID), with no spaces between them, the group ownership
8800     of the files is changed as well (to GROUP).
8801
8802OWNER‘:’
8803     If a colon but no group name follows OWNER, that user is made the
8804     owner of the files and the group of the files is changed to OWNER’s
8805     login group.
8806
8807‘:’GROUP
8808     If the colon and following GROUP are given, but the owner is
8809     omitted, only the group of the files is changed; in this case,
8810     ‘chown’ performs the same function as ‘chgrp’.
8811
8812‘:’
8813     If only a colon is given, or if NEW-OWNER is empty, neither the
8814     owner nor the group is changed.
8815
8816   If OWNER or GROUP is intended to represent a numeric user or group
8817ID, then you may specify it with a leading ‘+’.  *Note Disambiguating
8818names and IDs::.
8819
8820   Some older scripts may still use ‘.’ in place of the ‘:’ separator.
8821POSIX 1003.1-2001 (*note Standards conformance::) does not require
8822support for that, but for backward compatibility GNU ‘chown’ supports
8823‘.’ so long as no ambiguity results.  New scripts should avoid the use
8824of ‘.’ because it is not portable, and because it has undesirable
8825results if the entire OWNER‘.’GROUP happens to identify a user whose
8826name contains ‘.’.
8827
8828   It is system dependent whether a user can change the group to an
8829arbitrary one, or the more portable behavior of being restricted to
8830setting a group of which the user is a member.
8831
8832   The ‘chown’ command sometimes clears the set-user-ID or set-group-ID
8833permission bits.  This behavior depends on the policy and functionality
8834of the underlying ‘chown’ system call, which may make system-dependent
8835file mode modifications outside the control of the ‘chown’ command.  For
8836example, the ‘chown’ command might not affect those bits when invoked by
8837a user with appropriate privileges, or when the bits signify some
8838function other than executable permission (e.g., mandatory locking).
8839When in doubt, check the underlying system behavior.
8840
8841   The program accepts the following options.  Also see *note Common
8842options::.
8843
8844‘-c’
8845‘--changes’
8846     Verbosely describe the action for each FILE whose ownership
8847     actually changes.
8848
8849‘-f’
8850‘--silent’
8851‘--quiet’
8852     Do not print error messages about files whose ownership cannot be
8853     changed.
8854
8855‘--from=OLD-OWNER’
8856     Change a FILE’s ownership only if it has current attributes
8857     specified by OLD-OWNER.  OLD-OWNER has the same form as NEW-OWNER
8858     described above.  This option is useful primarily from a security
8859     standpoint in that it narrows considerably the window of potential
8860     abuse.  For example, to reflect a user ID numbering change for one
8861     user’s files without an option like this, ‘root’ might run
8862
8863          find / -owner OLDUSER -print0 | xargs -0 chown -h NEWUSER
8864
8865     But that is dangerous because the interval between when the ‘find’
8866     tests the existing file’s owner and when the ‘chown’ is actually
8867     run may be quite large.  One way to narrow the gap would be to
8868     invoke chown for each file as it is found:
8869
8870          find / -owner OLDUSER -exec chown -h NEWUSER {} \;
8871
8872     But that is very slow if there are many affected files.  With this
8873     option, it is safer (the gap is narrower still) though still not
8874     perfect:
8875
8876          chown -h -R --from=OLDUSER NEWUSER /
8877
8878‘--dereference’
8879     Do not act on symbolic links themselves but rather on what they
8880     point to.  This is the default when not operating recursively.
8881
8882     Combining this dereferencing option with the ‘--recursive’ option
8883     may create a security risk: During the traversal of the directory
8884     tree, an attacker may be able to introduce a symlink to an
8885     arbitrary target; when the tool reaches that, the operation will be
8886     performed on the target of that symlink, possibly allowing the
8887     attacker to escalate privileges.
8888
8889‘-h’
8890‘--no-dereference’
8891     Act on symbolic links themselves instead of what they point to.
8892     This mode relies on the ‘lchown’ system call.  On systems that do
8893     not provide the ‘lchown’ system call, ‘chown’ fails when a file
8894     specified on the command line is a symbolic link.  By default, no
8895     diagnostic is issued for symbolic links encountered during a
8896     recursive traversal, but see ‘--verbose’.
8897
8898‘--preserve-root’
8899     Fail upon any attempt to recursively change the root directory,
8900     ‘/’.  Without ‘--recursive’, this option has no effect.  *Note
8901     Treating / specially::.
8902
8903‘--no-preserve-root’
8904     Cancel the effect of any preceding ‘--preserve-root’ option.  *Note
8905     Treating / specially::.
8906
8907‘--reference=REF_FILE’
8908     Change the user and group of each FILE to be the same as those of
8909     REF_FILE.  If REF_FILE is a symbolic link, do not use the user and
8910     group of the symbolic link, but rather those of the file it refers
8911     to.
8912
8913‘-v’
8914‘--verbose’
8915     Output a diagnostic for every file processed.  If a symbolic link
8916     is encountered during a recursive traversal on a system without the
8917     ‘lchown’ system call, and ‘--no-dereference’ is in effect, then
8918     issue a diagnostic saying neither the symbolic link nor its
8919     referent is being changed.
8920
8921‘-R’
8922‘--recursive’
8923     Recursively change ownership of directories and their contents.
8924
8925‘-H’
8926     If ‘--recursive’ (‘-R’) is specified and a command line argument is
8927     a symbolic link to a directory, traverse it.  *Note Traversing
8928     symlinks::.
8929
8930‘-L’
8931     In a recursive traversal, traverse every symbolic link to a
8932     directory that is encountered.
8933
8934     Combining this dereferencing option with the ‘--recursive’ option
8935     may create a security risk: During the traversal of the directory
8936     tree, an attacker may be able to introduce a symlink to an
8937     arbitrary target; when the tool reaches that, the operation will be
8938     performed on the target of that symlink, possibly allowing the
8939     attacker to escalate privileges.
8940
8941     *Note Traversing symlinks::.
8942
8943‘-P’
8944     Do not traverse any symbolic links.  This is the default if none of
8945     ‘-H’, ‘-L’, or ‘-P’ is specified.  *Note Traversing symlinks::.
8946
8947   An exit status of zero indicates success, and a nonzero value
8948indicates failure.
8949
8950   Examples:
8951
8952     # Change the owner of /u to "root".
8953     chown root /u
8954
8955     # Likewise, but also change its group to "staff".
8956     chown root:staff /u
8957
8958     # Change the owner of /u and subfiles to "root".
8959     chown -hR root /u
8960
8961
8962File: coreutils.info,  Node: chgrp invocation,  Next: chmod invocation,  Prev: chown invocation,  Up: Changing file attributes
8963
896413.2 ‘chgrp’: Change group ownership
8965====================================
8966
8967‘chgrp’ changes the group ownership of each given FILE to GROUP (which
8968can be either a group name or a numeric group ID) or to the group of an
8969existing reference file.  *Note chown invocation::.  Synopsis:
8970
8971     chgrp [OPTION]... {GROUP | --reference=REF_FILE} FILE...
8972
8973   If GROUP is intended to represent a numeric group ID, then you may
8974specify it with a leading ‘+’.  *Note Disambiguating names and IDs::.
8975
8976   It is system dependent whether a user can change the group to an
8977arbitrary one, or the more portable behavior of being restricted to
8978setting a group of which the user is a member.
8979
8980   The program accepts the following options.  Also see *note Common
8981options::.
8982
8983‘-c’
8984‘--changes’
8985     Verbosely describe the action for each FILE whose group actually
8986     changes.
8987
8988‘-f’
8989‘--silent’
8990‘--quiet’
8991     Do not print error messages about files whose group cannot be
8992     changed.
8993
8994‘--dereference’
8995     Do not act on symbolic links themselves but rather on what they
8996     point to.  This is the default when not operating recursively.
8997
8998     Combining this dereferencing option with the ‘--recursive’ option
8999     may create a security risk: During the traversal of the directory
9000     tree, an attacker may be able to introduce a symlink to an
9001     arbitrary target; when the tool reaches that, the operation will be
9002     performed on the target of that symlink, possibly allowing the
9003     attacker to escalate privileges.
9004
9005‘-h’
9006‘--no-dereference’
9007     Act on symbolic links themselves instead of what they point to.
9008     This mode relies on the ‘lchown’ system call.  On systems that do
9009     not provide the ‘lchown’ system call, ‘chgrp’ fails when a file
9010     specified on the command line is a symbolic link.  By default, no
9011     diagnostic is issued for symbolic links encountered during a
9012     recursive traversal, but see ‘--verbose’.
9013
9014‘--preserve-root’
9015     Fail upon any attempt to recursively change the root directory,
9016     ‘/’.  Without ‘--recursive’, this option has no effect.  *Note
9017     Treating / specially::.
9018
9019‘--no-preserve-root’
9020     Cancel the effect of any preceding ‘--preserve-root’ option.  *Note
9021     Treating / specially::.
9022
9023‘--reference=REF_FILE’
9024     Change the group of each FILE to be the same as that of REF_FILE.
9025     If REF_FILE is a symbolic link, do not use the group of the
9026     symbolic link, but rather that of the file it refers to.
9027
9028‘-v’
9029‘--verbose’
9030     Output a diagnostic for every file processed.  If a symbolic link
9031     is encountered during a recursive traversal on a system without the
9032     ‘lchown’ system call, and ‘--no-dereference’ is in effect, then
9033     issue a diagnostic saying neither the symbolic link nor its
9034     referent is being changed.
9035
9036‘-R’
9037‘--recursive’
9038     Recursively change the group ownership of directories and their
9039     contents.
9040
9041‘-H’
9042     If ‘--recursive’ (‘-R’) is specified and a command line argument is
9043     a symbolic link to a directory, traverse it.  *Note Traversing
9044     symlinks::.
9045
9046‘-L’
9047     In a recursive traversal, traverse every symbolic link to a
9048     directory that is encountered.
9049
9050     Combining this dereferencing option with the ‘--recursive’ option
9051     may create a security risk: During the traversal of the directory
9052     tree, an attacker may be able to introduce a symlink to an
9053     arbitrary target; when the tool reaches that, the operation will be
9054     performed on the target of that symlink, possibly allowing the
9055     attacker to escalate privileges.
9056
9057     *Note Traversing symlinks::.
9058
9059‘-P’
9060     Do not traverse any symbolic links.  This is the default if none of
9061     ‘-H’, ‘-L’, or ‘-P’ is specified.  *Note Traversing symlinks::.
9062
9063   An exit status of zero indicates success, and a nonzero value
9064indicates failure.
9065
9066   Examples:
9067
9068     # Change the group of /u to "staff".
9069     chgrp staff /u
9070
9071     # Change the group of /u and subfiles to "staff".
9072     chgrp -hR staff /u
9073
9074
9075File: coreutils.info,  Node: chmod invocation,  Next: touch invocation,  Prev: chgrp invocation,  Up: Changing file attributes
9076
907713.3 ‘chmod’: Change access permissions
9078=======================================
9079
9080‘chmod’ changes the access permissions of the named files.  Synopsis:
9081
9082     chmod [OPTION]... {MODE | --reference=REF_FILE} FILE...
9083
9084   ‘chmod’ never changes the permissions of symbolic links, since the
9085‘chmod’ system call cannot change their permissions.  This is not a
9086problem since the permissions of symbolic links are never used.
9087However, for each symbolic link listed on the command line, ‘chmod’
9088changes the permissions of the pointed-to file.  In contrast, ‘chmod’
9089ignores symbolic links encountered during recursive directory
9090traversals.
9091
9092   Only a process whose effective user ID matches the user ID of the
9093file, or a process with appropriate privileges, is permitted to change
9094the file mode bits of a file.
9095
9096   A successful use of ‘chmod’ clears the set-group-ID bit of a regular
9097file if the file’s group ID does not match the user’s effective group ID
9098or one of the user’s supplementary group IDs, unless the user has
9099appropriate privileges.  Additional restrictions may cause the
9100set-user-ID and set-group-ID bits of MODE or REF_FILE to be ignored.
9101This behavior depends on the policy and functionality of the underlying
9102‘chmod’ system call.  When in doubt, check the underlying system
9103behavior.
9104
9105   If used, MODE specifies the new file mode bits.  For details, see the
9106section on *note File permissions::.  If you really want MODE to have a
9107leading ‘-’, you should use ‘--’ first, e.g., ‘chmod -- -w file’.
9108Typically, though, ‘chmod a-w file’ is preferable, and ‘chmod -w file’
9109(without the ‘--’) complains if it behaves differently from what ‘chmod
9110a-w file’ would do.
9111
9112   The program accepts the following options.  Also see *note Common
9113options::.
9114
9115‘-c’
9116‘--changes’
9117     Verbosely describe the action for each FILE whose permissions
9118     actually changes.
9119
9120‘-f’
9121‘--silent’
9122‘--quiet’
9123     Do not print error messages about files whose permissions cannot be
9124     changed.
9125
9126‘--preserve-root’
9127     Fail upon any attempt to recursively change the root directory,
9128     ‘/’.  Without ‘--recursive’, this option has no effect.  *Note
9129     Treating / specially::.
9130
9131‘--no-preserve-root’
9132     Cancel the effect of any preceding ‘--preserve-root’ option.  *Note
9133     Treating / specially::.
9134
9135‘-v’
9136‘--verbose’
9137     Verbosely describe the action or non-action taken for every FILE.
9138
9139‘--reference=REF_FILE’
9140     Change the mode of each FILE to be the same as that of REF_FILE.
9141     *Note File permissions::.  If REF_FILE is a symbolic link, do not
9142     use the mode of the symbolic link, but rather that of the file it
9143     refers to.
9144
9145‘-R’
9146‘--recursive’
9147     Recursively change permissions of directories and their contents.
9148
9149   An exit status of zero indicates success, and a nonzero value
9150indicates failure.
9151
9152   Examples:
9153
9154     # Change file permissions of FOO to be world readable
9155     # and user writable, with no other permissions.
9156     chmod 644 foo
9157     chmod a=r,u+w foo
9158
9159     # Add user and group execute permissions to FOO.
9160     chmod +110 file
9161     chmod ug+x file
9162
9163     # Set file permissions of DIR and subsidiary files to
9164     # be the umask default, assuming execute permissions for
9165     # directories and for files already executable.
9166     chmod -R a=,+rwX dir
9167
9168
9169File: coreutils.info,  Node: touch invocation,  Prev: chmod invocation,  Up: Changing file attributes
9170
917113.4 ‘touch’: Change file timestamps
9172====================================
9173
9174‘touch’ changes the access and/or modification timestamps of the
9175specified files.  Synopsis:
9176
9177     touch [OPTION]... FILE...
9178
9179   Any FILE argument that does not exist is created empty, unless option
9180‘--no-create’ (‘-c’) or ‘--no-dereference’ (‘-h’) was in effect.
9181
9182   A FILE argument string of ‘-’ is handled specially and causes ‘touch’
9183to change the times of the file associated with standard output.
9184
9185   By default, ‘touch’ sets file timestamps to the current time.
9186Because ‘touch’ acts on its operands left to right, the resulting
9187timestamps of earlier and later operands may disagree.
9188
9189   When setting file timestamps to the current time, ‘touch’ can change
9190the timestamps for files that the user does not own but has write
9191permission for.  Otherwise, the user must own the files.  Some older
9192systems have a further restriction: the user must own the files unless
9193both the access and modification timestamps are being set to the current
9194time.
9195
9196   The ‘touch’ command cannot set a file’s status change timestamp to a
9197user-specified value, and cannot change the file’s birth time (if
9198supported) at all.  Also, ‘touch’ has issues similar to those affecting
9199all programs that update file timestamps.  For example, ‘touch’ may set
9200a file’s timestamp to a value that differs slightly from the requested
9201time.  *Note File timestamps::.
9202
9203   Timestamps assume the time zone rules specified by the ‘TZ’
9204environment variable, or by the system default rules if ‘TZ’ is not set.
9205*Note Specifying the Time Zone with ‘TZ’: (libc)TZ Variable.  You can
9206avoid ambiguities during daylight saving transitions by using UTC
9207timestamps.
9208
9209   The program accepts the following options.  Also see *note Common
9210options::.
9211
9212‘-a’
9213‘--time=atime’
9214‘--time=access’
9215‘--time=use’
9216     Change the access timestamp only.  *Note File timestamps::.
9217
9218‘-c’
9219‘--no-create’
9220     Do not warn about or create files that do not exist.
9221
9222‘-d TIME’
9223‘--date=TIME’
9224     Use TIME instead of the current time.  It can contain month names,
9225     time zones, ‘am’ and ‘pm’, ‘yesterday’, etc.  For example,
9226     ‘--date="2004-02-27 14:19:13.489392193 +0530"’ specifies the
9227     instant of time that is 489,392,193 nanoseconds after February 27,
9228     2004 at 2:19:13 PM in a time zone that is 5 hours and 30 minutes
9229     east of UTC.  *Note Date input formats::.  File systems that do not
9230     support high-resolution timestamps silently ignore any excess
9231     precision here.
9232
9233‘-f’
9234     Ignored; for compatibility with BSD versions of ‘touch’.
9235
9236‘-h’
9237‘--no-dereference’
9238     Attempt to change the timestamps of a symbolic link, rather than
9239     what the link refers to.  When using this option, empty files are
9240     not created, but option ‘-c’ must also be used to avoid warning
9241     about files that do not exist.  Not all systems support changing
9242     the timestamps of symlinks, since underlying system support for
9243     this action was not required until POSIX 2008.  Also, on some
9244     systems, the mere act of examining a symbolic link changes the
9245     access timestamp, such that only changes to the modification
9246     timestamp will persist long enough to be observable.  When coupled
9247     with option ‘-r’, a reference timestamp is taken from a symbolic
9248     link rather than the file it refers to.
9249
9250‘-m’
9251‘--time=mtime’
9252‘--time=modify’
9253     Change the modification timestamp only.
9254
9255‘-r FILE’
9256‘--reference=FILE’
9257     Use the times of the reference FILE instead of the current time.
9258     If this option is combined with the ‘--date=TIME’ (‘-d TIME’)
9259     option, the reference FILE’s time is the origin for any relative
9260     TIMEs given, but is otherwise ignored.  For example, ‘-r foo -d '-5
9261     seconds'’ specifies a timestamp equal to five seconds before the
9262     corresponding timestamp for ‘foo’.  If FILE is a symbolic link, the
9263     reference timestamp is taken from the target of the symlink, unless
9264     ‘-h’ was also in effect.
9265
9266‘-t [[CC]YY]MMDDHHMM[.SS]’
9267     Use the argument (optional four-digit or two-digit years, months,
9268     days, hours, minutes, optional seconds) instead of the current
9269     time.  If the year is specified with only two digits, then CC is 20
9270     for years in the range 0 ... 68, and 19 for years in 69 ... 99.  If
9271     no digits of the year are specified, the argument is interpreted as
9272     a date in the current year.  On the atypical systems that support
9273     leap seconds, SS may be ‘60’.
9274
9275   On systems predating POSIX 1003.1-2001, ‘touch’ supports an obsolete
9276syntax, as follows.  If no timestamp is given with any of the ‘-d’,
9277‘-r’, or ‘-t’ options, and if there are two or more FILEs and the first
9278FILE is of the form ‘MMDDHHMM[YY]’ and this would be a valid argument to
9279the ‘-t’ option (if the YY, if any, were moved to the front), and if the
9280represented year is in the range 1969–1999, that argument is interpreted
9281as the time for the other files instead of as a file name.  Although
9282this obsolete behavior can be controlled with the ‘_POSIX2_VERSION’
9283environment variable (*note Standards conformance::), portable scripts
9284should avoid commands whose behavior depends on this variable.  For
9285example, use ‘touch ./12312359 main.c’ or ‘touch -t 12312359 main.c9286rather than the ambiguous ‘touch 12312359 main.c’.
9287
9288   An exit status of zero indicates success, and a nonzero value
9289indicates failure.
9290
9291
9292File: coreutils.info,  Node: Disk usage,  Next: Printing text,  Prev: Changing file attributes,  Up: Top
9293
929414 Disk usage
9295*************
9296
9297No disk can hold an infinite amount of data.  These commands report how
9298much disk storage is in use or available, report other file and file
9299status information, and write buffers to disk.
9300
9301* Menu:
9302
9303* df invocation::               Report file system disk space usage.
9304* du invocation::               Estimate file space usage.
9305* stat invocation::             Report file or file system status.
9306* sync invocation::             Synchronize cached writes to persistent storage.
9307* truncate invocation::         Shrink or extend the size of a file.
9308
9309
9310File: coreutils.info,  Node: df invocation,  Next: du invocation,  Up: Disk usage
9311
931214.1 ‘df’: Report file system disk space usage
9313==============================================
9314
9315‘df’ reports the amount of disk space used and available on file
9316systems.  Synopsis:
9317
9318     df [OPTION]... [FILE]...
9319
9320   With no arguments, ‘df’ reports the space used and available on all
9321currently mounted file systems (of all types).  Otherwise, ‘df’ reports
9322on the file system containing each argument FILE.
9323
9324   Normally the disk space is printed in units of 1024 bytes, but this
9325can be overridden (*note Block size::).  Non-integer quantities are
9326rounded up to the next higher unit.
9327
9328   For bind mounts and without arguments, ‘df’ only outputs the
9329statistics for that device with the shortest mount point name in the
9330list of file systems (MTAB), i.e., it hides duplicate entries, unless
9331the ‘-a’ option is specified.
9332
9333   With the same logic, ‘df’ elides a mount entry of a dummy pseudo
9334device if there is another mount entry of a real block device for that
9335mount point with the same device number, e.g.  the early-boot pseudo
9336file system ‘rootfs’ is not shown per default when already the real root
9337device has been mounted.
9338
9339   If an argument FILE resolves to a special file containing a mounted
9340file system, ‘df’ shows the space available on that file system rather
9341than on the file system containing the device node.  GNU ‘df’ does not
9342attempt to determine the disk usage on unmounted file systems, because
9343on most kinds of systems doing so requires extremely nonportable
9344intimate knowledge of file system structures.
9345
9346   The program accepts the following options.  Also see *note Common
9347options::.
9348
9349‘-a’
9350‘--all’
9351     Include in the listing dummy, duplicate, or inaccessible file
9352     systems, which are omitted by default.  Dummy file systems are
9353     typically special purpose pseudo file systems such as ‘/proc’, with
9354     no associated storage.  Duplicate file systems are local or remote
9355     file systems that are mounted at separate locations in the local
9356     file hierarchy, or bind mounted locations.  Inaccessible file
9357     systems are those which are mounted but subsequently over-mounted
9358     by another file system at that point, or otherwise inaccessible due
9359     to permissions of the mount point etc.
9360
9361‘-B SIZE’
9362‘--block-size=SIZE’
9363     Scale sizes by SIZE before printing them (*note Block size::).  For
9364     example, ‘-BG’ prints sizes in units of 1,073,741,824 bytes.
9365
9366‘-h’
9367‘--human-readable’
9368     Append a size letter to each size, such as ‘M’ for mebibytes.
9369     Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes.
9370     This option is equivalent to ‘--block-size=human-readable’.  Use
9371     the ‘--si’ option if you prefer powers of 1000.
9372
9373‘-H’
9374     Equivalent to ‘--si’.
9375
9376‘-i’
9377‘--inodes’
9378     List inode usage information instead of block usage.  An inode
9379     (short for index node) contains information about a file such as
9380     its owner, permissions, timestamps, and location on the disk.
9381
9382‘-k’
9383     Print sizes in 1024-byte blocks, overriding the default block size
9384     (*note Block size::).  This option is equivalent to
9385     ‘--block-size=1K’.
9386
9387‘-l’
9388‘--local’
9389     Limit the listing to local file systems.  By default, remote file
9390     systems are also listed.
9391
9392‘--no-sync’
9393     Do not invoke the ‘sync’ system call before getting any usage data.
9394     This may make ‘df’ run significantly faster on systems with many
9395     disks, but on some systems (notably SunOS) the results may be
9396     slightly out of date.  This is the default.
9397
9398‘--output’
9399‘--output[=FIELD_LIST]’
9400     Use the output format defined by FIELD_LIST, or print all fields if
9401     FIELD_LIST is omitted.  In the latter case, the order of the
9402     columns conforms to the order of the field descriptions below.
9403
9404     The use of the ‘--output’ together with each of the options ‘-i’,
9405     ‘-P’, and ‘-T’ is mutually exclusive.
9406
9407     FIELD_LIST is a comma-separated list of columns to be included in
9408     ‘df’’s output and therefore effectively controls the order of
9409     output columns.  Each field can thus be used at the place of
9410     choice, but yet must only be used once.
9411
9412     Valid field names in the FIELD_LIST are:
9413     ‘source’
9414          The source of the mount point, usually a device.
9415     ‘fstype’
9416          File system type.
9417
9418     ‘itotal’
9419          Total number of inodes.
9420     ‘iused’
9421          Number of used inodes.
9422     ‘iavail’
9423          Number of available inodes.
9424     ‘ipcent’
9425          Percentage of IUSED divided by ITOTAL.
9426
9427     ‘size’
9428          Total number of blocks.
9429     ‘used’
9430          Number of used blocks.
9431     ‘avail’
9432          Number of available blocks.
9433     ‘pcent’
9434          Percentage of USED divided by SIZE.
9435
9436     ‘file’
9437          The file name if specified on the command line.
9438     ‘target’
9439          The mount point.
9440
9441     The fields for block and inodes statistics are affected by the
9442     scaling options like ‘-h’ as usual.
9443
9444     The definition of the FIELD_LIST can even be split among several
9445     ‘--output’ uses.
9446
9447          #!/bin/sh
9448          # Print the TARGET (i.e., the mount point) along with their percentage
9449          # statistic regarding the blocks and the inodes.
9450          df --out=target --output=pcent,ipcent
9451
9452          # Print all available fields.
9453          df --o
9454
9455‘-P’
9456‘--portability’
9457     Use the POSIX output format.  This is like the default format
9458     except for the following:
9459
9460       1. The information about each file system is always printed on
9461          exactly one line; a mount device is never put on a line by
9462          itself.  This means that if the mount device name is more than
9463          20 characters long (e.g., for some network mounts), the
9464          columns are misaligned.
9465
9466       2. The labels in the header output line are changed to conform to
9467          POSIX.
9468
9469       3. The default block size and output format are unaffected by the
9470          ‘DF_BLOCK_SIZE’, ‘BLOCK_SIZE’ and ‘BLOCKSIZE’ environment
9471          variables.  However, the default block size is still affected
9472          by ‘POSIXLY_CORRECT’: it is 512 if ‘POSIXLY_CORRECT’ is set,
9473          1024 otherwise.  *Note Block size::.
9474
9475‘--si’
9476     Append an SI-style abbreviation to each size, such as ‘M’ for
9477     megabytes.  Powers of 1000 are used, not 1024; ‘M’ stands for
9478     1,000,000 bytes.  This option is equivalent to ‘--block-size=si’.
9479     Use the ‘-h’ or ‘--human-readable’ option if you prefer powers of
9480     1024.
9481
9482‘--sync’
9483     Invoke the ‘sync’ system call before getting any usage data.  On
9484     some systems (notably SunOS), doing this yields more up to date
9485     results, but in general this option makes ‘df’ much slower,
9486     especially when there are many or very busy file systems.
9487
9488‘--total’
9489     Print a grand total of all arguments after all arguments have been
9490     processed.  This can be used to find out the total disk size, usage
9491     and available space of all listed devices.  If no arguments are
9492     specified df will try harder to elide file systems insignificant to
9493     the total available space, by suppressing duplicate remote file
9494     systems.
9495
9496     For the grand total line, ‘df’ prints ‘"total"’ into the SOURCE
9497     column, and ‘"-"’ into the TARGET column.  If there is no SOURCE
9498     column (see ‘--output’), then ‘df’ prints ‘"total"’ into the TARGET
9499     column, if present.
9500
9501‘-t FSTYPE’
9502‘--type=FSTYPE’
9503     Limit the listing to file systems of type FSTYPE.  Multiple file
9504     system types can be specified by giving multiple ‘-t’ options.  By
9505     default, nothing is omitted.
9506
9507‘-T’
9508‘--print-type’
9509     Print each file system’s type.  The types printed here are the same
9510     ones you can include or exclude with ‘-t’ and ‘-x’.  The particular
9511     types printed are whatever is supported by the system.  Here are
9512     some of the common names (this list is certainly not exhaustive):
9513
9514     ‘nfs’
9515          An NFS file system, i.e., one mounted over a network from
9516          another machine.  This is the one type name which seems to be
9517          used uniformly by all systems.
9518
9519     ‘ext2, ext3, ext4, xfs, btrfs...’
9520          A file system on a locally-mounted hard disk.  (The system
9521          might even support more than one type here; Linux does.)
9522
9523     ‘iso9660, cdfs’
9524          A file system on a CD or DVD drive.  HP-UX uses ‘cdfs’, most
9525          other systems use ‘iso9660’.
9526
9527     ‘ntfs,fat’
9528          File systems used by MS-Windows / MS-DOS.
9529
9530‘-x FSTYPE’
9531‘--exclude-type=FSTYPE’
9532     Limit the listing to file systems not of type FSTYPE.  Multiple
9533     file system types can be eliminated by giving multiple ‘-x’
9534     options.  By default, no file system types are omitted.
9535
9536‘-v’
9537     Ignored; for compatibility with System V versions of ‘df’.
9538
9539   ‘df’ is installed only on systems that have usable mount tables, so
9540portable scripts should not rely on its existence.
9541
9542   An exit status of zero indicates success, and a nonzero value
9543indicates failure.  Failure includes the case where no output is
9544generated, so you can inspect the exit status of a command like ‘df -t
9545ext3 -t reiserfs DIR’ to test whether DIR is on a file system of type
9546‘ext3’ or ‘reiserfs’.
9547
9548   Since the list of file systems (MTAB) is needed to determine the file
9549system type, failure includes the cases when that list cannot be read
9550and one or more of the options ‘-a’, ‘-l’, ‘-t’ or ‘-x’ is used together
9551with a file name argument.
9552
9553
9554File: coreutils.info,  Node: du invocation,  Next: stat invocation,  Prev: df invocation,  Up: Disk usage
9555
955614.2 ‘du’: Estimate file space usage
9557====================================
9558
9559‘du’ reports the amount of disk space used by the set of specified files
9560and for each subdirectory (of directory arguments).  Synopsis:
9561
9562     du [OPTION]... [FILE]...
9563
9564   With no arguments, ‘du’ reports the disk space for the current
9565directory.  Normally the disk space is printed in units of 1024 bytes,
9566but this can be overridden (*note Block size::).  Non-integer quantities
9567are rounded up to the next higher unit.
9568
9569   If two or more hard links point to the same file, only one of the
9570hard links is counted.  The FILE argument order affects which links are
9571counted, and changing the argument order may change the numbers and
9572entries that ‘du’ outputs.
9573
9574   The program accepts the following options.  Also see *note Common
9575options::.
9576
9577‘-0’
9578‘--null’
9579     Output a zero byte (ASCII NUL) at the end of each line, rather than
9580     a newline.  This option enables other programs to parse the output
9581     even when that output would contain data with embedded newlines.
9582
9583‘-a’
9584‘--all’
9585     Show counts for all files, not just directories.
9586
9587‘--apparent-size’
9588     Print apparent sizes, rather than disk usage.  The apparent size of
9589     a file is the number of bytes reported by ‘wc -c’ on regular files,
9590     or more generally, ‘ls -l --block-size=1’ or ‘stat --format=%s’.
9591     For example, a file containing the word ‘zoo’ with no newline
9592     would, of course, have an apparent size of 3.  Such a small file
9593     may require anywhere from 0 to 16 KiB or more of disk space,
9594     depending on the type and configuration of the file system on which
9595     the file resides.  However, a sparse file created with this
9596     command:
9597
9598          dd bs=1 seek=2GiB if=/dev/null of=big
9599
9600     has an apparent size of 2 GiB, yet on most modern systems, it
9601     actually uses almost no disk space.
9602
9603‘-B SIZE’
9604‘--block-size=SIZE’
9605     Scale sizes by SIZE before printing them (*note Block size::).  For
9606     example, ‘-BG’ prints sizes in units of 1,073,741,824 bytes.
9607
9608‘-b’
9609‘--bytes’
9610     Equivalent to ‘--apparent-size --block-size=1’.
9611
9612‘-c’
9613‘--total’
9614     Print a grand total of all arguments after all arguments have been
9615     processed.  This can be used to find out the total disk usage of a
9616     given set of files or directories.
9617
9618‘-D’
9619‘--dereference-args’
9620     Dereference symbolic links that are command line arguments.  Does
9621     not affect other symbolic links.  This is helpful for finding out
9622     the disk usage of directories, such as ‘/usr/tmp’, which are often
9623     symbolic links.
9624
9625‘-d DEPTH’
9626‘--max-depth=DEPTH’
9627     Show the total for each directory (and file if –all) that is at
9628     most MAX_DEPTH levels down from the root of the hierarchy.  The
9629     root is at level 0, so ‘du --max-depth=0’ is equivalent to ‘du -s’.
9630
9631‘--files0-from=FILE’
9632     Disallow processing files named on the command line, and instead
9633     process those named in file FILE; each name being terminated by a
9634     zero byte (ASCII NUL). This is useful when the list of file names
9635     is so long that it may exceed a command line length limitation.  In
9636     such cases, running ‘du’ via ‘xargs’ is undesirable because it
9637     splits the list into pieces and makes ‘du’ print with the ‘--total’
9638     (‘-c’) option for each sublist rather than for the entire list.
9639     One way to produce a list of ASCII NUL terminated file names is
9640     with GNU ‘find’, using its ‘-print0’ predicate.  If FILE is ‘-’
9641     then the ASCII NUL terminated file names are read from standard
9642     input.
9643
9644‘-H’
9645     Equivalent to ‘--dereference-args’ (‘-D’).
9646
9647‘-h’
9648‘--human-readable’
9649     Append a size letter to each size, such as ‘M’ for mebibytes.
9650     Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes.
9651     This option is equivalent to ‘--block-size=human-readable’.  Use
9652     the ‘--si’ option if you prefer powers of 1000.
9653
9654‘--inodes’
9655     List inode usage information instead of block usage.  This option
9656     is useful for finding directories which contain many files, and
9657     therefore eat up most of the inodes space of a file system (see
9658     ‘df’, option ‘--inodes’).  It can well be combined with the options
9659     ‘-a’, ‘-c’, ‘-h’, ‘-l’, ‘-s’, ‘-S’, ‘-t’ and ‘-x’; however, passing
9660     other options regarding the block size, for example ‘-b’, ‘-m’ and
9661     ‘--apparent-size’, is ignored.
9662
9663‘-k’
9664     Print sizes in 1024-byte blocks, overriding the default block size
9665     (*note Block size::).  This option is equivalent to
9666     ‘--block-size=1K’.
9667
9668‘-L’
9669‘--dereference’
9670     Dereference symbolic links (show the disk space used by the file or
9671     directory that the link points to instead of the space used by the
9672     link).
9673
9674‘-l’
9675‘--count-links’
9676     Count the size of all files, even if they have appeared already (as
9677     a hard link).
9678
9679‘-m’
9680     Print sizes in 1,048,576-byte blocks, overriding the default block
9681     size (*note Block size::).  This option is equivalent to
9682     ‘--block-size=1M’.
9683
9684‘-P’
9685‘--no-dereference’
9686     For each symbolic links encountered by ‘du’, consider the disk
9687     space used by the symbolic link.
9688
9689‘-S’
9690‘--separate-dirs’
9691     Normally, in the output of ‘du’ (when not using ‘--summarize’), the
9692     size listed next to a directory name, D, represents the sum of
9693     sizes of all entries beneath D as well as the size of D itself.
9694     With ‘--separate-dirs’, the size reported for a directory name, D,
9695     will exclude the size of any subdirectories.
9696
9697‘--si’
9698     Append an SI-style abbreviation to each size, such as ‘M’ for
9699     megabytes.  Powers of 1000 are used, not 1024; ‘M’ stands for
9700     1,000,000 bytes.  This option is equivalent to ‘--block-size=si’.
9701     Use the ‘-h’ or ‘--human-readable’ option if you prefer powers of
9702     1024.
9703
9704‘-s’
9705‘--summarize’
9706     Display only a total for each argument.
9707
9708‘-t SIZE’
9709‘--threshold=SIZE’
9710     Exclude entries based on a given SIZE.  The SIZE refers to used
9711     blocks in normal mode (*note Block size::), or inodes count in
9712     conjunction with the ‘--inodes’ option.
9713
9714     If SIZE is positive, then ‘du’ will only print entries with a size
9715     greater than or equal to that.
9716
9717     If SIZE is negative, then ‘du’ will only print entries with a size
9718     smaller than or equal to that.
9719
9720     Although GNU ‘find’ can be used to find files of a certain size,
9721     ‘du’’s ‘--threshold’ option can be used to also filter directories
9722     based on a given size.
9723
9724     Please note that the ‘--threshold’ option can be combined with the
9725     ‘--apparent-size’ option, and in this case would elide entries
9726     based on its apparent size.
9727
9728     Please note that the ‘--threshold’ option can be combined with the
9729     ‘--inodes’ option, and in this case would elide entries based on
9730     its inodes count.
9731
9732     Here’s how you would use ‘--threshold’ to find directories with a
9733     size greater than or equal to 200 megabytes:
9734
9735          du --threshold=200MB
9736
9737     Here’s how you would use ‘--threshold’ to find directories and
9738     files - note the ‘-a’ - with an apparent size smaller than or equal
9739     to 500 bytes:
9740
9741          du -a -t -500 --apparent-size
9742
9743     Here’s how you would use ‘--threshold’ to find directories on the
9744     root file system with more than 20000 inodes used in the directory
9745     tree below:
9746
9747          du --inodes -x --threshold=20000 /
9748
9749‘--time’
9750     Show the most recent modification timestamp (mtime) of any file in
9751     the directory, or any of its subdirectories.  *Note File
9752     timestamps::.
9753
9754‘--time=ctime’
9755‘--time=status’
9756‘--time=use’
9757     Show the most recent status change timestamp (ctime) of any file in
9758     the directory, or any of its subdirectories.  *Note File
9759     timestamps::.
9760
9761‘--time=atime’
9762‘--time=access’
9763     Show the most recent access timestamp (atime) of any file in the
9764     directory, or any of its subdirectories.  *Note File timestamps::.
9765
9766‘--time-style=STYLE’
9767     List timestamps in style STYLE.  This option has an effect only if
9768     the ‘--time’ option is also specified.  The STYLE should be one of
9769     the following:
9770
9771     ‘+FORMAT’
9772          List timestamps using FORMAT, where FORMAT is interpreted like
9773          the format argument of ‘date’ (*note date invocation::).  For
9774          example, ‘--time-style="+%Y-%m-%d %H:%M:%S"’ causes ‘du’ to
9775          list timestamps like ‘2002-03-30 23:45:56’.  As with ‘date’,
9776          FORMAT’s interpretation is affected by the ‘LC_TIME’ locale
9777          category.
9778
9779     ‘full-iso’
9780          List timestamps in full using ISO 8601-like date, time, and
9781          time zone components with nanosecond precision, e.g.,
9782          ‘2002-03-30 23:45:56.477817180 -0700’.  This style is
9783          equivalent to ‘+%Y-%m-%d %H:%M:%S.%N %z’.
9784
9785     ‘long-iso’
9786          List ISO 8601 date and time components with minute precision,
9787          e.g., ‘2002-03-30 23:45’.  These timestamps are shorter than
9788          ‘full-iso’ timestamps, and are usually good enough for
9789          everyday work.  This style is equivalent to ‘+%Y-%m-%d %H:%M’.
9790
9791     ‘iso’
9792          List ISO 8601 dates for timestamps, e.g., ‘2002-03-30’.  This
9793          style is equivalent to ‘+%Y-%m-%d’.
9794
9795     You can specify the default value of the ‘--time-style’ option with
9796     the environment variable ‘TIME_STYLE’; if ‘TIME_STYLE’ is not set
9797     the default style is ‘long-iso’.  For compatibility with ‘ls’, if
9798     ‘TIME_STYLE’ begins with ‘+’ and contains a newline, the newline
9799     and any later characters are ignored; if ‘TIME_STYLE’ begins with
9800     ‘posix-’ the ‘posix-’ is ignored; and if ‘TIME_STYLE’ is ‘locale’
9801     it is ignored.
9802
9803‘-X FILE’
9804‘--exclude-from=FILE’
9805     Like ‘--exclude’, except take the patterns to exclude from FILE,
9806     one per line.  If FILE is ‘-’, take the patterns from standard
9807     input.
9808
9809‘--exclude=PATTERN’
9810     When recursing, skip subdirectories or files matching PATTERN.  For
9811     example, ‘du --exclude='*.o'’ excludes files whose names end in
9812     ‘.o’.
9813
9814‘-x’
9815‘--one-file-system’
9816     Skip directories that are on different file systems from the one
9817     that the argument being processed is on.
9818
9819   On BSD systems, ‘du’ reports sizes that are half the correct values
9820for files that are NFS-mounted from HP-UX systems.  On HP-UX systems, it
9821reports sizes that are twice the correct values for files that are
9822NFS-mounted from BSD systems.  This is due to a flaw in HP-UX; it also
9823affects the HP-UX ‘du’ program.
9824
9825   An exit status of zero indicates success, and a nonzero value
9826indicates failure.
9827
9828
9829File: coreutils.info,  Node: stat invocation,  Next: sync invocation,  Prev: du invocation,  Up: Disk usage
9830
983114.3 ‘stat’: Report file or file system status
9832==============================================
9833
9834‘stat’ displays information about the specified file(s).  Synopsis:
9835
9836     stat [OPTION]... [FILE]...
9837
9838   With no option, ‘stat’ reports all information about the given files.
9839But it also can be used to report the information of the file systems
9840the given files are located on.  If the files are links, ‘stat’ can also
9841give information about the files the links point to.
9842
9843   Due to shell aliases and built-in ‘stat’ functions, using an
9844unadorned ‘stat’ interactively or in a script may get you different
9845functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
9846stat ...’) to avoid interference from the shell.
9847
9848‘-L’
9849‘--dereference’
9850     Change how ‘stat’ treats symbolic links.  With this option, ‘stat’
9851     acts on the file referenced by each symbolic link argument.
9852     Without it, ‘stat’ acts on any symbolic link argument directly.
9853
9854‘-f’
9855‘--file-system’
9856     Report information about the file systems where the given files are
9857     located instead of information about the files themselves.  This
9858     option implies the ‘-L’ option.
9859
9860‘--cached=MODE’
9861     Control how attributes are read from the file system; if supported
9862     by the system.  This allows one to control the trade-off between
9863     freshness and efficiency of attribute access, especially useful
9864     with remote file systems.  MODE can be:
9865
9866     ‘always’
9867          Always read the already cached attributes if available.
9868
9869     ‘never’
9870          Always sychronize with the latest file system attributes.
9871
9872     ‘default’
9873          Leave the caching behavior to the underlying file system.
9874
9875‘-c’
9876‘--format=FORMAT’
9877     Use FORMAT rather than the default format.  FORMAT is automatically
9878     newline-terminated, so running a command like the following with
9879     two or more FILE operands produces a line of output for each
9880     operand:
9881          $ stat --format=%d:%i / /usr
9882          2050:2
9883          2057:2
9884
9885‘--printf=FORMAT’
9886     Use FORMAT rather than the default format.  Like ‘--format’, but
9887     interpret backslash escapes, and do not output a mandatory trailing
9888     newline.  If you want a newline, include ‘\n’ in the FORMAT.
9889     Here’s how you would use ‘--printf’ to print the device and inode
9890     numbers of ‘/’ and ‘/usr’:
9891          $ stat --printf='%d:%i\n' / /usr
9892          2050:2
9893          2057:2
9894
9895‘-t’
9896‘--terse’
9897     Print the information in terse form, suitable for parsing by other
9898     programs.
9899
9900     The output of the following commands are identical and the
9901     ‘--format’ also identifies the items printed (in fuller form) in
9902     the default format.  Note the format string would include another
9903     ‘%C’ at the end with an active SELinux security context.
9904          $ stat --format="%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o" ...
9905          $ stat --terse ...
9906
9907     The same illustrating terse output in ‘--file-system’ mode:
9908          $ stat -f --format="%n %i %l %t %s %S %b %f %a %c %d" ...
9909          $ stat -f --terse ...
9910
9911   The valid FORMAT directives for files with ‘--format’ and ‘--printf’
9912are:
9913
9914   • %a - Permission bits in octal (note ‘#’ and ‘0’ printf flags)
9915   • %A - Permission bits in symbolic form (similar to ‘ls -ld’)
9916   • %b - Number of blocks allocated (see ‘%B’)
9917   • %B - The size in bytes of each block reported by ‘%b’
9918   • %C - The SELinux security context of a file, if available
9919   • %d - Device number in decimal
9920   • %D - Device number in hex
9921   • %f - Raw mode in hex
9922   • %F - File type
9923   • %g - Group ID of owner
9924   • %G - Group name of owner
9925   • %h - Number of hard links
9926   • %i - Inode number
9927   • %m - Mount point (See note below)
9928   • %n - File name
9929   • %N - Quoted file name with dereference if symbolic link (see below)
9930   • %o - Optimal I/O transfer size hint
9931   • %s - Total size, in bytes
9932   • %t - Major device type in hex (see below)
9933   • %T - Minor device type in hex (see below)
9934   • %u - User ID of owner
9935   • %U - User name of owner
9936   • %w - Time of file birth, or ‘-’ if unknown
9937   • %W - Time of file birth as seconds since Epoch, or ‘0’
9938   • %x - Time of last access
9939   • %X - Time of last access as seconds since Epoch
9940   • %y - Time of last data modification
9941   • %Y - Time of last data modification as seconds since Epoch
9942   • %z - Time of last status change
9943   • %Z - Time of last status change as seconds since Epoch
9944
9945   The ‘%a’ format prints the octal mode, and so it is useful to control
9946the zero padding of the output with the ‘#’ and ‘0’ printf flags.  For
9947example to pad to at least 3 wide while making larger numbers
9948unambiguously octal, you can use ‘%#03a’.
9949
9950   The ‘%N’ format can be set with the environment variable
9951‘QUOTING_STYLE’.  If that environment variable is not set, the default
9952value is ‘shell-escape-always’.  Valid quoting styles are:
9953‘literal’
9954     Output strings as-is; this is the same as the ‘-N’ or ‘--literal’
9955     option.
9956‘shell’
9957     Quote strings for the shell if they contain shell metacharacters or
9958     would cause ambiguous output.  The quoting is suitable for
9959     POSIX-compatible shells like ‘bash’, but it does not always work
9960     for incompatible shells like ‘csh’.
9961‘shell-always’
9962     Quote strings for the shell, even if they would normally not
9963     require quoting.
9964‘shell-escape’
9965     Like ‘shell’, but also quoting non-printable characters using the
9966     POSIX proposed ‘$''’ syntax suitable for most shells.
9967‘shell-escape-always’
9968     Like ‘shell-escape’, but quote strings even if they would normally
9969     not require quoting.
9970‘c’
9971     Quote strings as for C character string literals, including the
9972     surrounding double-quote characters; this is the same as the ‘-Q’
9973     or ‘--quote-name’ option.
9974‘escape’
9975     Quote strings as for C character string literals, except omit the
9976     surrounding double-quote characters; this is the same as the ‘-b’
9977     or ‘--escape’ option.
9978‘clocale’
9979     Quote strings as for C character string literals, except use
9980     surrounding quotation marks appropriate for the locale.
9981‘locale’
9982     Quote strings as for C character string literals, except use
9983     surrounding quotation marks appropriate for the locale, and quote
9984     'like this' instead of "like this" in the default C locale.  This
9985     looks nicer on many displays.
9986
9987   The ‘%t’ and ‘%T’ formats operate on the st_rdev member of the
9988stat(2) structure, and are only defined for character and block special
9989files.  On some systems or file types, st_rdev may be used to represent
9990other quantities.
9991
9992   The ‘%W’, ‘%X’, ‘%Y’, and ‘%Z’ formats accept a precision preceded by
9993a period to specify the number of digits to print after the decimal
9994point.  For example, ‘%.3X’ outputs the access timestamp to millisecond
9995precision.  If a period is given but no precision, ‘stat’ uses 9 digits,
9996so ‘%.X’ is equivalent to ‘%.9X’.  When discarding excess precision,
9997timestamps are truncated toward minus infinity.
9998
9999     zero pad:
10000       $ stat -c '[%015Y]' /usr
10001       [000001288929712]
10002     space align:
10003       $ stat -c '[%15Y]' /usr
10004       [     1288929712]
10005       $ stat -c '[%-15Y]' /usr
10006       [1288929712     ]
10007     precision:
10008       $ stat -c '[%.3Y]' /usr
10009       [1288929712.114]
10010       $ stat -c '[%.Y]' /usr
10011       [1288929712.114951834]
10012
10013   The mount point printed by ‘%m’ is similar to that output by ‘df’,
10014except that:
10015   • stat does not dereference symlinks by default (unless ‘-L’ is
10016     specified)
10017   • stat does not search for specified device nodes in the file system
10018     list, instead operating on them directly
10019   • stat outputs the alias for a bind mounted file, rather than the
10020     initial mount point of its backing device.  One can recursively
10021     call stat until there is no change in output, to get the current
10022     base mount point
10023
10024   When listing file system information (‘--file-system’ (‘-f’)), you
10025must use a different set of FORMAT directives:
10026
10027   • %a - Free blocks available to non-super-user
10028   • %b - Total data blocks in file system
10029   • %c - Total file nodes in file system
10030   • %d - Free file nodes in file system
10031   • %f - Free blocks in file system
10032   • %i - File System ID in hex
10033   • %l - Maximum length of file names
10034   • %n - File name
10035   • %s - Block size (for faster transfers)
10036   • %S - Fundamental block size (for block counts)
10037   • %t - Type in hex
10038   • %T - Type in human readable form
10039
10040   Timestamps are listed according to the time zone rules specified by
10041the ‘TZ’ environment variable, or by the system default rules if ‘TZ’ is
10042not set.  *Note Specifying the Time Zone with ‘TZ’: (libc)TZ Variable.
10043
10044   An exit status of zero indicates success, and a nonzero value
10045indicates failure.
10046
10047
10048File: coreutils.info,  Node: sync invocation,  Next: truncate invocation,  Prev: stat invocation,  Up: Disk usage
10049
1005014.4 ‘sync’: Synchronize cached writes to persistent storage
10051============================================================
10052
10053‘sync’ synchronizes in memory files or file systems to persistent
10054storage.  Synopsis:
10055
10056     sync [OPTION] [FILE]...
10057
10058   ‘sync’ writes any data buffered in memory out to disk.  This can
10059include (but is not limited to) modified superblocks, modified inodes,
10060and delayed reads and writes.  This must be implemented by the kernel;
10061The ‘sync’ program does nothing but exercise the ‘sync’, ‘syncfs’,
10062‘fsync’, and ‘fdatasync’ system calls.
10063
10064   The kernel keeps data in memory to avoid doing (relatively slow) disk
10065reads and writes.  This improves performance, but if the computer
10066crashes, data may be lost or the file system corrupted as a result.  The
10067‘sync’ command instructs the kernel to write data in memory to
10068persistent storage.
10069
10070   If any argument is specified then only those files will be
10071synchronized using the fsync(2) syscall by default.
10072
10073   If at least one file is specified, it is possible to change the
10074synchronization method with the following options.  Also see *note
10075Common options::.
10076
10077‘-d’
10078‘--data’
10079     Use fdatasync(2) to sync only the data for the file, and any
10080     metadata required to maintain file system consistency.
10081
10082‘-f’
10083‘--file-system’
10084     Synchronize all the I/O waiting for the file systems that contain
10085     the file, using the syscall syncfs(2).  Note you would usually
10086     _not_ specify this option if passing a device node like ‘/dev/sda10087     for example, as that would sync the containing file system rather
10088     than the referenced one.  Note also that depending on the system,
10089     passing individual device nodes or files may have different sync
10090     characteristics than using no arguments.  I.e., arguments passed to
10091     fsync(2) may provide greater guarantees through write barriers,
10092     than a global sync(2) used when no arguments are provided.
10093
10094   An exit status of zero indicates success, and a nonzero value
10095indicates failure.
10096
10097
10098File: coreutils.info,  Node: truncate invocation,  Prev: sync invocation,  Up: Disk usage
10099
1010014.5 ‘truncate’: Shrink or extend the size of a file
10101====================================================
10102
10103‘truncate’ shrinks or extends the size of each FILE to the specified
10104size.  Synopsis:
10105
10106     truncate OPTION... FILE...
10107
10108   Any FILE that does not exist is created.
10109
10110   If a FILE is larger than the specified size, the extra data is lost.
10111If a FILE is shorter, it is extended and the sparse extended part (or
10112hole) reads as zero bytes.
10113
10114   The program accepts the following options.  Also see *note Common
10115options::.
10116
10117‘-c’
10118‘--no-create’
10119     Do not create files that do not exist.
10120
10121‘-o’
10122‘--io-blocks’
10123     Treat SIZE as number of I/O blocks of the FILE rather than bytes.
10124
10125‘-r RFILE’
10126‘--reference=RFILE’
10127     Base the size of each FILE on the size of RFILE.
10128
10129‘-s SIZE’
10130‘--size=SIZE’
10131     Set or adjust the size of each FILE according to SIZE.  SIZE is in
10132     bytes unless ‘--io-blocks’ is specified.  SIZE may be, or may be an
10133     integer optionally followed by, one of the following multiplicative
10134     suffixes:
10135          ‘KB’ =>           1000 (KiloBytes)
10136          ‘K’  =>           1024 (KibiBytes)
10137          ‘MB’ =>      1000*1000 (MegaBytes)
10138          ‘M’  =>      1024*1024 (MebiBytes)
10139          ‘GB’ => 1000*1000*1000 (GigaBytes)
10140          ‘G’  => 1024*1024*1024 (GibiBytes)
10141     and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.  Binary prefixes can be
10142     used, too: ‘KiB’=‘K’, ‘MiB’=‘M’, and so on.
10143
10144     SIZE may also be prefixed by one of the following to adjust the
10145     size of each FILE based on its current size:
10146          ‘+’  => extend by
10147          ‘-’  => reduce by
10148          ‘<’  => at most
10149          ‘>’  => at least
10150          ‘/’  => round down to multiple of
10151          ‘%’  => round up to multiple of
10152
10153   An exit status of zero indicates success, and a nonzero value
10154indicates failure.
10155
10156
10157File: coreutils.info,  Node: Printing text,  Next: Conditions,  Prev: Disk usage,  Up: Top
10158
1015915 Printing text
10160****************
10161
10162This section describes commands that display text strings.
10163
10164* Menu:
10165
10166* echo invocation::             Print a line of text.
10167* printf invocation::           Format and print data.
10168* yes invocation::              Print a string until interrupted.
10169
10170
10171File: coreutils.info,  Node: echo invocation,  Next: printf invocation,  Up: Printing text
10172
1017315.1 ‘echo’: Print a line of text
10174=================================
10175
10176‘echo’ writes each given STRING to standard output, with a space between
10177each and a newline after the last one.  Synopsis:
10178
10179     echo [OPTION]... [STRING]...
10180
10181   Due to shell aliases and built-in ‘echo’ functions, using an
10182unadorned ‘echo’ interactively or in a script may get you different
10183functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
10184echo ...’) to avoid interference from the shell.
10185
10186   The program accepts the following options.  Also see *note Common
10187options::.  Options must precede operands, and the normally-special
10188argument ‘--’ has no special meaning and is treated like any other
10189STRING.
10190
10191‘-n’
10192     Do not output the trailing newline.
10193
10194‘-e’
10195     Enable interpretation of the following backslash-escaped characters
10196     in each STRING:
10197
10198     ‘\a’
10199          alert (bell)
10200     ‘\b’
10201          backspace
10202     ‘\c’
10203          produce no further output
10204     ‘\e’
10205          escape
10206     ‘\f’
10207          form feed
10208     ‘\n’
10209          newline
10210     ‘\r’
10211          carriage return
10212     ‘\t’
10213          horizontal tab
10214     ‘\v’
10215          vertical tab
10216     ‘\\’
10217          backslash
10218     ‘\0NNN’
10219          the eight-bit value that is the octal number NNN (zero to
10220          three octal digits), if NNN is a nine-bit value, the ninth bit
10221          is ignored
10222     ‘\NNN’
10223          the eight-bit value that is the octal number NNN (one to three
10224          octal digits), if NNN is a nine-bit value, the ninth bit is
10225          ignored
10226     ‘\xHH’
10227          the eight-bit value that is the hexadecimal number HH (one or
10228          two hexadecimal digits)
10229
10230‘-E’
10231     Disable interpretation of backslash escapes in each STRING.  This
10232     is the default.  If ‘-e’ and ‘-E’ are both specified, the last one
10233     given takes effect.
10234
10235   If the ‘POSIXLY_CORRECT’ environment variable is set, then when
10236‘echo’’s first argument is not ‘-n’ it outputs option-like arguments
10237instead of treating them as options.  For example, ‘echo -ne hello’
10238outputs ‘-ne hello’ instead of plain ‘hello’.  Also backslash escapes
10239are always enabled.
10240
10241   POSIX does not require support for any options, and says that the
10242behavior of ‘echo’ is implementation-defined if any STRING contains a
10243backslash or if the first argument is ‘-n’.  Portable programs can use
10244the ‘printf’ command if they need to omit trailing newlines or output
10245control characters or backslashes.  *Note printf invocation::.
10246
10247   An exit status of zero indicates success, and a nonzero value
10248indicates failure.
10249
10250
10251File: coreutils.info,  Node: printf invocation,  Next: yes invocation,  Prev: echo invocation,  Up: Printing text
10252
1025315.2 ‘printf’: Format and print data
10254====================================
10255
10256‘printf’ does formatted printing of text.  Synopsis:
10257
10258     printf FORMAT [ARGUMENT]...
10259
10260   ‘printf’ prints the FORMAT string, interpreting ‘%’ directives and
10261‘\’ escapes to format numeric and string arguments in a way that is
10262mostly similar to the C ‘printf’ function.  *Note ‘printf’ format
10263directives: (libc)Output Conversion Syntax, for details.  The
10264differences are listed below.
10265
10266   Due to shell aliases and built-in ‘printf’ functions, using an
10267unadorned ‘printf’ interactively or in a script may get you different
10268functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
10269printf ...’) to avoid interference from the shell.
10270
10271   • The FORMAT argument is reused as necessary to convert all the given
10272     ARGUMENTs.  For example, the command ‘printf %s a b’ outputs ‘ab’.
10273
10274   • Missing ARGUMENTs are treated as null strings or as zeros,
10275     depending on whether the context expects a string or a number.  For
10276     example, the command ‘printf %sx%d’ prints ‘x0’.
10277
10278   • An additional escape, ‘\c’, causes ‘printf’ to produce no further
10279     output.  For example, the command ‘printf 'A%sC\cD%sF' B E’ prints
10280     ‘ABC’.
10281
10282   • The hexadecimal escape sequence ‘\xHH’ has at most two digits, as
10283     opposed to C where it can have an unlimited number of digits.  For
10284     example, the command ‘printf '\x07e'’ prints two bytes, whereas the
10285     C statement ‘printf ("\x07e")’ prints just one.
10286
10287   • An additional directive ‘%b’, prints its argument string with ‘\’
10288     escapes interpreted in the same way as in the FORMAT string, except
10289     that octal escapes are of the form ‘\0OOO’ where OOO is 0 to 3
10290     octal digits.  If ‘\OOO’ is nine-bit value, ignore the ninth bit.
10291     If a precision is also given, it limits the number of bytes printed
10292     from the converted string.
10293
10294   • An additional directive ‘%q’, prints its argument string in a
10295     format that can be reused as input by most shells.  Non-printable
10296     characters are escaped with the POSIX proposed ‘$''’ syntax, and
10297     shell metacharacters are quoted appropriately.  This is an
10298     equivalent format to ‘ls --quoting=shell-escape’ output.
10299
10300   • Numeric arguments must be single C constants, possibly with leading
10301     ‘+’ or ‘-’.  For example, ‘printf %.4d -3’ outputs ‘-0003’.
10302
10303   • If the leading character of a numeric argument is ‘"’ or ‘'’ then
10304     its value is the numeric value of the immediately following
10305     character.  Any remaining characters are silently ignored if the
10306     ‘POSIXLY_CORRECT’ environment variable is set; otherwise, a warning
10307     is printed.  For example, ‘printf "%d" "'a"’ outputs ‘97’ on hosts
10308     that use the ASCII character set, since ‘a’ has the numeric value
10309     97 in ASCII.
10310
10311   A floating point argument is interpreted according to the
10312‘LC_NUMERIC’ category of either the current or the C locale, and is
10313printed according to the current locale.  For example, in a locale whose
10314decimal point character is a comma, the command ‘printf '%g %g' 2,5 2.5’
10315outputs ‘2,5 2,5’.  *Note Floating point::.
10316
10317   ‘printf’ interprets ‘\OOO’ in FORMAT as an octal number (if OOO is 1
10318to 3 octal digits) specifying a byte to print, and ‘\xHH’ as a
10319hexadecimal number (if HH is 1 to 2 hex digits) specifying a character
10320to print.  Note however that when ‘\OOO’ specifies a number larger than
10321255, ‘printf’ ignores the ninth bit.  For example, ‘printf '\400'’ is
10322equivalent to ‘printf '\0'’.
10323
10324   ‘printf’ interprets two character syntaxes introduced in ISO C 99:
10325‘\u’ for 16-bit Unicode (ISO/IEC 10646) characters, specified as four
10326hexadecimal digits HHHH, and ‘\U’ for 32-bit Unicode characters,
10327specified as eight hexadecimal digits HHHHHHHH.  ‘printf’ outputs the
10328Unicode characters according to the ‘LC_CTYPE’ locale.  Unicode
10329characters in the ranges U+0000...U+009F, U+D800...U+DFFF cannot be
10330specified by this syntax, except for U+0024 ($), U+0040 (@), and U+0060
10331()̀.
10332
10333   The processing of ‘\u’ and ‘\U’ requires a full-featured ‘iconv’
10334facility.  It is activated on systems with glibc 2.2 (or newer), or when
10335‘libiconv’ is installed prior to this package.  Otherwise ‘\u’ and ‘\U’
10336will print as-is.
10337
10338   The only options are a lone ‘--help’ or ‘--version’.  *Note Common
10339options::.  Options must precede operands.
10340
10341   The Unicode character syntaxes are useful for writing strings in a
10342locale independent way.  For example, a string containing the Euro
10343currency symbol
10344
10345     $ env printf '\u20AC 14.95'
10346
10347will be output correctly in all locales supporting the Euro symbol
10348(ISO-8859-15, UTF-8, and others).  Similarly, a Chinese string
10349
10350     $ env printf '\u4e2d\u6587'
10351
10352will be output correctly in all Chinese locales (GB2312, BIG5, UTF-8,
10353etc).
10354
10355   Note that in these examples, the ‘printf’ command has been invoked
10356via ‘env’ to ensure that we run the program found via your shell’s
10357search path, and not a shell alias or a built-in function.
10358
10359   For larger strings, you don’t need to look up the hexadecimal code
10360values of each character one by one.  ASCII characters mixed with \u
10361escape sequences is also known as the JAVA source file encoding.  You
10362can use GNU recode 3.5c (or newer) to convert strings to this encoding.
10363Here is how to convert a piece of text into a shell script which will
10364output this text in a locale-independent way:
10365
10366     $ LC_CTYPE=zh_CN.big5 /usr/local/bin/printf \
10367         '\u4e2d\u6587\n' > sample.txt
10368     $ recode BIG5..JAVA < sample.txt \
10369         | sed -e "s|^|/usr/local/bin/printf '|" -e "s|$|\\\\n'|" \
10370         > sample.sh
10371
10372   An exit status of zero indicates success, and a nonzero value
10373indicates failure.
10374
10375
10376File: coreutils.info,  Node: yes invocation,  Prev: printf invocation,  Up: Printing text
10377
1037815.3 ‘yes’: Print a string until interrupted
10379============================================
10380
10381‘yes’ prints the command line arguments, separated by spaces and
10382followed by a newline, forever until it is killed.  If no arguments are
10383given, it prints ‘y’ followed by a newline forever until killed.
10384
10385   Upon a write error, ‘yes’ exits with status ‘1’.
10386
10387   The only options are a lone ‘--help’ or ‘--version’.  To output an
10388argument that begins with ‘-’, precede it with ‘--’, e.g., ‘yes --
10389--help’.  *Note Common options::.
10390
10391
10392File: coreutils.info,  Node: Conditions,  Next: Redirection,  Prev: Printing text,  Up: Top
10393
1039416 Conditions
10395*************
10396
10397This section describes commands that are primarily useful for their exit
10398status, rather than their output.  Thus, they are often used as the
10399condition of shell ‘if’ statements, or as the last command in a
10400pipeline.
10401
10402* Menu:
10403
10404* false invocation::            Do nothing, unsuccessfully.
10405* true invocation::             Do nothing, successfully.
10406* test invocation::             Check file types and compare values.
10407* expr invocation::             Evaluate expressions.
10408
10409
10410File: coreutils.info,  Node: false invocation,  Next: true invocation,  Up: Conditions
10411
1041216.1 ‘false’: Do nothing, unsuccessfully
10413========================================
10414
10415‘false’ does nothing except return an exit status of 1, meaning
10416“failure”.  It can be used as a place holder in shell scripts where an
10417unsuccessful command is needed.  In most modern shells, ‘false’ is a
10418built-in command, so when you use ‘false’ in a script, you’re probably
10419using the built-in command, not the one documented here.
10420
10421   ‘false’ honors the ‘--help’ and ‘--version’ options.
10422
10423   This version of ‘false’ is implemented as a C program, and is thus
10424more secure and faster than a shell script implementation, and may
10425safely be used as a dummy shell for the purpose of disabling accounts.
10426
10427   Note that ‘false’ (unlike all other programs documented herein) exits
10428unsuccessfully, even when invoked with ‘--help’ or ‘--version’.
10429
10430   Portable programs should not assume that the exit status of ‘false’
10431is 1, as it is greater than 1 on some non-GNU hosts.
10432
10433
10434File: coreutils.info,  Node: true invocation,  Next: test invocation,  Prev: false invocation,  Up: Conditions
10435
1043616.2 ‘true’: Do nothing, successfully
10437=====================================
10438
10439‘true’ does nothing except return an exit status of 0, meaning
10440“success”.  It can be used as a place holder in shell scripts where a
10441successful command is needed, although the shell built-in command ‘:’
10442(colon) may do the same thing faster.  In most modern shells, ‘true’ is
10443a built-in command, so when you use ‘true’ in a script, you’re probably
10444using the built-in command, not the one documented here.
10445
10446   ‘true’ honors the ‘--help’ and ‘--version’ options.
10447
10448   Note, however, that it is possible to cause ‘true’ to exit with
10449nonzero status: with the ‘--help’ or ‘--version’ option, and with
10450standard output already closed or redirected to a file that evokes an
10451I/O error.  For example, using a Bourne-compatible shell:
10452
10453     $ ./true --version >&-
10454     ./true: write error: Bad file number
10455     $ ./true --version > /dev/full
10456     ./true: write error: No space left on device
10457
10458   This version of ‘true’ is implemented as a C program, and is thus
10459more secure and faster than a shell script implementation, and may
10460safely be used as a dummy shell for the purpose of disabling accounts.
10461
10462
10463File: coreutils.info,  Node: test invocation,  Next: expr invocation,  Prev: true invocation,  Up: Conditions
10464
1046516.3 ‘test’: Check file types and compare values
10466================================================
10467
10468‘test’ returns a status of 0 (true) or 1 (false) depending on the
10469evaluation of the conditional expression EXPR.  Each part of the
10470expression must be a separate argument.
10471
10472   ‘test’ has file status checks, string operators, and numeric
10473comparison operators.
10474
10475   ‘test’ has an alternate form that uses opening and closing square
10476brackets instead a leading ‘test’.  For example, instead of ‘test -d /’,
10477you can write ‘[ -d / ]’.  The square brackets must be separate
10478arguments; for example, ‘[-d /]’ does not have the desired effect.
10479Since ‘test EXPR’ and ‘[ EXPR ]’ have the same meaning, only the former
10480form is discussed below.
10481
10482   Synopses:
10483
10484     test EXPRESSION
10485     test
10486     [ EXPRESSION ]
10487     [ ]
10488     [ OPTION
10489
10490   Due to shell aliases and built-in ‘test’ functions, using an
10491unadorned ‘test’ interactively or in a script may get you different
10492functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
10493test ...’) to avoid interference from the shell.
10494
10495   If EXPRESSION is omitted, ‘test’ returns false.  If EXPRESSION is a
10496single argument, ‘test’ returns false if the argument is null and true
10497otherwise.  The argument can be any string, including strings like ‘-d’,
10498‘-1’, ‘--’, ‘--help’, and ‘--version’ that most other programs would
10499treat as options.  To get help and version information, invoke the
10500commands ‘[ --help’ and ‘[ --version’, without the usual closing
10501brackets.  *Note Common options::.
10502
10503   Exit status:
10504
10505     0 if the expression is true,
10506     1 if the expression is false,
10507     2 if an error occurred.
10508
10509* Menu:
10510
10511* File type tests::             -[bcdfhLpSt]
10512* Access permission tests::     -[gkruwxOG]
10513* File characteristic tests::   -e -s -nt -ot -ef
10514* String tests::                -z -n = == !=
10515* Numeric tests::               -eq -ne -lt -le -gt -ge
10516* Connectives for test::        ! -a -o
10517
10518
10519File: coreutils.info,  Node: File type tests,  Next: Access permission tests,  Up: test invocation
10520
1052116.3.1 File type tests
10522----------------------
10523
10524These options test for particular types of files.  (Everything’s a file,
10525but not all files are the same!)
10526
10527‘-b FILE’
10528     True if FILE exists and is a block special device.
10529
10530‘-c FILE’
10531     True if FILE exists and is a character special device.
10532
10533‘-d FILE’
10534     True if FILE exists and is a directory.
10535
10536‘-f FILE’
10537     True if FILE exists and is a regular file.
10538
10539‘-h FILE’
10540‘-L FILE’
10541     True if FILE exists and is a symbolic link.  Unlike all other
10542     file-related tests, this test does not dereference FILE if it is a
10543     symbolic link.
10544
10545‘-p FILE’
10546     True if FILE exists and is a named pipe.
10547
10548‘-S FILE’
10549     True if FILE exists and is a socket.
10550
10551‘-t FD’
10552     True if FD is a file descriptor that is associated with a terminal.
10553
10554
10555File: coreutils.info,  Node: Access permission tests,  Next: File characteristic tests,  Prev: File type tests,  Up: test invocation
10556
1055716.3.2 Access permission tests
10558------------------------------
10559
10560These options test for particular access permissions.
10561
10562‘-g FILE’
10563     True if FILE exists and has its set-group-ID bit set.
10564
10565‘-k FILE’
10566     True if FILE exists and has its “sticky” bit set.
10567
10568‘-r FILE’
10569     True if FILE exists and read permission is granted.
10570
10571‘-u FILE’
10572     True if FILE exists and has its set-user-ID bit set.
10573
10574‘-w FILE’
10575     True if FILE exists and write permission is granted.
10576
10577‘-x FILE’
10578     True if FILE exists and execute permission is granted (or search
10579     permission, if it is a directory).
10580
10581‘-O FILE’
10582     True if FILE exists and is owned by the current effective user ID.
10583
10584‘-G FILE’
10585     True if FILE exists and is owned by the current effective group ID.
10586
10587
10588File: coreutils.info,  Node: File characteristic tests,  Next: String tests,  Prev: Access permission tests,  Up: test invocation
10589
1059016.3.3 File characteristic tests
10591--------------------------------
10592
10593These options test other file characteristics.
10594
10595‘-e FILE’
10596     True if FILE exists.
10597
10598‘-s FILE’
10599     True if FILE exists and has a size greater than zero.
10600
10601‘FILE1 -nt FILE2’
10602     True if FILE1 is newer (according to modification date) than FILE2,
10603     or if FILE1 exists and FILE2 does not.
10604
10605‘FILE1 -ot FILE2’
10606     True if FILE1 is older (according to modification date) than FILE2,
10607     or if FILE2 exists and FILE1 does not.
10608
10609‘FILE1 -ef FILE2’
10610     True if FILE1 and FILE2 have the same device and inode numbers,
10611     i.e., if they are hard links to each other.
10612
10613‘-N FILE’
10614     True if FILE exists and has been modified (mtime) since it was last
10615     read (atime).
10616
10617
10618File: coreutils.info,  Node: String tests,  Next: Numeric tests,  Prev: File characteristic tests,  Up: test invocation
10619
1062016.3.4 String tests
10621-------------------
10622
10623These options test string characteristics.  You may need to quote STRING
10624arguments for the shell.  For example:
10625
10626     test -n "$V"
10627
10628   The quotes here prevent the wrong arguments from being passed to
10629‘test’ if ‘$V’ is empty or contains special characters.
10630
10631‘-z STRING’
10632     True if the length of STRING is zero.
10633
10634‘-n STRING’
10635‘STRING’
10636     True if the length of STRING is nonzero.
10637
10638‘STRING1 = STRING2’
10639     True if the strings are equal.
10640
10641‘STRING1 == STRING2’
10642     True if the strings are equal (synonym for =).
10643
10644‘STRING1 != STRING2’
10645     True if the strings are not equal.
10646
10647
10648File: coreutils.info,  Node: Numeric tests,  Next: Connectives for test,  Prev: String tests,  Up: test invocation
10649
1065016.3.5 Numeric tests
10651--------------------
10652
10653Numeric relational operators.  The arguments must be entirely numeric
10654(possibly negative), or the special expression ‘-l STRING’, which
10655evaluates to the length of STRING.
10656
10657‘ARG1 -eq ARG2’
10658‘ARG1 -ne ARG2’
10659‘ARG1 -lt ARG2’
10660‘ARG1 -le ARG2’
10661‘ARG1 -gt ARG2’
10662‘ARG1 -ge ARG2’
10663     These arithmetic binary operators return true if ARG1 is equal,
10664     not-equal, less-than, less-than-or-equal, greater-than, or
10665     greater-than-or-equal than ARG2, respectively.
10666
10667   For example:
10668
10669     test -1 -gt -2 && echo yes
10670     ⇒ yes
10671     test -l abc -gt 1 && echo yes
10672     ⇒ yes
10673     test 0x100 -eq 1
10674     error→ test: integer expression expected before -eq
10675
10676
10677File: coreutils.info,  Node: Connectives for test,  Prev: Numeric tests,  Up: test invocation
10678
1067916.3.6 Connectives for ‘test’
10680-----------------------------
10681
10682Note it’s preferred to use shell logical primitives rather than these
10683logical connectives internal to ‘test’, because an expression may become
10684ambiguous depending on the expansion of its parameters.
10685
10686   For example, this becomes ambiguous when ‘$1’ is set to ‘'!'’ and
10687‘$2’ to the empty string ‘''’:
10688
10689     test "$1" -a "$2"
10690
10691   and should be written as:
10692
10693     test "$1" && test "$2"
10694
10695   Note the shell logical primitives also benefit from short circuit
10696operation, which can be significant for file attribute tests.
10697
10698‘! EXPR’
10699     True if EXPR is false.  ‘!’ has lower precedence than all parts of
10700     EXPR.  Note ‘!’ needs to be specified to the left of a binary
10701     expression, I.e., ‘'!' 1 -gt 2’ rather than ‘1 '!' -gt 2’.  Also
10702     ‘!’ is often a shell special character and is best used quoted.
10703
10704‘EXPR1 -a EXPR2’
10705     True if both EXPR1 and EXPR2 are true.  ‘-a’ is left associative,
10706     and has a higher precedence than ‘-o’.
10707
10708‘EXPR1 -o EXPR2’
10709     True if either EXPR1 or EXPR2 is true.  ‘-o’ is left associative.
10710
10711
10712File: coreutils.info,  Node: expr invocation,  Prev: test invocation,  Up: Conditions
10713
1071416.4 ‘expr’: Evaluate expressions
10715=================================
10716
10717‘expr’ evaluates an expression and writes the result on standard output.
10718Each token of the expression must be a separate argument.
10719
10720   Operands are either integers or strings.  Integers consist of one or
10721more decimal digits, with an optional leading ‘-’.  ‘expr’ converts
10722anything appearing in an operand position to an integer or a string
10723depending on the operation being applied to it.
10724
10725   Strings are not quoted for ‘expr’ itself, though you may need to
10726quote them to protect characters with special meaning to the shell,
10727e.g., spaces.  However, regardless of whether it is quoted, a string
10728operand should not be a parenthesis or any of ‘expr’’s operators like
10729‘+’, so you cannot safely pass an arbitrary string ‘$str’ to expr merely
10730by quoting it to the shell.  One way to work around this is to use the
10731GNU extension ‘+’, (e.g., ‘+ "$str" = foo’); a more portable way is to
10732use ‘" $str"’ and to adjust the rest of the expression to take the
10733leading space into account (e.g., ‘" $str" = " foo"’).
10734
10735   You should not pass a negative integer or a string with leading ‘-’
10736as ‘expr’’s first argument, as it might be misinterpreted as an option;
10737this can be avoided by parenthesization.  Also, portable scripts should
10738not use a string operand that happens to take the form of an integer;
10739this can be worked around by inserting leading spaces as mentioned
10740above.
10741
10742   Operators may be given as infix symbols or prefix keywords.
10743Parentheses may be used for grouping in the usual manner.  You must
10744quote parentheses and many operators to avoid the shell evaluating them,
10745however.
10746
10747   When built with support for the GNU MP library, ‘expr’ uses
10748arbitrary-precision arithmetic; otherwise, it uses native arithmetic
10749types and may fail due to arithmetic overflow.
10750
10751   The only options are ‘--help’ and ‘--version’.  *Note Common
10752options::.  Options must precede operands.
10753
10754   Exit status:
10755
10756     0 if the expression is neither null nor 0,
10757     1 if the expression is null or 0,
10758     2 if the expression is invalid,
10759     3 if an internal error occurred (e.g., arithmetic overflow).
10760
10761* Menu:
10762
10763* String expressions::          + : match substr index length
10764* Numeric expressions::         + - * / %
10765* Relations for expr::          | & < <= = == != >= >
10766* Examples of expr::            Examples.
10767
10768
10769File: coreutils.info,  Node: String expressions,  Next: Numeric expressions,  Up: expr invocation
10770
1077116.4.1 String expressions
10772-------------------------
10773
10774‘expr’ supports pattern matching and other string operators.  These have
10775higher precedence than both the numeric and relational operators (in the
10776next sections).
10777
10778‘STRING : REGEX’
10779     Perform pattern matching.  The arguments are converted to strings
10780     and the second is considered to be a (basic, a la GNU ‘grep’)
10781     regular expression, with a ‘^’ implicitly prepended.  The first
10782     argument is then matched against this regular expression.
10783
10784     If the match succeeds and REGEX uses ‘\(’ and ‘\)’, the ‘:’
10785     expression returns the part of STRING that matched the
10786     subexpression; otherwise, it returns the number of characters
10787     matched.
10788
10789     If the match fails, the ‘:’ operator returns the null string if
10790     ‘\(’ and ‘\)’ are used in REGEX, otherwise 0.
10791
10792     Only the first ‘\( ... \)’ pair is relevant to the return value;
10793     additional pairs are meaningful only for grouping the regular
10794     expression operators.
10795
10796     In the regular expression, ‘\+’, ‘\?’, and ‘\|’ are operators which
10797     respectively match one or more, zero or one, or separate
10798     alternatives.  SunOS and other ‘expr’’s treat these as regular
10799     characters.  (POSIX allows either behavior.)  *Note Regular
10800     Expression Library: (regex)Top, for details of regular expression
10801     syntax.  Some examples are in *note Examples of expr::.
10802
10803‘match STRING REGEX’
10804     An alternative way to do pattern matching.  This is the same as
10805     ‘STRING : REGEX’.
10806
10807‘substr STRING POSITION LENGTH’
10808     Returns the substring of STRING beginning at POSITION with length
10809     at most LENGTH.  If either POSITION or LENGTH is negative, zero, or
10810     non-numeric, returns the null string.
10811
10812‘index STRING CHARSET’
10813     Returns the first position in STRING where the first character in
10814     CHARSET was found.  If no character in CHARSET is found in STRING,
10815     return 0.
10816
10817‘length STRING’
10818     Returns the length of STRING.
10819
10820‘+ TOKEN’
10821     Interpret TOKEN as a string, even if it is a keyword like MATCH or
10822     an operator like ‘/’.  This makes it possible to test ‘expr length
10823     + "$x"’ or ‘expr + "$x" : '.*/\(.\)'’ and have it do the right
10824     thing even if the value of $X happens to be (for example) ‘/’ or
10825     ‘index’.  This operator is a GNU extension.  Portable shell scripts
10826     should use ‘" $token" : ' \(.*\)'’ instead of ‘+ "$token"’.
10827
10828   To make ‘expr’ interpret keywords as strings, you must use the
10829‘quote’ operator.
10830
10831
10832File: coreutils.info,  Node: Numeric expressions,  Next: Relations for expr,  Prev: String expressions,  Up: expr invocation
10833
1083416.4.2 Numeric expressions
10835--------------------------
10836
10837‘expr’ supports the usual numeric operators, in order of increasing
10838precedence.  These numeric operators have lower precedence than the
10839string operators described in the previous section, and higher
10840precedence than the connectives (next section).
10841
10842‘+ -’
10843     Addition and subtraction.  Both arguments are converted to
10844     integers; an error occurs if this cannot be done.
10845
10846‘* / %’
10847     Multiplication, division, remainder.  Both arguments are converted
10848     to integers; an error occurs if this cannot be done.
10849
10850
10851File: coreutils.info,  Node: Relations for expr,  Next: Examples of expr,  Prev: Numeric expressions,  Up: expr invocation
10852
1085316.4.3 Relations for ‘expr’
10854---------------------------
10855
10856‘expr’ supports the usual logical connectives and relations.  These have
10857lower precedence than the string and numeric operators (previous
10858sections).  Here is the list, lowest-precedence operator first.
10859
10860‘|’
10861     Returns its first argument if that is neither null nor zero,
10862     otherwise its second argument if it is neither null nor zero,
10863     otherwise 0.  It does not evaluate its second argument if its first
10864     argument is neither null nor zero.
10865
10866‘&’
10867     Return its first argument if neither argument is null or zero,
10868     otherwise 0.  It does not evaluate its second argument if its first
10869     argument is null or zero.
10870
10871‘< <= = == != >= >’
10872     Compare the arguments and return 1 if the relation is true, 0
10873     otherwise.  ‘==’ is a synonym for ‘=’.  ‘expr’ first tries to
10874     convert both arguments to integers and do a numeric comparison; if
10875     either conversion fails, it does a lexicographic comparison using
10876     the character collating sequence specified by the ‘LC_COLLATE’
10877     locale.
10878
10879
10880File: coreutils.info,  Node: Examples of expr,  Prev: Relations for expr,  Up: expr invocation
10881
1088216.4.4 Examples of using ‘expr’
10883-------------------------------
10884
10885Here are a few examples, including quoting for shell metacharacters.
10886
10887   To add 1 to the shell variable ‘foo’, in Bourne-compatible shells:
10888
10889     foo=$(expr $foo + 1)
10890
10891   To print the non-directory part of the file name stored in ‘$fname’,
10892which need not contain a ‘/’:
10893
10894     expr $fname : '.*/\(.*\)' '|' $fname
10895
10896   An example showing that ‘\+’ is an operator:
10897
10898     expr aaa : 'a\+'
10899     ⇒ 3
10900
10901     expr abc : 'a\(.\)c'
10902     ⇒ b
10903     expr index abcdef cz
10904     ⇒ 3
10905     expr index index a
10906     error→ expr: syntax error
10907     expr index + index a
10908     ⇒ 0
10909
10910
10911File: coreutils.info,  Node: Redirection,  Next: File name manipulation,  Prev: Conditions,  Up: Top
10912
1091317 Redirection
10914**************
10915
10916Unix shells commonly provide several forms of “redirection”—ways to
10917change the input source or output destination of a command.  But one
10918useful redirection is performed by a separate command, not by the shell;
10919it’s described here.
10920
10921* Menu:
10922
10923* tee invocation::              Redirect output to multiple files or processes.
10924
10925
10926File: coreutils.info,  Node: tee invocation,  Up: Redirection
10927
1092817.1 ‘tee’: Redirect output to multiple files or processes
10929==========================================================
10930
10931The ‘tee’ command copies standard input to standard output and also to
10932any files given as arguments.  This is useful when you want not only to
10933send some data down a pipe, but also to save a copy.  Synopsis:
10934
10935     tee [OPTION]... [FILE]...
10936
10937   If a file being written to does not already exist, it is created.  If
10938a file being written to already exists, the data it previously contained
10939is overwritten unless the ‘-a’ option is used.
10940
10941   In previous versions of GNU coreutils (v5.3.0 - v8.23), a FILE of ‘-’
10942caused ‘tee’ to send another copy of input to standard output.  However,
10943as the interleaved output was not very useful, ‘tee’ now conforms to
10944POSIX which explicitly mandates it to treat ‘-’ as a file with such
10945name.
10946
10947   The program accepts the following options.  Also see *note Common
10948options::.
10949
10950‘-a’
10951‘--append’
10952     Append standard input to the given files rather than overwriting
10953     them.
10954
10955‘-i’
10956‘--ignore-interrupts’
10957     Ignore interrupt signals.
10958
10959‘-p’
10960‘--output-error[=MODE]’
10961     Adjust the behavior with errors on the outputs, with the long form
10962     option supporting selection between the following MODEs:
10963
10964     ‘warn’
10965          Warn on error opening or writing any output, including pipes.
10966          Writing is continued to still open files/pipes.  Exit status
10967          indicates failure if any output has an error.
10968
10969     ‘warn-nopipe’
10970          This is the default MODE when not specified, or when the short
10971          form ‘-p’ is used.  Warn on error opening or writing any
10972          output, except pipes.  Writing is continued to still open
10973          files/pipes.  Exit status indicates failure if any non pipe
10974          output had an error.
10975
10976     ‘exit’
10977          Exit on error opening or writing any output, including pipes.
10978
10979     ‘exit-nopipe’
10980          Exit on error opening or writing any output, except pipes.
10981
10982   The ‘tee’ command is useful when you happen to be transferring a
10983large amount of data and also want to summarize that data without
10984reading it a second time.  For example, when you are downloading a DVD
10985image, you often want to verify its signature or checksum right away.
10986The inefficient way to do it is simply:
10987
10988     wget https://example.com/some.iso && sha1sum some.iso
10989
10990   One problem with the above is that it makes you wait for the download
10991to complete before starting the time-consuming SHA1 computation.
10992Perhaps even more importantly, the above requires reading the DVD image
10993a second time (the first was from the network).
10994
10995   The efficient way to do it is to interleave the download and SHA1
10996computation.  Then, you’ll get the checksum for free, because the entire
10997process parallelizes so well:
10998
10999     # slightly contrived, to demonstrate process substitution
11000     wget -O - https://example.com/dvd.iso \
11001       | tee >(sha1sum > dvd.sha1) > dvd.iso
11002
11003   That makes ‘tee’ write not just to the expected output file, but also
11004to a pipe running ‘sha1sum’ and saving the final checksum in a file
11005named ‘dvd.sha1’.
11006
11007   Note, however, that this example relies on a feature of modern shells
11008called “process substitution” (the ‘>(command)’ syntax, above; *Note
11009Process Substitution: (bash)Process Substitution.), so it works with
11010‘zsh’, ‘bash’, and ‘ksh’, but not with ‘/bin/sh’.  So if you write code
11011like this in a shell script, be sure to start the script with
11012‘#!/bin/bash’.
11013
11014   Note also that if any of the process substitutions (or piped stdout)
11015might exit early without consuming all the data, the ‘-p’ option is
11016needed to allow ‘tee’ to continue to process the input to any remaining
11017outputs.
11018
11019   Since the above example writes to one file and one process, a more
11020conventional and portable use of ‘tee’ is even better:
11021
11022     wget -O - https://example.com/dvd.iso \
11023       | tee dvd.iso | sha1sum > dvd.sha1
11024
11025   You can extend this example to make ‘tee’ write to two processes,
11026computing MD5 and SHA1 checksums in parallel.  In this case, process
11027substitution is required:
11028
11029     wget -O - https://example.com/dvd.iso \
11030       | tee >(sha1sum > dvd.sha1) \
11031             >(md5sum > dvd.md5) \
11032       > dvd.iso
11033
11034   This technique is also useful when you want to make a _compressed_
11035copy of the contents of a pipe.  Consider a tool to graphically
11036summarize disk usage data from ‘du -ak’.  For a large hierarchy, ‘du
11037-ak’ can run for a long time, and can easily produce terabytes of data,
11038so you won’t want to rerun the command unnecessarily.  Nor will you want
11039to save the uncompressed output.
11040
11041   Doing it the inefficient way, you can’t even start the GUI until
11042after you’ve compressed all of the ‘du’ output:
11043
11044     du -ak | gzip -9 > /tmp/du.gz
11045     gzip -d /tmp/du.gz | xdiskusage -a
11046
11047   With ‘tee’ and process substitution, you start the GUI right away and
11048eliminate the decompression completely:
11049
11050     du -ak | tee >(gzip -9 > /tmp/du.gz) | xdiskusage -a
11051
11052   Finally, if you regularly create more than one type of compressed
11053tarball at once, for example when ‘make dist’ creates both
11054‘gzip’-compressed and ‘bzip2’-compressed tarballs, there may be a better
11055way.  Typical ‘automake’-generated ‘Makefile’ rules create the two
11056compressed tar archives with commands in sequence, like this (slightly
11057simplified):
11058
11059     tardir=your-pkg-M.N
11060     tar chof - "$tardir" | gzip  -9 -c > your-pkg-M.N.tar.gz
11061     tar chof - "$tardir" | bzip2 -9 -c > your-pkg-M.N.tar.bz2
11062
11063   However, if the hierarchy you are archiving and compressing is larger
11064than a couple megabytes, and especially if you are using a
11065multi-processor system with plenty of memory, then you can do much
11066better by reading the directory contents only once and running the
11067compression programs in parallel:
11068
11069     tardir=your-pkg-M.N
11070     tar chof - "$tardir" \
11071       | tee >(gzip -9 -c > your-pkg-M.N.tar.gz) \
11072       | bzip2 -9 -c > your-pkg-M.N.tar.bz2
11073
11074   If you want to further process the output from process substitutions,
11075and those processes write atomically (i.e., write less than the system’s
11076PIPE_BUF size at a time), that’s possible with a construct like:
11077
11078     tardir=your-pkg-M.N
11079     tar chof - "$tardir" \
11080       | tee >(md5sum --tag) > >(sha256sum --tag) \
11081       | sort | gpg --clearsign > your-pkg-M.N.tar.sig
11082
11083   An exit status of zero indicates success, and a nonzero value
11084indicates failure.
11085
11086
11087File: coreutils.info,  Node: File name manipulation,  Next: Working context,  Prev: Redirection,  Up: Top
11088
1108918 File name manipulation
11090*************************
11091
11092This section describes commands that manipulate file names.
11093
11094* Menu:
11095
11096* basename invocation::         Strip directory and suffix from a file name.
11097* dirname invocation::          Strip last file name component.
11098* pathchk invocation::          Check file name validity and portability.
11099* mktemp invocation::           Create temporary file or directory.
11100* realpath invocation::         Print resolved file names.
11101
11102
11103File: coreutils.info,  Node: basename invocation,  Next: dirname invocation,  Up: File name manipulation
11104
1110518.1 ‘basename’: Strip directory and suffix from a file name
11106============================================================
11107
11108‘basename’ removes any leading directory components from NAME.
11109Synopsis:
11110
11111     basename NAME [SUFFIX]
11112     basename OPTION... NAME...
11113
11114   If SUFFIX is specified and is identical to the end of NAME, it is
11115removed from NAME as well.  Note that since trailing slashes are removed
11116prior to suffix matching, SUFFIX will do nothing if it contains slashes.
11117‘basename’ prints the result on standard output.
11118
11119   Together, ‘basename’ and ‘dirname’ are designed such that if ‘ls
11120"$name"’ succeeds, then the command sequence ‘cd "$(dirname "$name")";
11121ls "$(basename "$name")"’ will, too.  This works for everything except
11122file names containing a trailing newline.
11123
11124   POSIX allows the implementation to define the results if NAME is
11125empty or ‘//’.  In the former case, GNU ‘basename’ returns the empty
11126string.  In the latter case, the result is ‘//’ on platforms where // is
11127distinct from /, and ‘/’ on platforms where there is no difference.
11128
11129   The program accepts the following options.  Also see *note Common
11130options::.  Options must precede operands.
11131
11132‘-a’
11133‘--multiple’
11134     Support more than one argument.  Treat every argument as a NAME.
11135     With this, an optional SUFFIX must be specified using the ‘-s’
11136     option.
11137
11138‘-s SUFFIX’
11139‘--suffix=SUFFIX’
11140     Remove a trailing SUFFIX.  This option implies the ‘-a’ option.
11141
11142‘-z’
11143‘--zero’
11144     Output a zero byte (ASCII NUL) at the end of each line, rather than
11145     a newline.  This option enables other programs to parse the output
11146     even when that output would contain data with embedded newlines.
11147
11148   An exit status of zero indicates success, and a nonzero value
11149indicates failure.
11150
11151   Examples:
11152
11153     # Output "sort".
11154     basename /usr/bin/sort
11155
11156     # Output "stdio".
11157     basename include/stdio.h .h
11158
11159     # Output "stdio".
11160     basename -s .h include/stdio.h
11161
11162     # Output "stdio" followed by "stdlib"
11163     basename -a -s .h include/stdio.h include/stdlib.h
11164
11165
11166File: coreutils.info,  Node: dirname invocation,  Next: pathchk invocation,  Prev: basename invocation,  Up: File name manipulation
11167
1116818.2 ‘dirname’: Strip last file name component
11169==============================================
11170
11171‘dirname’ prints all but the final slash-delimited component of each
11172NAME.  Slashes on either side of the final component are also removed.
11173If the string contains no slash, ‘dirname’ prints ‘.’ (meaning the
11174current directory).  Synopsis:
11175
11176     dirname [OPTION] NAME...
11177
11178   NAME need not be a file name, but if it is, this operation
11179effectively lists the directory that contains the final component,
11180including the case when the final component is itself a directory.
11181
11182   Together, ‘basename’ and ‘dirname’ are designed such that if ‘ls
11183"$name"’ succeeds, then the command sequence ‘cd "$(dirname "$name")";
11184ls "$(basename "$name")"’ will, too.  This works for everything except
11185file names containing a trailing newline.
11186
11187   POSIX allows the implementation to define the results if NAME is
11188‘//’.  With GNU ‘dirname’, the result is ‘//’ on platforms where // is
11189distinct from /, and ‘/’ on platforms where there is no difference.
11190
11191   The program accepts the following option.  Also see *note Common
11192options::.
11193
11194‘-z’
11195‘--zero’
11196     Output a zero byte (ASCII NUL) at the end of each line, rather than
11197     a newline.  This option enables other programs to parse the output
11198     even when that output would contain data with embedded newlines.
11199
11200   An exit status of zero indicates success, and a nonzero value
11201indicates failure.
11202
11203   Examples:
11204
11205     # Output "/usr/bin".
11206     dirname /usr/bin/sort
11207     dirname /usr/bin//.//
11208
11209     # Output "dir1" followed by "dir2"
11210     dirname dir1/str dir2/str
11211
11212     # Output ".".
11213     dirname stdio.h
11214
11215
11216File: coreutils.info,  Node: pathchk invocation,  Next: mktemp invocation,  Prev: dirname invocation,  Up: File name manipulation
11217
1121818.3 ‘pathchk’: Check file name validity and portability
11219========================================================
11220
11221‘pathchk’ checks validity and portability of file names.  Synopsis:
11222
11223     pathchk [OPTION]... NAME...
11224
11225   For each NAME, ‘pathchk’ prints an error message if any of these
11226conditions is true:
11227
11228  1. One of the existing directories in NAME does not have search
11229     (execute) permission,
11230  2. The length of NAME is larger than the maximum supported by the
11231     operating system.
11232  3. The length of one component of NAME is longer than its file
11233     system’s maximum.
11234
11235   A nonexistent NAME is not an error, so long a file with that name
11236could be created under the above conditions.
11237
11238   The program accepts the following options.  Also see *note Common
11239options::.  Options must precede operands.
11240
11241‘-p’
11242     Instead of performing checks based on the underlying file system,
11243     print an error message if any of these conditions is true:
11244
11245       1. A file name is empty.
11246
11247       2. A file name contains a character outside the POSIX portable
11248          file name character set, namely, the ASCII letters and digits,
11249          ‘.’, ‘_’, ‘-’, and ‘/’.
11250
11251       3. The length of a file name or one of its components exceeds the
11252          POSIX minimum limits for portability.
11253
11254‘-P’
11255     Print an error message if a file name is empty, or if it contains a
11256     component that begins with ‘-’.
11257
11258‘--portability’
11259     Print an error message if a file name is not portable to all POSIX
11260     hosts.  This option is equivalent to ‘-p -P’.
11261
11262   Exit status:
11263
11264     0 if all specified file names passed all checks,
11265     1 otherwise.
11266
11267
11268File: coreutils.info,  Node: mktemp invocation,  Next: realpath invocation,  Prev: pathchk invocation,  Up: File name manipulation
11269
1127018.4 ‘mktemp’: Create temporary file or directory
11271=================================================
11272
11273‘mktemp’ manages the creation of temporary files and directories.
11274Synopsis:
11275
11276     mktemp [OPTION]... [TEMPLATE]
11277
11278   Safely create a temporary file or directory based on TEMPLATE, and
11279print its name.  If given, TEMPLATE must include at least three
11280consecutive ‘X’s in the last component.  If omitted, the template
11281tmp.XXXXXXXXXX’ is used, and option ‘--tmpdir’ is implied.  The final
11282run of ‘X’s in the TEMPLATE will be replaced by alpha-numeric
11283characters; thus, on a case-sensitive file system, and with a TEMPLATE
11284including a run of N instances of ‘X’, there are ‘62**N’ potential file
11285names.
11286
11287   Older scripts used to create temporary files by simply joining the
11288name of the program with the process id (‘$$’) as a suffix.  However,
11289that naming scheme is easily predictable, and suffers from a race
11290condition where the attacker can create an appropriately named symbolic
11291link, such that when the script then opens a handle to what it thought
11292was an unused file, it is instead modifying an existing file.  Using the
11293same scheme to create a directory is slightly safer, since the ‘mkdir’
11294will fail if the target already exists, but it is still inferior because
11295it allows for denial of service attacks.  Therefore, modern scripts
11296should use the ‘mktemp’ command to guarantee that the generated name
11297will be unpredictable, and that knowledge of the temporary file name
11298implies that the file was created by the current script and cannot be
11299modified by other users.
11300
11301   When creating a file, the resulting file has read and write
11302permissions for the current user, but no permissions for the group or
11303others; these permissions are reduced if the current umask is more
11304restrictive.
11305
11306   Here are some examples (although note that if you repeat them, you
11307will most likely get different file names):
11308
11309   • Create a temporary file in the current directory.
11310          $ mktemp file.XXXX
11311          file.H47c
11312
11313   • Create a temporary file with a known suffix.
11314          $ mktemp --suffix=.txt file-XXXX
11315          file-H08W.txt
11316          $ mktemp file-XXXX-XXXX.txt
11317          file-XXXX-eI9L.txt
11318
11319   • Create a secure fifo relative to the user’s choice of ‘TMPDIR’, but
11320     falling back to the current directory rather than ‘/tmp’.  Note
11321     that ‘mktemp’ does not create fifos, but can create a secure
11322     directory in which the fifo can live.  Exit the shell if the
11323     directory or fifo could not be created.
11324          $ dir=$(mktemp -p "${TMPDIR:-.}" -d dir-XXXX) || exit 1
11325          $ fifo=$dir/fifo
11326          $ mkfifo "$fifo" || { rmdir "$dir"; exit 1; }
11327
11328   • Create and use a temporary file if possible, but ignore failure.
11329     The file will reside in the directory named by ‘TMPDIR’, if
11330     specified, or else in ‘/tmp’.
11331          $ file=$(mktemp -q) && {
11332          >   # Safe to use $file only within this block.  Use quotes,
11333          >   # since $TMPDIR, and thus $file, may contain whitespace.
11334          >   echo ... > "$file"
11335          >   rm "$file"
11336          > }
11337
11338   • Act as a semi-random character generator (it is not fully random,
11339     since it is impacted by the contents of the current directory).  To
11340     avoid security holes, do not use the resulting names to create a
11341     file.
11342          $ mktemp -u XXX
11343          Gb9
11344          $ mktemp -u XXX
11345          nzC
11346
11347   The program accepts the following options.  Also see *note Common
11348options::.
11349
11350‘-d’
11351‘--directory’
11352     Create a directory rather than a file.  The directory will have
11353     read, write, and search permissions for the current user, but no
11354     permissions for the group or others; these permissions are reduced
11355     if the current umask is more restrictive.
11356
11357‘-q’
11358‘--quiet’
11359     Suppress diagnostics about failure to create a file or directory.
11360     The exit status will still reflect whether a file was created.
11361
11362‘-u’
11363‘--dry-run’
11364     Generate a temporary name that does not name an existing file,
11365     without changing the file system contents.  Using the output of
11366     this command to create a new file is inherently unsafe, as there is
11367     a window of time between generating the name and using it where
11368     another process can create an object by the same name.
11369
11370‘-p DIR’
11371‘--tmpdir[=DIR]’
11372     Treat TEMPLATE relative to the directory DIR.  If DIR is not
11373     specified (only possible with the long option ‘--tmpdir’) or is the
11374     empty string, use the value of ‘TMPDIR’ if available, otherwise use
11375     ‘/tmp’.  If this is specified, TEMPLATE must not be absolute.
11376     However, TEMPLATE can still contain slashes, although intermediate
11377     directories must already exist.
11378
11379‘--suffix=SUFFIX’
11380     Append SUFFIX to the TEMPLATE.  SUFFIX must not contain slash.  If
11381     ‘--suffix’ is specified, TEMPLATE must end in ‘X’; if it is not
11382     specified, then an appropriate ‘--suffix’ is inferred by finding
11383     the last ‘X’ in TEMPLATE.  This option exists for use with the
11384     default TEMPLATE and for the creation of a SUFFIX that starts with
11385     ‘X’.
11386
11387‘-t’
11388     Treat TEMPLATE as a single file relative to the value of ‘TMPDIR’
11389     if available, or to the directory specified by ‘-p’, otherwise to
11390     ‘/tmp’.  TEMPLATE must not contain slashes.  This option is
11391     deprecated; the use of ‘-p’ without ‘-t’ offers better defaults (by
11392     favoring the command line over ‘TMPDIR’) and more flexibility (by
11393     allowing intermediate directories).
11394
11395   Exit status:
11396
11397     0 if the file was created,
11398     1 otherwise.
11399
11400
11401File: coreutils.info,  Node: realpath invocation,  Prev: mktemp invocation,  Up: File name manipulation
11402
1140318.5 ‘realpath’: Print the resolved file name.
11404==============================================
11405
11406‘realpath’ expands all symbolic links and resolves references to ‘/./’,
11407‘/../’ and extra ‘/’ characters.  By default, all but the last component
11408of the specified files must exist.  Synopsis:
11409
11410     realpath [OPTION]... FILE...
11411
11412   The file name canonicalization functionality overlaps with that of
11413the ‘readlink’ command.  This is the preferred command for
11414canonicalization as it’s a more suitable and standard name.  In addition
11415this command supports relative file name processing functionality.
11416
11417   The program accepts the following options.  Also see *note Common
11418options::.
11419
11420‘-e’
11421‘--canonicalize-existing’
11422     Ensure that all components of the specified file names exist.  If
11423     any component is missing or unavailable, ‘realpath’ will output a
11424     diagnostic unless the ‘-q’ option is specified, and exit with a
11425     nonzero exit code.  A trailing slash requires that the name resolve
11426     to a directory.
11427
11428‘-m’
11429‘--canonicalize-missing’
11430     If any component of a specified file name is missing or
11431     unavailable, treat it as a directory.
11432
11433‘-L’
11434‘--logical’
11435     Symbolic links are resolved in the specified file names, but they
11436     are resolved after any subsequent ‘..’ components are processed.
11437
11438‘-P’
11439‘--physical’
11440     Symbolic links are resolved in the specified file names, and they
11441     are resolved before any subsequent ‘..’ components are processed.
11442     This is the default mode of operation.
11443
11444‘-q’
11445‘--quiet’
11446     Suppress diagnostic messages for specified file names.
11447
11448‘--relative-to=DIR’
11449     Print the resolved file names relative to the specified directory.
11450     Note this option honors the ‘-m’ and ‘-e’ options pertaining to
11451     file existence.
11452
11453‘--relative-base=DIR’
11454     Print the resolved file names as relative _if_ the files are
11455     descendants of DIR.  Otherwise, print the resolved file names as
11456     absolute.  Note this option honors the ‘-m’ and ‘-e’ options
11457     pertaining to file existence.  For details about combining
11458     ‘--relative-to’ and ‘--relative-base’, *note Realpath usage
11459     examples::.
11460
11461‘-s’
11462‘--strip’
11463‘--no-symlinks’
11464     Do not resolve symbolic links.  Only resolve references to ‘/./’,
11465     ‘/../’ and remove extra ‘/’ characters.  When combined with the
11466     ‘-m’ option, realpath operates only on the file name, and does not
11467     touch any actual file.
11468
11469‘-z’
11470‘--zero’
11471     Output a zero byte (ASCII NUL) at the end of each line, rather than
11472     a newline.  This option enables other programs to parse the output
11473     even when that output would contain data with embedded newlines.
11474
11475   Exit status:
11476
11477     0 if all file names were printed without issue.
11478     1 otherwise.
11479
11480* Menu:
11481
11482* Realpath usage examples::              Realpath usage examples.
11483
11484
11485File: coreutils.info,  Node: Realpath usage examples,  Up: realpath invocation
11486
1148718.5.1 Realpath usage examples
11488------------------------------
11489
11490By default, ‘realpath’ prints the absolute file name of given files
11491(symlinks are resolved, ‘words’ is resolved to ‘american-english’):
11492
11493     cd /home/user
11494     realpath /usr/bin/sort /tmp/foo /usr/share/dict/words 1.txt
11495/usr/bin/sort
11496/tmp/foo
11497/usr/share/dict/american-english
11498/home/user/1.txt
11499
11500   With ‘--relative-to’, file names are printed relative to the given
11501directory:
11502
11503     realpath --relative-to=/usr/bin \
11504              /usr/bin/sort /tmp/foo /usr/share/dict/words 1.txt
11505     ⇒ sort
11506     ⇒ ../../tmp/foo
11507     ⇒ ../share/dict/american-english
11508     ⇒ ../../home/user/1.txt
11509
11510   With ‘--relative-base’, relative file names are printed _if_ the
11511resolved file name is below the given base directory.  For files outside
11512the base directory absolute file names are printed:
11513
11514     realpath --relative-base=/usr \
11515              /usr/bin/sort /tmp/foo /usr/share/dict/words 1.txt
11516bin/sort
11517/tmp/foo
11518share/dict/american-english
11519/home/user/1.txt
11520
11521   When both ‘--relative-to=DIR1’ and ‘--relative-base=DIR2’ are used,
11522file names are printed relative to DIR1 _if_ they are located below
11523DIR2.  If the files are not below DIR2, they are printed as absolute
11524file names:
11525
11526     realpath --relative-to=/usr/bin --relative-base=/usr \
11527              /usr/bin/sort /tmp/foo /usr/share/dict/words 1.txt
11528     ⇒ sort
11529/tmp/foo
11530     ⇒ ../share/dict/american-english
11531/home/user/1.txt
11532
11533   When both ‘--relative-to=DIR1’ and ‘--relative-base=DIR2’ are used,
11534DIR1 _must_ be a subdirectory of DIR2.  Otherwise, ‘realpath’ prints
11535absolutes file names.
11536
11537
11538File: coreutils.info,  Node: Working context,  Next: User information,  Prev: File name manipulation,  Up: Top
11539
1154019 Working context
11541******************
11542
11543This section describes commands that display or alter the context in
11544which you are working: the current directory, the terminal settings, and
11545so forth.  See also the user-related commands in the next section.
11546
11547* Menu:
11548
11549* pwd invocation::              Print working directory.
11550* stty invocation::             Print or change terminal characteristics.
11551* printenv invocation::         Print environment variables.
11552* tty invocation::              Print file name of terminal on standard input.
11553
11554
11555File: coreutils.info,  Node: pwd invocation,  Next: stty invocation,  Up: Working context
11556
1155719.1 ‘pwd’: Print working directory
11558===================================
11559
11560‘pwd’ prints the name of the current directory.  Synopsis:
11561
11562     pwd [OPTION]...
11563
11564   The program accepts the following options.  Also see *note Common
11565options::.
11566
11567‘-L’
11568‘--logical’
11569     If the contents of the environment variable ‘PWD’ provide an
11570     absolute name of the current directory with no ‘.’ or ‘..’
11571     components, but possibly with symbolic links, then output those
11572     contents.  Otherwise, fall back to default ‘-P’ handling.
11573
11574‘-P’
11575‘--physical’
11576     Print a fully resolved name for the current directory.  That is,
11577     all components of the printed name will be actual directory
11578     names—none will be symbolic links.
11579
11580   If ‘-L’ and ‘-P’ are both given, the last one takes precedence.  If
11581neither option is given, then this implementation uses ‘-P’ as the
11582default unless the ‘POSIXLY_CORRECT’ environment variable is set.
11583
11584   Due to shell aliases and built-in ‘pwd’ functions, using an unadorned
11585‘pwd’ interactively or in a script may get you different functionality
11586than that described here.  Invoke it via ‘env’ (i.e., ‘env pwd ...’) to
11587avoid interference from the shell.
11588
11589   An exit status of zero indicates success, and a nonzero value
11590indicates failure.
11591
11592
11593File: coreutils.info,  Node: stty invocation,  Next: printenv invocation,  Prev: pwd invocation,  Up: Working context
11594
1159519.2 ‘stty’: Print or change terminal characteristics
11596=====================================================
11597
11598‘stty’ prints or changes terminal characteristics, such as baud rate.
11599Synopses:
11600
11601     stty [OPTION] [SETTING]...
11602     stty [OPTION]
11603
11604   If given no line settings, ‘stty’ prints the baud rate, line
11605discipline number (on systems that support it), and line settings that
11606have been changed from the values set by ‘stty sane’.  By default, mode
11607reading and setting are performed on the tty line connected to standard
11608input, although this can be modified by the ‘--file’ option.
11609
11610   ‘stty’ accepts many non-option arguments that change aspects of the
11611terminal line operation, as described below.
11612
11613   The program accepts the following options.  Also see *note Common
11614options::.
11615
11616‘-a’
11617‘--all’
11618     Print all current settings in human-readable form.  This option may
11619     not be used in combination with any line settings.
11620
11621‘-F DEVICE’
11622‘--file=DEVICE’
11623     Set the line opened by the file name specified in DEVICE instead of
11624     the tty line connected to standard input.  This option is necessary
11625     because opening a POSIX tty requires use of the ‘O_NONDELAY’ flag
11626     to prevent a POSIX tty from blocking until the carrier detect line
11627     is high if the ‘clocal’ flag is not set.  Hence, it is not always
11628     possible to allow the shell to open the device in the traditional
11629     manner.
11630
11631‘-g’
11632‘--save’
11633     Print all current settings in a form that can be used as an
11634     argument to another ‘stty’ command to restore the current settings.
11635     This option may not be used in combination with any line settings.
11636
11637   Many settings can be turned off by preceding them with a ‘-’.  Such
11638arguments are marked below with “May be negated” in their description.
11639The descriptions themselves refer to the positive case, that is, when
11640_not_ negated (unless stated otherwise, of course).
11641
11642   Some settings are not available on all POSIX systems, since they use
11643extensions.  Such arguments are marked below with “Non-POSIX” in their
11644description.  On non-POSIX systems, those or other settings also may not
11645be available, but it’s not feasible to document all the variations: just
11646try it and see.
11647
11648   ‘stty’ is installed only on platforms with the POSIX terminal
11649interface, so portable scripts should not rely on its existence on
11650non-POSIX platforms.
11651
11652   An exit status of zero indicates success, and a nonzero value
11653indicates failure.
11654
11655* Menu:
11656
11657* Control::                     Control settings
11658* Input::                       Input settings
11659* Output::                      Output settings
11660* Local::                       Local settings
11661* Combination::                 Combination settings
11662* Characters::                  Special characters
11663* Special::                     Special settings
11664
11665
11666File: coreutils.info,  Node: Control,  Next: Input,  Up: stty invocation
11667
1166819.2.1 Control settings
11669-----------------------
11670
11671Control settings:
11672
11673‘parenb’
11674     Generate parity bit in output and expect parity bit in input.  May
11675     be negated.
11676
11677‘parodd’
11678     Set odd parity (even if negated).  May be negated.
11679
11680‘cmspar’
11681     Use "stick" (mark/space) parity.  If parodd is set, the parity bit
11682     is always 1; if parodd is not set, the parity bit is always zero.
11683     Non-POSIX.  May be negated.
11684
11685‘cs5’
11686‘cs6’
11687‘cs7’
11688‘cs8’
11689     Set character size to 5, 6, 7, or 8 bits.
11690
11691‘hup’
11692‘hupcl’
11693     Send a hangup signal when the last process closes the tty.  May be
11694     negated.
11695
11696‘cstopb’
11697     Use two stop bits per character (one if negated).  May be negated.
11698
11699‘cread’
11700     Allow input to be received.  May be negated.
11701
11702‘clocal’
11703     Disable modem control signals.  May be negated.
11704
11705‘crtscts’
11706     Enable RTS/CTS flow control.  Non-POSIX.  May be negated.
11707
11708‘cdtrdsr’
11709     Enable DTR/DSR flow control.  Non-POSIX.  May be negated.
11710
11711
11712File: coreutils.info,  Node: Input,  Next: Output,  Prev: Control,  Up: stty invocation
11713
1171419.2.2 Input settings
11715---------------------
11716
11717These settings control operations on data received from the terminal.
11718
11719‘ignbrk’
11720     Ignore break characters.  May be negated.
11721
11722‘brkint’
11723     Make breaks cause an interrupt signal.  May be negated.
11724
11725‘ignpar’
11726     Ignore characters with parity errors.  May be negated.
11727
11728‘parmrk’
11729     Mark parity errors (with a 255-0-character sequence).  May be
11730     negated.
11731
11732‘inpck’
11733     Enable input parity checking.  May be negated.
11734
11735‘istrip’
11736     Clear high (8th) bit of input characters.  May be negated.
11737
11738‘inlcr’
11739     Translate newline to carriage return.  May be negated.
11740
11741‘igncr’
11742     Ignore carriage return.  May be negated.
11743
11744‘icrnl’
11745     Translate carriage return to newline.  May be negated.
11746
11747‘iutf8’
11748     Assume input characters are UTF-8 encoded.  May be negated.
11749
11750‘ixon’
11751     Enable XON/XOFF flow control (that is, ‘Ctrl-S’/‘Ctrl-Q’).  May be
11752     negated.
11753
11754‘ixoff’
11755‘tandem’
11756     Enable sending of ‘stop’ character when the system input buffer is
11757     almost full, and ‘start’ character when it becomes almost empty
11758     again.  May be negated.
11759
11760‘iuclc’
11761     Translate uppercase characters to lowercase.  Non-POSIX.  May be
11762     negated.  Note ilcuc is not implemented, as one would not be able
11763     to issue almost any (lowercase) Unix command, after invoking it.
11764
11765‘ixany’
11766     Allow any character to restart output (only the start character if
11767     negated).  Non-POSIX.  May be negated.
11768
11769‘imaxbel’
11770     Enable beeping and not flushing input buffer if a character arrives
11771     when the input buffer is full.  Non-POSIX.  May be negated.
11772
11773
11774File: coreutils.info,  Node: Output,  Next: Local,  Prev: Input,  Up: stty invocation
11775
1177619.2.3 Output settings
11777----------------------
11778
11779These settings control operations on data sent to the terminal.
11780
11781‘opost’
11782     Postprocess output.  May be negated.
11783
11784‘olcuc’
11785     Translate lowercase characters to uppercase.  Non-POSIX.  May be
11786     negated.  (Note ouclc is not currently implemented.)
11787
11788‘ocrnl’
11789     Translate carriage return to newline.  Non-POSIX.  May be negated.
11790
11791‘onlcr’
11792     Translate newline to carriage return-newline.  Non-POSIX.  May be
11793     negated.
11794
11795‘onocr’
11796     Do not print carriage returns in the first column.  Non-POSIX.  May
11797     be negated.
11798
11799‘onlret’
11800     Newline performs a carriage return.  Non-POSIX.  May be negated.
11801
11802‘ofill’
11803     Use fill (padding) characters instead of timing for delays.
11804     Non-POSIX.  May be negated.
11805
11806‘ofdel’
11807     Use ASCII DEL characters for fill instead of ASCII NUL characters.
11808     Non-POSIX.  May be negated.
11809
11810‘nl1’
11811‘nl0’
11812     Newline delay style.  Non-POSIX.
11813
11814‘cr3’
11815‘cr2’
11816‘cr1’
11817‘cr0’
11818     Carriage return delay style.  Non-POSIX.
11819
11820‘tab3’
11821‘tab2’
11822‘tab1’
11823‘tab0’
11824     Horizontal tab delay style.  Non-POSIX.
11825
11826‘bs1’
11827‘bs0’
11828     Backspace delay style.  Non-POSIX.
11829
11830‘vt1’
11831‘vt0’
11832     Vertical tab delay style.  Non-POSIX.
11833
11834‘ff1’
11835‘ff0’
11836     Form feed delay style.  Non-POSIX.
11837
11838
11839File: coreutils.info,  Node: Local,  Next: Combination,  Prev: Output,  Up: stty invocation
11840
1184119.2.4 Local settings
11842---------------------
11843
11844‘isig’
11845     Enable ‘interrupt’, ‘quit’, and ‘suspend’ special characters.  May
11846     be negated.
11847
11848‘icanon’
11849     Enable ‘erase’, ‘kill’, ‘werase’, and ‘rprnt’ special characters.
11850     May be negated.
11851
11852‘iexten’
11853     Enable non-POSIX special characters.  May be negated.
11854
11855‘echo’
11856     Echo input characters.  May be negated.
11857
11858‘echoe’
11859‘crterase’
11860     Echo ‘erase’ characters as backspace-space-backspace.  May be
11861     negated.
11862
11863‘echok’
11864     Echo a newline after a ‘kill’ character.  May be negated.
11865
11866‘echonl’
11867     Echo newline even if not echoing other characters.  May be negated.
11868
11869‘noflsh’
11870     Disable flushing after ‘interrupt’ and ‘quit’ special characters.
11871     May be negated.
11872
11873‘xcase’
11874     Enable input and output of uppercase characters by preceding their
11875     lowercase equivalents with ‘\’, when ‘icanon’ is set.  Non-POSIX.
11876     May be negated.
11877
11878‘tostop’
11879     Stop background jobs that try to write to the terminal.  Non-POSIX.
11880     May be negated.
11881
11882‘echoprt’
11883‘prterase’
11884     Echo erased characters backward, between ‘\’ and ‘/’.  Non-POSIX.
11885     May be negated.
11886
11887‘echoctl’
11888‘ctlecho’
11889     Echo control characters in hat notation (‘^C’) instead of
11890     literally.  Non-POSIX.  May be negated.
11891
11892‘echoke’
11893‘crtkill’
11894     Echo the ‘kill’ special character by erasing each character on the
11895     line as indicated by the ‘echoprt’ and ‘echoe’ settings, instead of
11896     by the ‘echoctl’ and ‘echok’ settings.  Non-POSIX.  May be negated.
11897
11898‘extproc’
11899     Enable ‘LINEMODE’, which is used to avoid echoing each character
11900     over high latency links.  See also Internet RFC 1116
11901     (https://tools.ietf.org/search/rfc1116).  Non-POSIX.  May be
11902     negated.
11903
11904‘flusho’
11905     Discard output.  Note this setting is currently ignored on
11906     GNU/Linux systems.  Non-POSIX.  May be negated.
11907
11908
11909File: coreutils.info,  Node: Combination,  Next: Characters,  Prev: Local,  Up: stty invocation
11910
1191119.2.5 Combination settings
11912---------------------------
11913
11914Combination settings:
11915
11916‘evenp’
11917‘parity’
11918     Same as ‘parenb -parodd cs7’.  May be negated.  If negated, same as
11919     ‘-parenb cs8’.
11920
11921‘oddp’
11922     Same as ‘parenb parodd cs7’.  May be negated.  If negated, same as
11923     ‘-parenb cs8’.
11924
11925‘nl’
11926     Same as ‘-icrnl -onlcr’.  May be negated.  If negated, same as
11927     ‘icrnl -inlcr -igncr onlcr -ocrnl -onlret’.
11928
11929‘ek’
11930     Reset the ‘erase’ and ‘kill’ special characters to their default
11931     values.
11932
11933‘sane’
11934     Same as:
11935
11936          cread -ignbrk brkint -inlcr -igncr icrnl
11937          icanon iexten echo echoe echok -echonl -noflsh
11938          -ixoff -iutf8 -iuclc -ixany imaxbel -xcase -olcuc -ocrnl
11939          opost -ofill onlcr -onocr -onlret nl0 cr0 tab0 bs0 vt0 ff0
11940          isig -tostop -ofdel -echoprt echoctl echoke -extproc
11941
11942     and also sets all special characters to their default values.
11943
11944‘cooked’
11945     Same as ‘brkint ignpar istrip icrnl ixon opost isig icanon’, plus
11946     sets the ‘eof’ and ‘eol’ characters to their default values if they
11947     are the same as the ‘min’ and ‘time’ characters.  May be negated.
11948     If negated, same as ‘raw’.
11949
11950‘raw’
11951     Same as:
11952
11953          -ignbrk -brkint -ignpar -parmrk -inpck -istrip
11954          -inlcr -igncr -icrnl -ixon -ixoff -icanon -opost
11955          -isig -iuclc -ixany -imaxbel -xcase min 1 time 0
11956
11957     May be negated.  If negated, same as ‘cooked’.
11958
11959‘cbreak’
11960     Same as ‘-icanon’.  May be negated.  If negated, same as ‘icanon’.
11961
11962‘pass8’
11963     Same as ‘-parenb -istrip cs8’.  May be negated.  If negated, same
11964     as ‘parenb istrip cs7’.
11965
11966‘litout’
11967     Same as ‘-parenb -istrip -opost cs8’.  May be negated.  If negated,
11968     same as ‘parenb istrip opost cs7’.
11969
11970‘decctlq’
11971     Same as ‘-ixany’.  Non-POSIX.  May be negated.
11972
11973‘tabs’
11974     Same as ‘tab0’.  Non-POSIX.  May be negated.  If negated, same as
11975     ‘tab3’.
11976
11977‘lcase’
11978‘LCASE’
11979     Same as ‘xcase iuclc olcuc’.  Non-POSIX.  May be negated.  (Used
11980     for terminals with uppercase characters only.)
11981
11982‘crt’
11983     Same as ‘echoe echoctl echoke’.
11984
11985‘dec’
11986     Same as ‘echoe echoctl echoke -ixany intr ^C erase ^? kill C-u’.
11987
11988
11989File: coreutils.info,  Node: Characters,  Next: Special,  Prev: Combination,  Up: stty invocation
11990
1199119.2.6 Special characters
11992-------------------------
11993
11994The special characters’ default values vary from system to system.  They
11995are set with the syntax ‘name value’, where the names are listed below
11996and the value can be given either literally, in hat notation (‘^C’), or
11997as an integer which may start with ‘0x’ to indicate hexadecimal, ‘0’ to
11998indicate octal, or any other digit to indicate decimal.
11999
12000   For GNU stty, giving a value of ‘^-’ or ‘undef’ disables that special
12001character.  (This is incompatible with Ultrix ‘stty’, which uses a value
12002of ‘u’ to disable a special character.  GNU ‘stty’ treats a value ‘u’
12003like any other, namely to set that special character to <U>.)
12004
12005‘intr’
12006     Send an interrupt signal.
12007
12008‘quit’
12009     Send a quit signal.
12010
12011‘erase’
12012     Erase the last character typed.
12013
12014‘kill’
12015     Erase the current line.
12016
12017‘eof’
12018     Send an end of file (terminate the input).
12019
12020‘eol’
12021     End the line.
12022
12023‘eol2’
12024     Alternate character to end the line.  Non-POSIX.
12025
12026‘discard’
12027     Alternate character to toggle discarding of output.  Non-POSIX.
12028
12029‘swtch’
12030     Switch to a different shell layer.  Non-POSIX.
12031
12032‘status’
12033     Send an info signal.  Not currently supported on Linux.  Non-POSIX.
12034
12035‘start’
12036     Restart the output after stopping it.
12037
12038‘stop’
12039     Stop the output.
12040
12041‘susp’
12042     Send a terminal stop signal.
12043
12044‘dsusp’
12045     Send a terminal stop signal after flushing the input.  Non-POSIX.
12046
12047‘rprnt’
12048     Redraw the current line.  Non-POSIX.
12049
12050‘werase’
12051     Erase the last word typed.  Non-POSIX.
12052
12053‘lnext’
12054     Enter the next character typed literally, even if it is a special
12055     character.  Non-POSIX.
12056
12057
12058File: coreutils.info,  Node: Special,  Prev: Characters,  Up: stty invocation
12059
1206019.2.7 Special settings
12061-----------------------
12062
12063‘min N’
12064     Set the minimum number of characters that will satisfy a read until
12065     the time value has expired, when ‘-icanon’ is set.
12066
12067‘time N’
12068     Set the number of tenths of a second before reads time out if the
12069     minimum number of characters have not been read, when ‘-icanon’ is
12070     set.
12071
12072‘ispeed N’
12073     Set the input speed to N.
12074
12075‘ospeed N’
12076     Set the output speed to N.
12077
12078‘rows N’
12079     Tell the tty kernel driver that the terminal has N rows.
12080     Non-POSIX.
12081
12082‘cols N’
12083‘columns N’
12084     Tell the kernel that the terminal has N columns.  Non-POSIX.
12085
12086‘drain’
12087     Apply settings after first waiting for pending output to be
12088     transmitted.  This is enabled by default for GNU ‘stty’.  It is
12089     useful to disable this option in cases where the system may be in a
12090     state where serial transmission is not possible.  For example, if
12091     the system has received the ‘DC3’ character with ‘ixon’ (software
12092     flow control) enabled, then ‘stty’ would block without ‘-drain’
12093     being specified.  May be negated.  Non-POSIX.
12094
12095‘size’
12096     Print the number of rows and columns that the kernel thinks the
12097     terminal has.  (Systems that don’t support rows and columns in the
12098     kernel typically use the environment variables ‘LINES’ and
12099     ‘COLUMNS’ instead; however, GNU ‘stty’ does not know anything about
12100     them.)  Non-POSIX.
12101
12102‘line N’
12103     Use line discipline N.  Non-POSIX.
12104
12105‘speed’
12106     Print the terminal speed.
12107
12108‘N’
12109     Set the input and output speeds to N.  N can be one of: 0 50 75 110
12110     134 134.5 150 200 300 600 1200 1800 2400 4800 9600 19200 38400
12111     ‘exta’ ‘extb’.  ‘exta’ is the same as 19200; ‘extb’ is the same as
12112     38400.  Many systems, including GNU/Linux, support higher speeds.
12113     The ‘stty’ command includes support for speeds of 57600, 115200,
12114     230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
12115     2000000, 2500000, 3000000, 3500000, or 4000000 where the system
12116     supports these.  0 hangs up the line if ‘-clocal’ is set.
12117
12118
12119File: coreutils.info,  Node: printenv invocation,  Next: tty invocation,  Prev: stty invocation,  Up: Working context
12120
1212119.3 ‘printenv’: Print all or some environment variables
12122========================================================
12123
12124‘printenv’ prints environment variable values.  Synopsis:
12125
12126     printenv [OPTION] [VARIABLE]...
12127
12128   If no VARIABLEs are specified, ‘printenv’ prints the value of every
12129environment variable.  Otherwise, it prints the value of each VARIABLE
12130that is set, and nothing for those that are not set.
12131
12132   The program accepts the following option.  Also see *note Common
12133options::.
12134
12135‘-0’
12136‘--null’
12137     Output a zero byte (ASCII NUL) at the end of each line, rather than
12138     a newline.  This option enables other programs to parse the output
12139     even when that output would contain data with embedded newlines.
12140
12141   Exit status:
12142
12143     0 if all variables specified were found
12144     1 if at least one specified variable was not found
12145     2 if a write error occurred
12146
12147
12148File: coreutils.info,  Node: tty invocation,  Prev: printenv invocation,  Up: Working context
12149
1215019.4 ‘tty’: Print file name of terminal on standard input
12151=========================================================
12152
12153‘tty’ prints the file name of the terminal connected to its standard
12154input.  It prints ‘not a tty’ if standard input is not a terminal.
12155Synopsis:
12156
12157     tty [OPTION]...
12158
12159   The program accepts the following option.  Also see *note Common
12160options::.
12161
12162‘-s’
12163‘--silent’
12164‘--quiet’
12165     Print nothing; only return an exit status.
12166
12167   Exit status:
12168
12169     0 if standard input is a terminal
12170     1 if standard input is a non-terminal file
12171     2 if given incorrect arguments
12172     3 if a write error occurs
12173
12174
12175File: coreutils.info,  Node: User information,  Next: System context,  Prev: Working context,  Up: Top
12176
1217720 User information
12178*******************
12179
12180This section describes commands that print user-related information:
12181logins, groups, and so forth.
12182
12183* Menu:
12184
12185* id invocation::               Print user identity.
12186* logname invocation::          Print current login name.
12187* whoami invocation::           Print effective user ID.
12188* groups invocation::           Print group names a user is in.
12189* users invocation::            Print login names of users currently logged in.
12190* who invocation::              Print who is currently logged in.
12191
12192
12193File: coreutils.info,  Node: id invocation,  Next: logname invocation,  Up: User information
12194
1219520.1 ‘id’: Print user identity
12196==============================
12197
12198‘id’ prints information about the given user, or the process running it
12199if no user is specified.  Synopsis:
12200
12201     id [OPTION]... [USER]...
12202
12203   USER can be either a user ID or a name, with name look-up taking
12204precedence unless the ID is specified with a leading ‘+’.  *Note
12205Disambiguating names and IDs::.
12206
12207   By default, it prints the real user ID, real group ID, effective user
12208ID if different from the real user ID, effective group ID if different
12209from the real group ID, and supplemental group IDs.  In addition, if
12210SELinux is enabled and the ‘POSIXLY_CORRECT’ environment variable is not
12211set, then print ‘context=C’, where C is the security context.
12212
12213   Each of these numeric values is preceded by an identifying string and
12214followed by the corresponding user or group name in parentheses.
12215
12216   The options cause ‘id’ to print only part of the above information.
12217Also see *note Common options::.
12218
12219‘-g’
12220‘--group’
12221     Print only the group ID.
12222
12223‘-G’
12224‘--groups’
12225     Print only the group ID and the supplementary groups.
12226
12227‘-n’
12228‘--name’
12229     Print the user or group name instead of the ID number.  Requires
12230     ‘-u’, ‘-g’, or ‘-G’.
12231
12232‘-r’
12233‘--real’
12234     Print the real, instead of effective, user or group ID.  Requires
12235     ‘-u’, ‘-g’, or ‘-G’.
12236
12237‘-u’
12238‘--user’
12239     Print only the user ID.
12240
12241‘-Z’
12242‘--context’
12243     Print only the security context of the process, which is generally
12244     the user’s security context inherited from the parent process.  If
12245     neither SELinux or SMACK is enabled then print a warning and set
12246     the exit status to 1.
12247
12248‘-z’
12249‘--zero’
12250     Delimit output items with ASCII NUL characters.  This option is not
12251     permitted when using the default format.  When multiple users are
12252     specified, and the ‘--groups’ option is also in effect, groups are
12253     delimited with a single NUL character, while users are delimited
12254     with two NUL characters.
12255
12256     Example:
12257          $ id -Gn --zero
12258          users <NUL> devs <NUL>
12259
12260   Primary and supplementary groups for a process are normally inherited
12261from its parent and are usually unchanged since login.  This means that
12262if you change the group database after logging in, ‘id’ will not reflect
12263your changes within your existing login session.  Running ‘id’ with a
12264user argument causes the user and group database to be consulted afresh,
12265and so will give a different result.
12266
12267   An exit status of zero indicates success, and a nonzero value
12268indicates failure.
12269
12270
12271File: coreutils.info,  Node: logname invocation,  Next: whoami invocation,  Prev: id invocation,  Up: User information
12272
1227320.2 ‘logname’: Print current login name
12274========================================
12275
12276‘logname’ prints the calling user’s name, as found in a
12277system-maintained file (often ‘/var/run/utmp’ or ‘/etc/utmp’), and exits
12278with a status of 0.  If there is no entry for the calling process,
12279‘logname’ prints an error message and exits with a status of 1.
12280
12281   The only options are ‘--help’ and ‘--version’.  *Note Common
12282options::.
12283
12284   An exit status of zero indicates success, and a nonzero value
12285indicates failure.
12286
12287
12288File: coreutils.info,  Node: whoami invocation,  Next: groups invocation,  Prev: logname invocation,  Up: User information
12289
1229020.3 ‘whoami’: Print effective user ID
12291======================================
12292
12293‘whoami’ prints the user name associated with the current effective user
12294ID.  It is equivalent to the command ‘id -un’.
12295
12296   The only options are ‘--help’ and ‘--version’.  *Note Common
12297options::.
12298
12299   An exit status of zero indicates success, and a nonzero value
12300indicates failure.
12301
12302
12303File: coreutils.info,  Node: groups invocation,  Next: users invocation,  Prev: whoami invocation,  Up: User information
12304
1230520.4 ‘groups’: Print group names a user is in
12306=============================================
12307
12308‘groups’ prints the names of the primary and any supplementary groups
12309for each given USERNAME, or the current process if no names are given.
12310If more than one name is given, the name of each user is printed before
12311the list of that user’s groups and the user name is separated from the
12312group list by a colon.  Synopsis:
12313
12314     groups [USERNAME]...
12315
12316   The group lists are equivalent to the output of the command ‘id -Gn’.
12317
12318   The only options are ‘--help’ and ‘--version’.  *Note Common
12319options::.
12320
12321   Primary and supplementary groups for a process are normally inherited
12322from its parent and are usually unchanged since login.  This means that
12323if you change the group database after logging in, ‘groups’ will not
12324reflect your changes within your existing login session.  Running
12325‘groups’ with a list of users causes the user and group database to be
12326consulted afresh, and so will give a different result.
12327
12328   An exit status of zero indicates success, and a nonzero value
12329indicates failure.
12330
12331
12332File: coreutils.info,  Node: users invocation,  Next: who invocation,  Prev: groups invocation,  Up: User information
12333
1233420.5 ‘users’: Print login names of users currently logged in
12335============================================================
12336
12337‘users’ prints on a single line a blank-separated list of user names of
12338users currently logged in to the current host.  Each user name
12339corresponds to a login session, so if a user has more than one login
12340session, that user’s name will appear the same number of times in the
12341output.  Synopsis:
12342
12343     users [FILE]
12344
12345   With no FILE argument, ‘users’ extracts its information from a
12346system-maintained file (often ‘/var/run/utmp’ or ‘/etc/utmp’).  If a
12347file argument is given, ‘users’ uses that file instead.  A common choice
12348is ‘/var/log/wtmp’.
12349
12350   The only options are ‘--help’ and ‘--version’.  *Note Common
12351options::.
12352
12353   The ‘users’ command is installed only on platforms with the POSIX
12354‘<utmpx.h>’ include file or equivalent, so portable scripts should not
12355rely on its existence on non-POSIX platforms.
12356
12357   An exit status of zero indicates success, and a nonzero value
12358indicates failure.
12359
12360
12361File: coreutils.info,  Node: who invocation,  Prev: users invocation,  Up: User information
12362
1236320.6 ‘who’: Print who is currently logged in
12364============================================
12365
12366‘who’ prints information about users who are currently logged on.
12367Synopsis:
12368
12369     who [OPTION] [FILE] [am i]
12370
12371   If given no non-option arguments, ‘who’ prints the following
12372information for each user currently logged on: login name, terminal
12373line, login time, and remote hostname or X display.
12374
12375   If given one non-option argument, ‘who’ uses that instead of a
12376default system-maintained file (often ‘/var/run/utmp’ or ‘/etc/utmp’) as
12377the name of the file containing the record of users logged on.
12378/var/log/wtmp’ is commonly given as an argument to ‘who’ to look at who
12379has previously logged on.
12380
12381   If given two non-option arguments, ‘who’ prints only the entry for
12382the user running it (determined from its standard input), preceded by
12383the hostname.  Traditionally, the two arguments given are ‘am i’, as in
12384‘who am i’.
12385
12386   Timestamps are listed according to the time zone rules specified by
12387the ‘TZ’ environment variable, or by the system default rules if ‘TZ’ is
12388not set.  *Note Specifying the Time Zone with ‘TZ’: (libc)TZ Variable.
12389
12390   The program accepts the following options.  Also see *note Common
12391options::.
12392
12393‘-a’
12394‘--all’
12395     Same as ‘-b -d --login -p -r -t -T -u’.
12396
12397‘-b’
12398‘--boot’
12399     Print the date and time of last system boot.
12400
12401‘-d’
12402‘--dead’
12403     Print information corresponding to dead processes.
12404
12405‘-H’
12406‘--heading’
12407     Print a line of column headings.
12408
12409‘-l’
12410‘--login’
12411     List only the entries that correspond to processes via which the
12412     system is waiting for a user to login.  The user name is always
12413     ‘LOGIN’.
12414
12415‘--lookup’
12416     Attempt to canonicalize hostnames found in utmp through a DNS
12417     lookup.  This is not the default because it can cause significant
12418     delays on systems with automatic dial-up internet access.
12419
12420‘-m’
12421     Same as ‘who am i’.
12422
12423‘-p’
12424‘--process’
12425     List active processes spawned by init.
12426
12427‘-q’
12428‘--count’
12429     Print only the login names and the number of users logged on.
12430     Overrides all other options.
12431
12432‘-r’
12433‘--runlevel’
12434     Print the current (and maybe previous) run-level of the init
12435     process.
12436
12437‘-s’
12438     Ignored; for compatibility with other versions of ‘who’.
12439
12440‘-t’
12441‘--time’
12442     Print last system clock change.
12443
12444‘-u’
12445     After the login time, print the number of hours and minutes that
12446     the user has been idle.  ‘.’ means the user was active in the last
12447     minute.  ‘old’ means the user has been idle for more than 24 hours.
12448
12449‘-w’
12450‘-T’
12451‘--mesg’
12452‘--message’
12453‘--writable’
12454     After each login name print a character indicating the user’s
12455     message status:
12456
12457          ‘+’ allowing ‘write’ messages
12458          ‘-’ disallowing ‘write’ messages
12459          ‘?’ cannot find terminal device
12460
12461   The ‘who’ command is installed only on platforms with the POSIX
12462‘<utmpx.h>’ include file or equivalent, so portable scripts should not
12463rely on its existence on non-POSIX platforms.
12464
12465   An exit status of zero indicates success, and a nonzero value
12466indicates failure.
12467
12468
12469File: coreutils.info,  Node: System context,  Next: SELinux context,  Prev: User information,  Up: Top
12470
1247121 System context
12472*****************
12473
12474This section describes commands that print or change system-wide
12475information.
12476
12477* Menu:
12478
12479* date invocation::             Print or set system date and time.
12480* arch invocation::             Print machine hardware name.
12481* nproc invocation::            Print the number of processors.
12482* uname invocation::            Print system information.
12483* hostname invocation::         Print or set system name.
12484* hostid invocation::           Print numeric host identifier.
12485* uptime invocation::           Print system uptime and load.
12486
12487
12488File: coreutils.info,  Node: date invocation,  Next: arch invocation,  Up: System context
12489
1249021.1 ‘date’: Print or set system date and time
12491==============================================
12492
12493Synopses:
12494
12495     date [OPTION]... [+FORMAT]
12496     date [-u|--utc|--universal] [ MMDDhhmm[[CC]YY][.ss] ]
12497
12498   Invoking ‘date’ with no FORMAT argument is equivalent to invoking it
12499with a default format that depends on the ‘LC_TIME’ locale category.  In
12500the default C locale, this format is ‘'+%a %b %e %H:%M:%S %Z %Y'’, so
12501the output looks like ‘Thu Mar  3 13:47:51 PST 2005’.
12502
12503   Normally, ‘date’ uses the time zone rules indicated by the ‘TZ’
12504environment variable, or the system default rules if ‘TZ’ is not set.
12505*Note Specifying the Time Zone with ‘TZ’: (libc)TZ Variable.
12506
12507   If given an argument that starts with a ‘+’, ‘date’ prints the
12508current date and time (or the date and time specified by the ‘--date’
12509option, see below) in the format defined by that argument, which is
12510similar to that of the ‘strftime’ function.  Except for conversion
12511specifiers, which start with ‘%’, characters in the format string are
12512printed unchanged.  The conversion specifiers are described below.
12513
12514   An exit status of zero indicates success, and a nonzero value
12515indicates failure.
12516
12517* Menu:
12518
12519* Time conversion specifiers::     %[HIklMNpPrRsSTXzZ]
12520* Date conversion specifiers::     %[aAbBcCdDeFgGhjmuUVwWxyY]
12521* Literal conversion specifiers::  %[%nt]
12522* Padding and other flags::        Pad with zeros, spaces, etc.
12523* Setting the time::               Changing the system clock.
12524* Options for date::               Instead of the current time.
12525* Date input formats::             Specifying date strings.
12526* Examples of date::               Examples.
12527
12528
12529File: coreutils.info,  Node: Time conversion specifiers,  Next: Date conversion specifiers,  Up: date invocation
12530
1253121.1.1 Time conversion specifiers
12532---------------------------------
12533
12534‘date’ conversion specifiers related to times.
12535
12536‘%H’
12537     hour (‘00’...‘23’)
12538‘%I’
12539     hour (‘01’...‘12’)
12540‘%k’
12541     hour, space padded (‘ 0’...‘23’); equivalent to ‘%_H’.  This is a
12542     GNU extension.
12543‘%l’
12544     hour, space padded (‘ 1’...‘12’); equivalent to ‘%_I’.  This is a
12545     GNU extension.
12546‘%M’
12547     minute (‘00’...‘59’)
12548‘%N’
12549     nanoseconds (‘000000000’...‘999999999’).  This is a GNU extension.
12550‘%p’
12551     locale’s equivalent of either ‘AM’ or ‘PM’; blank in many locales.
12552     Noon is treated as ‘PM’ and midnight as ‘AM’.
12553‘%P’
12554     like ‘%p’, except lower case.  This is a GNU extension.
12555‘%r’
12556     locale’s 12-hour clock time (e.g., ‘11:11:04 PM’)
12557‘%R’
12558     24-hour hour and minute.  Same as ‘%H:%M’.
12559‘%s’
12560     seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC.  Leap
12561     seconds are not counted unless leap second support is available.
12562     *Note %s-examples::, for examples.  This is a GNU extension.
12563‘%S’
12564     second (‘00’...‘60’).  This may be ‘60’ if leap seconds are
12565     supported.
12566‘%T’
12567     24-hour hour, minute, and second.  Same as ‘%H:%M:%S’.
12568‘%X’
12569     locale’s time representation (e.g., ‘23:13:48’)
12570‘%z’
12571     Four-digit numeric time zone, e.g., ‘-0600’ or ‘+0530’, or ‘-0000’
12572     if no time zone is determinable.  This value reflects the numeric
12573     time zone appropriate for the current time, using the time zone
12574     rules specified by the ‘TZ’ environment variable.  A time zone is
12575     not determinable if its numeric offset is zero and its abbreviation
12576     begins with ‘-’.  The time (and optionally, the time zone rules)
12577     can be overridden by the ‘--date’ option.
12578‘%:z’
12579     Numeric time zone with ‘:’, e.g., ‘-06:00’ or ‘+05:30’), or
12580     ‘-00:00’ if no time zone is determinable.  This is a GNU extension.
12581‘%::z’
12582     Numeric time zone to the nearest second with ‘:’ (e.g., ‘-06:00:00’
12583     or ‘+05:30:00’), or ‘-00:00:00’ if no time zone is determinable.
12584     This is a GNU extension.
12585‘%:::z’
12586     Numeric time zone with ‘:’ using the minimum necessary precision
12587     (e.g., ‘-06’, ‘+05:30’, or ‘-04:56:02’), or ‘-00’ if no time zone
12588     is determinable.  This is a GNU extension.
12589‘%Z’
12590     alphabetic time zone abbreviation (e.g., ‘EDT’), or nothing if no
12591     time zone is determinable.  See ‘%z’ for how it is determined.
12592
12593
12594File: coreutils.info,  Node: Date conversion specifiers,  Next: Literal conversion specifiers,  Prev: Time conversion specifiers,  Up: date invocation
12595
1259621.1.2 Date conversion specifiers
12597---------------------------------
12598
12599‘date’ conversion specifiers related to dates.
12600
12601‘%a’
12602     locale’s abbreviated weekday name (e.g., ‘Sun’)
12603‘%A’
12604     locale’s full weekday name, variable length (e.g., ‘Sunday’)
12605‘%b’
12606     locale’s abbreviated month name (e.g., ‘Jan’)
12607‘%B’
12608     locale’s full month name, variable length (e.g., ‘January’)
12609‘%c’
12610     locale’s date and time (e.g., ‘Thu Mar  3 23:05:25 2005’)
12611‘%C’
12612     century.  This is like ‘%Y’, except the last two digits are
12613     omitted.  For example, it is ‘20’ if ‘%Y’ is ‘2000’, and is ‘-0’ if
12614     ‘%Y’ is ‘-001’.  It is normally at least two characters, but it may
12615     be more.
12616‘%d’
12617     day of month (e.g., ‘01’)
12618‘%D’
12619     date; same as ‘%m/%d/%y’
12620‘%e’
12621     day of month, space padded; same as ‘%_d’
12622‘%F’
12623     full date in ISO 8601 format; like ‘%+4Y-%m-%d’ except that any
12624     flags or field width override the ‘+’ and (after subtracting 6) the
12625     ‘4’.  This is a good choice for a date format, as it is standard
12626     and is easy to sort in the usual case where years are in the range
12627     0000...9999.
12628‘%g’
12629     year corresponding to the ISO week number, but without the century
12630     (range ‘00’ through ‘99’).  This has the same format and value as
12631     ‘%y’, except that if the ISO week number (see ‘%V’) belongs to the
12632     previous or next year, that year is used instead.
12633‘%G’
12634     year corresponding to the ISO week number.  This has the same
12635     format and value as ‘%Y’, except that if the ISO week number (see
12636     ‘%V’) belongs to the previous or next year, that year is used
12637     instead.  It is normally useful only if ‘%V’ is also used; for
12638     example, the format ‘%G-%m-%d’ is probably a mistake, since it
12639     combines the ISO week number year with the conventional month and
12640     day.
12641‘%h’
12642     same as ‘%b’
12643‘%j’
12644     day of year (‘001’...‘366’)
12645‘%m’
12646     month (‘01’...‘12’)
12647‘%q’
12648     quarter of year (‘1’...‘4’)
12649‘%u’
12650     day of week (‘1’...‘7’) with ‘1’ corresponding to Monday
12651‘%U’
12652     week number of year, with Sunday as the first day of the week
12653     (‘00’...‘53’).  Days in a new year preceding the first Sunday are
12654     in week zero.
12655‘%V’
12656     ISO week number, that is, the week number of year, with Monday as
12657     the first day of the week (‘01’...‘53’).  If the week containing
12658     January 1 has four or more days in the new year, then it is
12659     considered week 1; otherwise, it is week 53 of the previous year,
12660     and the next week is week 1.  (See the ISO 8601 standard.)
12661‘%w’
12662     day of week (‘0’...‘6’) with 0 corresponding to Sunday
12663‘%W’
12664     week number of year, with Monday as first day of week
12665     (‘00’...‘53’).  Days in a new year preceding the first Monday are
12666     in week zero.
12667‘%x’
12668     locale’s date representation (e.g., ‘12/31/99’)
12669‘%y’
12670     last two digits of year (‘00’...‘99’)
12671‘%Y’
12672     year.  This is normally at least four characters, but it may be
12673     more.  Year ‘0000’ precedes year ‘0001’, and year ‘-001’ precedes
12674     year ‘0000’.
12675
12676
12677File: coreutils.info,  Node: Literal conversion specifiers,  Next: Padding and other flags,  Prev: Date conversion specifiers,  Up: date invocation
12678
1267921.1.3 Literal conversion specifiers
12680------------------------------------
12681
12682‘date’ conversion specifiers that produce literal strings.
12683
12684‘%%’
12685     a literal %
12686‘%n’
12687     a newline
12688‘%t’
12689     a horizontal tab
12690
12691
12692File: coreutils.info,  Node: Padding and other flags,  Next: Setting the time,  Prev: Literal conversion specifiers,  Up: date invocation
12693
1269421.1.4 Padding and other flags
12695------------------------------
12696
12697Unless otherwise specified, ‘date’ normally pads numeric fields with
12698zeros, so that, for example, numeric months are always output as two
12699digits.  Seconds since the epoch are not padded, though, since there is
12700no natural width for them.
12701
12702   The following optional flags can appear after the ‘%’:
12703
12704‘-’
12705     (hyphen) Do not pad the field; useful if the output is intended for
12706     human consumption.  This is a GNU extension.
12707‘_’
12708     (underscore) Pad with spaces; useful if you need a fixed number of
12709     characters in the output, but zeros are too distracting.  This is a
12710     GNU extension.
12711‘0’
12712     (zero) Pad with zeros even if the conversion specifier would
12713     normally pad with spaces.
12714‘+’
12715     Pad with zeros, like ‘0’.  In addition, precede any year number
12716     with ‘+’ if it exceeds 9999 or if its field width exceeds 4;
12717     similarly, precede any century number with ‘+’ if it exceeds 99 or
12718     if its field width exceeds 2.  This supports ISO 8601 formats for
12719     dates far in the future; for example, the command ‘date
12720     --date=12019-02-25 +%+13F’ outputs the string ‘+012019-02-25’.
12721‘^’
12722     Use upper case characters if possible.  This is a GNU extension.
12723‘#’
12724     Use opposite case characters if possible.  A field that is normally
12725     upper case becomes lower case, and vice versa.  This is a GNU
12726     extension.
12727
12728Here are some examples of padding:
12729
12730     date +%d/%m -d "Feb 1"
12731     ⇒ 01/02
12732     date +%-d/%-m -d "Feb 1"
12733     ⇒ 1/2
12734     date +%_d/%_m -d "Feb 1"
12735     ⇒  1/ 2
12736
12737   You can optionally specify the field width (after any flag, if
12738present) as a decimal number.  If the natural size of the output of the
12739field has less than the specified number of characters, the result is
12740written right adjusted and padded to the given size.  For example, ‘%9B’
12741prints the right adjusted month name in a field of width 9.
12742
12743   An optional modifier can follow the optional flag and width
12744specification.  The modifiers are:
12745
12746‘E’
12747     Use the locale’s alternate representation for date and time.  This
12748     modifier applies to the ‘%c’, ‘%C’, ‘%x’, ‘%X’, ‘%y’ and ‘%Y’
12749     conversion specifiers.  In a Japanese locale, for example, ‘%Ex’
12750     might yield a date format based on the Japanese Emperors’ reigns.
12751
12752‘O’
12753     Use the locale’s alternate numeric symbols for numbers.  This
12754     modifier applies only to numeric conversion specifiers.
12755
12756   If the format supports the modifier but no alternate representation
12757is available, it is ignored.
12758
12759   POSIX specifies the behavior of flags and field widths only for ‘%C’,
12760‘%F’, ‘%G’, and ‘%Y’ (all without modifiers), and requires a flag to be
12761present if and only if a field width is also present.  Other
12762combinations of flags, field widths and modifiers are GNU extensions.
12763
12764
12765File: coreutils.info,  Node: Setting the time,  Next: Options for date,  Prev: Padding and other flags,  Up: date invocation
12766
1276721.1.5 Setting the time
12768-----------------------
12769
12770If given an argument that does not start with ‘+’, ‘date’ sets the
12771system clock to the date and time specified by that argument (as
12772described below).  You must have appropriate privileges to set the
12773system clock.  Note for changes to persist across a reboot, the hardware
12774clock may need to be updated from the system clock, which might not
12775happen automatically on your system.
12776
12777   The argument must consist entirely of digits, which have the
12778following meaning:
12779
12780‘MM’
12781     month
12782‘DD’
12783     day within month
12784‘hh’
12785     hour
12786‘mm’
12787     minute
12788‘CC’
12789     first two digits of year (optional)
12790‘YY’
12791     last two digits of year (optional)
12792‘ss’
12793     second (optional)
12794
12795   Note, the ‘--date’ and ‘--set’ options may not be used with an
12796argument in the above format.  The ‘--universal’ option may be used with
12797such an argument to indicate that the specified date and time are
12798relative to Universal Time rather than to the local time zone.
12799
12800
12801File: coreutils.info,  Node: Options for date,  Next: Examples of date,  Prev: Setting the time,  Up: date invocation
12802
1280321.1.6 Options for ‘date’
12804-------------------------
12805
12806The program accepts the following options.  Also see *note Common
12807options::.
12808
12809‘-d DATESTR’
12810‘--date=DATESTR’
12811     Display the date and time specified in DATESTR instead of the
12812     current date and time.  DATESTR can be in almost any common format.
12813     It can contain month names, time zones, ‘am’ and ‘pm’, ‘yesterday’,
12814     etc.  For example, ‘--date="2004-02-27 14:19:13.489392193 +0530"’
12815     specifies the instant of time that is 489,392,193 nanoseconds after
12816     February 27, 2004 at 2:19:13 PM in a time zone that is 5 hours and
12817     30 minutes east of UTC.
12818     Note: input currently must be in locale independent format.  E.g.,
12819     the LC_TIME=C below is needed to print back the correct date in
12820     many locales:
12821          date -d "$(LC_TIME=C date)"
12822     *Note Date input formats::.
12823
12824‘--debug’
12825     Annotate the parsed date, display the effective time zone, and warn
12826     about potential misuse.
12827
12828‘-f DATEFILE’
12829‘--file=DATEFILE’
12830     Parse each line in DATEFILE as with ‘-d’ and display the resulting
12831     date and time.  If DATEFILE is ‘-’, use standard input.  This is
12832     useful when you have many dates to process, because the system
12833     overhead of starting up the ‘date’ executable many times can be
12834     considerable.
12835
12836‘-I[TIMESPEC]’
12837‘--iso-8601[=TIMESPEC]’
12838     Display the date using an ISO 8601 format, ‘%Y-%m-%d’.
12839
12840     The argument TIMESPEC specifies the number of additional terms of
12841     the time to include.  It can be one of the following:
12842     ‘auto’
12843          Print just the date.  This is the default if TIMESPEC is
12844          omitted.
12845
12846     ‘hours’
12847          Append the hour of the day to the date.
12848
12849     ‘minutes’
12850          Append the hours and minutes.
12851
12852     ‘seconds’
12853          Append the hours, minutes and seconds.
12854
12855     ‘ns’
12856          Append the hours, minutes, seconds and nanoseconds.
12857
12858     If showing any time terms, then include the time zone using the
12859     format ‘%:z’.  This format is always suitable as input for the
12860     ‘--date’ (‘-d’) and ‘--file’ (‘-f’) options, regardless of the
12861     current locale.
12862
12863‘-r FILE’
12864‘--reference=FILE’
12865     Display the date and time of the last modification of FILE, instead
12866     of the current date and time.
12867
12868‘-R’
12869‘--rfc-email’
12870     Display the date and time using the format ‘%a, %d %b %Y %H:%M:%S
12871     %z’, evaluated in the C locale so abbreviations are always in
12872     English.  For example:
12873
12874          Fri, 09 Sep 2005 13:51:39 -0700
12875
12876     This format conforms to Internet RFCs 5322
12877     (https://tools.ietf.org/search/rfc5322), 2822
12878     (https://tools.ietf.org/search/rfc2822) and 822
12879     (https://tools.ietf.org/search/rfc822), the current and previous
12880     standards for Internet email.  For compatibility with older
12881     versions of ‘date’, ‘--rfc-2822’ and ‘--rfc-822’ are aliases for
12882     ‘--rfc-email’.
12883
12884‘--rfc-3339=TIMESPEC’
12885     Display the date using a format specified by Internet RFC 3339
12886     (https://tools.ietf.org/search/rfc3339).  This is like
12887     ‘--iso-8601’, except that a space rather than a ‘T’ separates dates
12888     from times.  This format is always suitable as input for the
12889     ‘--date’ (‘-d’) and ‘--file’ (‘-f’) options, regardless of the
12890     current locale.
12891
12892     The argument TIMESPEC specifies how much of the time to include.
12893     It can be one of the following:
12894
12895     ‘date’
12896          Print just the full-date, e.g., ‘2005-09-14’.  This is
12897          equivalent to the format ‘%Y-%m-%d’.
12898
12899     ‘seconds’
12900          Print the full-date and full-time separated by a space, e.g.,
12901          ‘2005-09-14 00:56:06+05:30’.  The output ends with a numeric
12902          time-offset; here the ‘+05:30’ means that local time is five
12903          hours and thirty minutes east of UTC.  This is equivalent to
12904          the format ‘%Y-%m-%d %H:%M:%S%:z’.
12905
12906     ‘ns’
12907          Like ‘seconds’, but also print nanoseconds, e.g., ‘2005-09-14
12908          00:56:06.998458565+05:30’.  This is equivalent to the format
12909          ‘%Y-%m-%d %H:%M:%S.%N%:z’.
12910
12911‘-s DATESTR’
12912‘--set=DATESTR’
12913     Set the date and time to DATESTR.  See ‘-d’ above.  See also *note
12914     Setting the time::.
12915
12916‘-u’
12917‘--utc’
12918‘--universal’
12919     Use Universal Time by operating as if the ‘TZ’ environment variable
12920     were set to the string ‘UTC0’.  UTC stands for Coordinated
12921     Universal Time, established in 1960.  Universal Time is often
12922     called “Greenwich Mean Time” (GMT) for historical reasons.
12923     Typically, systems ignore leap seconds and thus implement an
12924     approximation to UTC rather than true UTC.
12925
12926
12927File: coreutils.info,  Node: Examples of date,  Prev: Options for date,  Up: date invocation
12928
1292921.1.7 Examples of ‘date’
12930-------------------------
12931
12932Here are a few examples.  Also see the documentation for the ‘-d’ option
12933in the previous section.
12934
12935   • To print the date of the day before yesterday:
12936
12937          date --date='2 days ago'
12938
12939   • To print the date of the day three months and one day hence:
12940
12941          date --date='3 months 1 day'
12942
12943   • To print the day of year of Christmas in the current year:
12944
12945          date --date='25 Dec' +%j
12946
12947   • To print the current full month name and the day of the month:
12948
12949          date '+%B %d'
12950
12951     But this may not be what you want because for the first nine days
12952     of the month, the ‘%d’ expands to a zero-padded two-digit field,
12953     for example ‘date -d 1may '+%B %d'’ will print ‘May 01’.
12954
12955   • To print a date without the leading zero for one-digit days of the
12956     month, you can use the (GNU extension) ‘-’ flag to suppress the
12957     padding altogether:
12958
12959          date -d 1may '+%B %-d'
12960
12961   • To print the current date and time in the format required by many
12962     non-GNU versions of ‘date’ when setting the system clock:
12963
12964          date +%m%d%H%M%Y.%S
12965
12966   • To set the system clock forward by two minutes:
12967
12968          date --set='+2 minutes'
12969
12970   • To print the date in Internet RFC 5322 format, use ‘date
12971     --rfc-email’.  Here is some example output:
12972
12973          Fri, 09 Sep 2005 13:51:39 -0700
12974
12975   • To convert a date string to the number of seconds since the epoch
12976     (which is 1970-01-01 00:00:00 UTC), use the ‘--date’ option with
12977     the ‘%s’ format.  That can be useful in sorting and/or graphing
12978     and/or comparing data by date.  The following command outputs the
12979     number of the seconds since the epoch for the time two minutes
12980     after the epoch:
12981
12982          date --date='1970-01-01 00:02:00 +0000' +%s
12983          120
12984
12985     If you do not specify time zone information in the date string,
12986     ‘date’ uses your computer’s idea of the time zone when interpreting
12987     the string.  For example, if your computer’s time zone is that of
12988     Cambridge, Massachusetts, which was then 5 hours (i.e., 18,000
12989     seconds) behind UTC:
12990
12991          # local time zone used
12992          date --date='1970-01-01 00:02:00' +%s
12993          18120
12994
12995   • If you’re sorting or graphing dated data, your raw date values may
12996     be represented as seconds since the epoch.  But few people can look
12997     at the date ‘946684800’ and casually note “Oh, that’s the first
12998     second of the year 2000 in Greenwich, England.”
12999
13000          date --date='2000-01-01 UTC' +%s
13001          946684800
13002
13003     An alternative is to use the ‘--utc’ (‘-u’) option.  Then you may
13004     omit ‘UTC’ from the date string.  Although this produces the same
13005     result for ‘%s’ and many other format sequences, with a time zone
13006     offset different from zero, it would give a different result for
13007     zone-dependent formats like ‘%z’.
13008
13009          date -u --date=2000-01-01 +%s
13010          946684800
13011
13012     To convert such an unwieldy number of seconds back to a more
13013     readable form, use a command like this:
13014
13015          # local time zone used
13016          date -d '1970-01-01 UTC 946684800 seconds' +"%Y-%m-%d %T %z"
13017          1999-12-31 19:00:00 -0500
13018
13019     Or if you do not mind depending on the ‘@’ feature present since
13020     coreutils 5.3.0, you could shorten this to:
13021
13022          date -d @946684800 +"%F %T %z"
13023          1999-12-31 19:00:00 -0500
13024
13025     Often it is better to output UTC-relative date and time:
13026
13027          date -u -d '1970-01-01 946684800 seconds' +"%Y-%m-%d %T %z"
13028          2000-01-01 00:00:00 +0000
13029
13030   • Typically the seconds count omits leap seconds, but some systems
13031     are exceptions.  Because leap seconds are not predictable, the
13032     mapping between the seconds count and a future timestamp is not
13033     reliable on the atypical systems that include leap seconds in their
13034     counts.
13035
13036     Here is how the two kinds of systems handle the leap second at
13037     2012-06-30 23:59:60 UTC:
13038
13039          # Typical systems ignore leap seconds:
13040          date --date='2012-06-30 23:59:59 +0000' +%s
13041          1341100799
13042          date --date='2012-06-30 23:59:60 +0000' +%s
13043          date: invalid date '2012-06-30 23:59:60 +0000'
13044          date --date='2012-07-01 00:00:00 +0000' +%s
13045          1341100800
13046
13047          # Atypical systems count leap seconds:
13048          date --date='2012-06-30 23:59:59 +0000' +%s
13049          1341100823
13050          date --date='2012-06-30 23:59:60 +0000' +%s
13051          1341100824
13052          date --date='2012-07-01 00:00:00 +0000' +%s
13053          1341100825
13054
13055
13056File: coreutils.info,  Node: arch invocation,  Next: nproc invocation,  Prev: date invocation,  Up: System context
13057
1305821.2 ‘arch’: Print machine hardware name
13059========================================
13060
13061‘arch’ prints the machine hardware name, and is equivalent to ‘uname
13062-m’.  Synopsis:
13063
13064     arch [OPTION]
13065
13066   The program accepts the *note Common options:: only.
13067
13068   ‘arch’ is not installed by default, so portable scripts should not
13069rely on its existence.
13070
13071   An exit status of zero indicates success, and a nonzero value
13072indicates failure.
13073
13074
13075File: coreutils.info,  Node: nproc invocation,  Next: uname invocation,  Prev: arch invocation,  Up: System context
13076
1307721.3 ‘nproc’: Print the number of available processors
13078======================================================
13079
13080Print the number of processing units available to the current process,
13081which may be less than the number of online processors.  If this
13082information is not accessible, then print the number of processors
13083installed.  If the ‘OMP_NUM_THREADS’ or ‘OMP_THREAD_LIMIT’ environment
13084variables are set, then they will determine the minimum and maximum
13085returned value respectively.  The result is guaranteed to be greater
13086than zero.  Synopsis:
13087
13088     nproc [OPTION]
13089
13090   The program accepts the following options.  Also see *note Common
13091options::.
13092
13093‘--all’
13094     Print the number of installed processors on the system, which may
13095     be greater than the number online or available to the current
13096     process.  The ‘OMP_NUM_THREADS’ or ‘OMP_THREAD_LIMIT’ environment
13097     variables are not honored in this case.
13098
13099‘--ignore=NUMBER’
13100     If possible, exclude this NUMBER of processing units.
13101
13102   An exit status of zero indicates success, and a nonzero value
13103indicates failure.
13104
13105
13106File: coreutils.info,  Node: uname invocation,  Next: hostname invocation,  Prev: nproc invocation,  Up: System context
13107
1310821.4 ‘uname’: Print system information
13109======================================
13110
13111‘uname’ prints information about the machine and operating system it is
13112run on.  If no options are given, ‘uname’ acts as if the ‘-s’ option
13113were given.  Synopsis:
13114
13115     uname [OPTION]...
13116
13117   If multiple options or ‘-a’ are given, the selected information is
13118printed in this order:
13119
13120     KERNEL-NAME NODENAME KERNEL-RELEASE KERNEL-VERSION
13121     MACHINE PROCESSOR HARDWARE-PLATFORM OPERATING-SYSTEM
13122
13123   The information may contain internal spaces, so such output cannot be
13124parsed reliably.  In the following example, RELEASE is
131252.2.18ss.e820-bda652a #4 SMP Tue Jun 5 11:24:08 PDT 2001’:
13126
13127     uname -a
13128     ⇒ Linux dumdum 2.2.18 #4 SMP Tue Jun 5 11:24:08 PDT 2001 i686 unknown unknown GNU/Linux
13129
13130   The program accepts the following options.  Also see *note Common
13131options::.
13132
13133‘-a’
13134‘--all’
13135     Print all of the below information, except omit the processor type
13136     and the hardware platform name if they are unknown.
13137
13138‘-i’
13139‘--hardware-platform’
13140     Print the hardware platform name (sometimes called the hardware
13141     implementation).  Print ‘unknown’ if this information is not
13142     available.  Note this is non-portable (even across GNU/Linux
13143     distributions).
13144
13145‘-m’
13146‘--machine’
13147     Print the machine hardware name (sometimes called the hardware
13148     class or hardware type).
13149
13150‘-n’
13151‘--nodename’
13152     Print the network node hostname.
13153
13154‘-p’
13155‘--processor’
13156     Print the processor type (sometimes called the instruction set
13157     architecture or ISA). Print ‘unknown’ if this information is not
13158     available.  Note this is non-portable (even across GNU/Linux
13159     distributions).
13160
13161‘-o’
13162‘--operating-system’
13163     Print the name of the operating system.
13164
13165‘-r’
13166‘--kernel-release’
13167     Print the kernel release.
13168
13169‘-s’
13170‘--kernel-name’
13171     Print the kernel name.  POSIX 1003.1-2001 (*note Standards
13172     conformance::) calls this “the implementation of the operating
13173     system”, because the POSIX specification itself has no notion of
13174     “kernel”.  The kernel name might be the same as the operating
13175     system name printed by the ‘-o’ or ‘--operating-system’ option, but
13176     it might differ.  Some operating systems (e.g., FreeBSD, HP-UX)
13177     have the same name as their underlying kernels; others (e.g.,
13178     GNU/Linux, Solaris) do not.
13179
13180‘-v’
13181‘--kernel-version’
13182     Print the kernel version.
13183
13184   An exit status of zero indicates success, and a nonzero value
13185indicates failure.
13186
13187
13188File: coreutils.info,  Node: hostname invocation,  Next: hostid invocation,  Prev: uname invocation,  Up: System context
13189
1319021.5 ‘hostname’: Print or set system name
13191=========================================
13192
13193With no arguments, ‘hostname’ prints the name of the current host
13194system.  With one argument, it sets the current host name to the
13195specified string.  You must have appropriate privileges to set the host
13196name.  Synopsis:
13197
13198     hostname [NAME]
13199
13200   The only options are ‘--help’ and ‘--version’.  *Note Common
13201options::.
13202
13203   ‘hostname’ is not installed by default, and other packages also
13204supply a ‘hostname’ command, so portable scripts should not rely on its
13205existence or on the exact behavior documented above.
13206
13207   An exit status of zero indicates success, and a nonzero value
13208indicates failure.
13209
13210
13211File: coreutils.info,  Node: hostid invocation,  Next: uptime invocation,  Prev: hostname invocation,  Up: System context
13212
1321321.6 ‘hostid’: Print numeric host identifier
13214============================================
13215
13216‘hostid’ prints the numeric identifier of the current host in
13217hexadecimal.  This command accepts no arguments.  The only options are
13218‘--help’ and ‘--version’.  *Note Common options::.
13219
13220   For example, here’s what it prints on one system I use:
13221
13222     $ hostid
13223     1bac013d
13224
13225   On that system, the 32-bit quantity happens to be closely related to
13226the system’s Internet address, but that isn’t always the case.
13227
13228   ‘hostid’ is installed only on systems that have the ‘gethostid’
13229function, so portable scripts should not rely on its existence.
13230
13231   An exit status of zero indicates success, and a nonzero value
13232indicates failure.
13233
13234
13235File: coreutils.info,  Node: uptime invocation,  Prev: hostid invocation,  Up: System context
13236
1323721.7 ‘uptime’: Print system uptime and load
13238===========================================
13239
13240‘uptime’ prints the current time, the system’s uptime, the number of
13241logged-in users and the current load average.
13242
13243   If an argument is specified, it is used as the file to be read to
13244discover how many users are logged in.  If no argument is specified, a
13245system default is used (‘uptime --help’ indicates the default setting).
13246
13247   The only options are ‘--help’ and ‘--version’.  *Note Common
13248options::.
13249
13250   For example, here’s what it prints right now on one system I use:
13251
13252     $ uptime
13253      14:07  up   3:35,  3 users,  load average: 1.39, 1.15, 1.04
13254
13255   The precise method of calculation of load average varies somewhat
13256between systems.  Some systems calculate it as the average number of
13257runnable processes over the last 1, 5 and 15 minutes, but some systems
13258also include processes in the uninterruptible sleep state (that is,
13259those processes which are waiting for disk I/O). The Linux kernel
13260includes uninterruptible processes.
13261
13262   ‘uptime’ is installed only on platforms with infrastructure for
13263obtaining the boot time, and other packages also supply an ‘uptime’
13264command, so portable scripts should not rely on its existence or on the
13265exact behavior documented above.
13266
13267   An exit status of zero indicates success, and a nonzero value
13268indicates failure.
13269
13270
13271File: coreutils.info,  Node: SELinux context,  Next: Modified command invocation,  Prev: System context,  Up: Top
13272
1327322 SELinux context
13274******************
13275
13276This section describes commands for operations with SELinux contexts.
13277
13278* Menu:
13279
13280* chcon invocation::            Change SELinux context of file
13281* runcon invocation::           Run a command in specified SELinux context
13282
13283
13284File: coreutils.info,  Node: chcon invocation,  Next: runcon invocation,  Up: SELinux context
13285
1328622.1 ‘chcon’: Change SELinux context of file
13287============================================
13288
13289‘chcon’ changes the SELinux security context of the selected files.
13290Synopses:
13291
13292     chcon [OPTION]... CONTEXT FILE...
13293     chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
13294     chcon [OPTION]... --reference=RFILE FILE...
13295
13296   Change the SELinux security context of each FILE to CONTEXT.  With
13297‘--reference’, change the security context of each FILE to that of
13298RFILE.
13299
13300   The program accepts the following options.  Also see *note Common
13301options::.
13302
13303‘--dereference’
13304     Do not affect symbolic links but what they refer to; this is the
13305     default.
13306
13307‘-h’
13308‘--no-dereference’
13309     Affect the symbolic links themselves instead of any referenced
13310     file.
13311
13312‘--reference=RFILE’
13313     Use RFILE’s security context rather than specifying a CONTEXT
13314     value.
13315
13316‘-R’
13317‘--recursive’
13318     Operate on files and directories recursively.
13319
13320‘--preserve-root’
13321     Refuse to operate recursively on the root directory, ‘/’, when used
13322     together with the ‘--recursive’ option.  *Note Treating /
13323     specially::.
13324
13325‘--no-preserve-root’
13326     Do not treat the root directory, ‘/’, specially when operating
13327     recursively; this is the default.  *Note Treating / specially::.
13328
13329‘-H’
13330     If ‘--recursive’ (‘-R’) is specified and a command line argument is
13331     a symbolic link to a directory, traverse it.  *Note Traversing
13332     symlinks::.
13333
13334‘-L’
13335     In a recursive traversal, traverse every symbolic link to a
13336     directory that is encountered.  *Note Traversing symlinks::.
13337
13338‘-P’
13339     Do not traverse any symbolic links.  This is the default if none of
13340     ‘-H’, ‘-L’, or ‘-P’ is specified.  *Note Traversing symlinks::.
13341
13342‘-v’
13343‘--verbose’
13344     Output a diagnostic for every file processed.
13345
13346‘-u USER’
13347‘--user=USER’
13348     Set user USER in the target security context.
13349
13350‘-r ROLE’
13351‘--role=ROLE’
13352     Set role ROLE in the target security context.
13353
13354‘-t TYPE’
13355‘--type=TYPE’
13356     Set type TYPE in the target security context.
13357
13358‘-l RANGE’
13359‘--range=RANGE’
13360     Set range RANGE in the target security context.
13361
13362   An exit status of zero indicates success, and a nonzero value
13363indicates failure.
13364
13365
13366File: coreutils.info,  Node: runcon invocation,  Prev: chcon invocation,  Up: SELinux context
13367
1336822.2 ‘runcon’: Run a command in specified SELinux context
13369=========================================================
13370
13371‘runcon’ runs file in specified SELinux security context.
13372
13373   Synopses:
13374     runcon CONTEXT COMMAND [ARGS]
13375     runcon [ -c ] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [ARGS]
13376
13377   Run COMMAND with completely-specified CONTEXT, or with current or
13378transitioned security context modified by one or more of LEVEL, ROLE,
13379TYPE and USER.
13380
13381   If none of ‘-c’, ‘-t’, ‘-u’, ‘-r’, or ‘-l’ is specified, the first
13382argument is used as the complete context.  Any additional arguments
13383after COMMAND are interpreted as arguments to the command.
13384
13385   With neither CONTEXT nor COMMAND, print the current security context.
13386
13387   Note also the ‘setpriv’ command which can be used to set the
13388NO_NEW_PRIVS bit using ‘setpriv --no-new-privs runcon ...’, thus
13389disallowing usage of a security context with more privileges than the
13390process would normally have.
13391
13392   ‘runcon’ accepts the following options.  Also see *note Common
13393options::.
13394
13395‘-c’
13396‘--compute’
13397     Compute process transition context before modifying.
13398
13399‘-u USER’
13400‘--user=USER’
13401     Set user USER in the target security context.
13402
13403‘-r ROLE’
13404‘--role=ROLE’
13405     Set role ROLE in the target security context.
13406
13407‘-t TYPE’
13408‘--type=TYPE’
13409     Set type TYPE in the target security context.
13410
13411‘-l RANGE’
13412‘--range=RANGE’
13413     Set range RANGE in the target security context.
13414
13415   Exit status:
13416
13417     126 if COMMAND is found but cannot be invoked
13418     127 if ‘runcon’ itself fails or if COMMAND cannot be found
13419     the exit status of COMMAND otherwise
13420
13421
13422File: coreutils.info,  Node: Modified command invocation,  Next: Process control,  Prev: SELinux context,  Up: Top
13423
1342423 Modified command invocation
13425******************************
13426
13427This section describes commands that run other commands in some context
13428different than the current one: a modified environment, as a different
13429user, etc.
13430
13431* Menu:
13432
13433* chroot invocation::           Modify the root directory.
13434* env invocation::              Modify environment variables.
13435* nice invocation::             Modify niceness.
13436* nohup invocation::            Immunize to hangups.
13437* stdbuf invocation::           Modify buffering of standard streams.
13438* timeout invocation::          Run with time limit.
13439
13440
13441File: coreutils.info,  Node: chroot invocation,  Next: env invocation,  Up: Modified command invocation
13442
1344323.1 ‘chroot’: Run a command with a different root directory
13444============================================================
13445
13446‘chroot’ runs a command with a specified root directory.  On many
13447systems, only the super-user can do this.(1).  Synopses:
13448
13449     chroot OPTION NEWROOT [COMMAND [ARGS]...]
13450     chroot OPTION
13451
13452   Ordinarily, file names are looked up starting at the root of the
13453directory structure, i.e., ‘/’.  ‘chroot’ changes the root to the
13454directory NEWROOT (which must exist), then changes the working directory
13455to ‘/’, and finally runs COMMAND with optional ARGS.  If COMMAND is not
13456specified, the default is the value of the ‘SHELL’ environment variable
13457or ‘/bin/sh’ if not set, invoked with the ‘-i’ option.  COMMAND must not
13458be a special built-in utility (*note Special built-in utilities::).
13459
13460   The program accepts the following options.  Also see *note Common
13461options::.  Options must precede operands.
13462
13463‘--groups=GROUPS’
13464     Use this option to override the supplementary GROUPS to be used by
13465     the new process.  The items in the list (names or numeric IDs) must
13466     be separated by commas.  Use ‘--groups=''’ to disable the
13467     supplementary group look-up implicit in the ‘--userspec’ option.
13468
13469‘--userspec=USER[:GROUP]’
13470     By default, COMMAND is run with the same credentials as the
13471     invoking process.  Use this option to run it as a different USER
13472     and/or with a different primary GROUP.  If a USER is specified then
13473     the supplementary groups are set according to the system defined
13474     list for that user, unless overridden with the ‘--groups’ option.
13475
13476‘--skip-chdir’
13477     Use this option to not change the working directory to ‘/’ after
13478     changing the root directory to NEWROOT, i.e., inside the chroot.
13479     This option is only permitted when NEWROOT is the old ‘/’
13480     directory, and therefore is mostly useful together with the
13481     ‘--groups’ and ‘--userspec’ options to retain the previous working
13482     directory.
13483
13484   The user and group name look-up performed by the ‘--userspec’ and
13485‘--groups’ options, is done both outside and inside the chroot, with
13486successful look-ups inside the chroot taking precedence.  If the
13487specified user or group items are intended to represent a numeric ID,
13488then a name to ID resolving step is avoided by specifying a leading ‘+’.
13489*Note Disambiguating names and IDs::.
13490
13491   Here are a few tips to help avoid common problems in using chroot.
13492To start with a simple example, make COMMAND refer to a statically
13493linked binary.  If you were to use a dynamically linked executable, then
13494you’d have to arrange to have the shared libraries in the right place
13495under your new root directory.
13496
13497   For example, if you create a statically linked ‘ls’ executable, and
13498put it in ‘/tmp/empty’, you can run this command as root:
13499
13500     $ chroot /tmp/empty /ls -Rl /
13501
13502   Then you’ll see output like this:
13503
13504     /:
13505     total 1023
13506     -rwxr-xr-x 1 0 0 1041745 Aug 16 11:17 ls
13507
13508   If you want to use a dynamically linked executable, say ‘bash’, then
13509first run ‘ldd bash’ to see what shared objects it needs.  Then, in
13510addition to copying the actual binary, also copy the listed files to the
13511required positions under your intended new root directory.  Finally, if
13512the executable requires any other files (e.g., data, state, device
13513files), copy them into place, too.
13514
13515   ‘chroot’ is installed only on systems that have the ‘chroot’
13516function, so portable scripts should not rely on its existence.
13517
13518   Exit status:
13519
13520     125 if ‘chroot’ itself fails
13521     126 if COMMAND is found but cannot be invoked
13522     127 if COMMAND cannot be found
13523     the exit status of COMMAND otherwise
13524
13525   ---------- Footnotes ----------
13526
13527   (1) However, some systems (e.g., FreeBSD) can be configured to allow
13528certain regular users to use the ‘chroot’ system call, and hence to run
13529this program.  Also, on Cygwin, anyone can run the ‘chroot’ command,
13530because the underlying function is non-privileged due to lack of support
13531in MS-Windows.  Furthermore, the ‘chroot’ command avoids the ‘chroot’
13532system call when NEWROOT is identical to the old ‘/’ directory for
13533consistency with systems where this is allowed for non-privileged users.
13534
13535
13536File: coreutils.info,  Node: env invocation,  Next: nice invocation,  Prev: chroot invocation,  Up: Modified command invocation
13537
1353823.2 ‘env’: Run a command in a modified environment
13539===================================================
13540
13541‘env’ runs a command with a modified environment.  Synopses:
13542
13543     env [OPTION]... [NAME=VALUE]... [COMMAND [ARGS]...]
13544     env -[v]S'[OPTION]... [NAME=VALUE]... [COMMAND [ARGS]...]'
13545     env
13546
13547   ‘env’ is commonly used on first line of scripts (shebang line):
13548     #!/usr/bin/env COMMAND
13549     #!/usr/bin/env -[v]S[OPTION]... [NAME=VALUE]... COMMAND [ARGS]...
13550
13551   Operands of the form ‘VARIABLE=VALUE’ set the environment variable
13552VARIABLE to value VALUE.  VALUE may be empty (‘VARIABLE=’).  Setting a
13553variable to an empty value is different from unsetting it.  These
13554operands are evaluated left-to-right, so if two operands mention the
13555same variable the earlier is ignored.
13556
13557   Environment variable names can be empty, and can contain any
13558characters other than ‘=’ and ASCII NUL. However, it is wise to limit
13559yourself to names that consist solely of underscores, digits, and ASCII
13560letters, and that begin with a non-digit, as applications like the shell
13561do not work well with other names.
13562
13563   The first operand that does not contain the character ‘=’ specifies
13564the program to invoke; it is searched for according to the ‘PATH’
13565environment variable.  Any remaining arguments are passed as arguments
13566to that program.  The program should not be a special built-in utility
13567(*note Special built-in utilities::).
13568
13569   Modifications to ‘PATH’ take effect prior to searching for COMMAND.
13570Use caution when reducing ‘PATH’; behavior is not portable when ‘PATH’
13571is undefined or omits key directories such as ‘/bin’.
13572
13573   In the rare case that a utility contains a ‘=’ in the name, the only
13574way to disambiguate it from a variable assignment is to use an
13575intermediate command for COMMAND, and pass the problematic program name
13576via ARGS.  For example, if ‘./prog=’ is an executable in the current
13577‘PATH’:
13578
13579     env prog= true # runs 'true', with prog= in environment
13580     env ./prog= true # runs 'true', with ./prog= in environment
13581     env -- prog= true # runs 'true', with prog= in environment
13582     env sh -c '\prog= true' # runs 'prog=' with argument 'true'
13583     env sh -c 'exec "$@"' sh prog= true # also runs 'prog='
13584
13585   If no command name is specified following the environment
13586specifications, the resulting environment is printed.  This is like
13587specifying the ‘printenv’ program.
13588
13589   For some examples, suppose the environment passed to ‘env’ contains
13590‘LOGNAME=rms’, ‘EDITOR=emacs’, and ‘PATH=.:/gnubin:/hacks’:
13591
13592   • Output the current environment.
13593          $ env | LC_ALL=C sort
13594          EDITOR=emacs
13595          LOGNAME=rms
13596          PATH=.:/gnubin:/hacks
13597
13598   • Run ‘foo’ with a reduced environment, preserving only the original
13599     ‘PATH’ to avoid problems in locating ‘foo’.
13600          env - PATH="$PATH" foo
13601
13602   • Run ‘foo’ with the environment containing ‘LOGNAME=rms’,
13603     ‘EDITOR=emacs’, and ‘PATH=.:/gnubin:/hacks’, and guarantees that
13604     ‘foo’ was found in the file system rather than as a shell built-in.
13605          env foo
13606
13607   • Run ‘nemacs’ with the environment containing ‘LOGNAME=foo’,
13608     ‘EDITOR=emacs’, ‘PATH=.:/gnubin:/hacks’, and ‘DISPLAY=gnu:0’.
13609          env DISPLAY=gnu:0 LOGNAME=foo nemacs
13610
13611   • Attempt to run the program ‘/energy/--’ (as that is the only
13612     possible path search result); if the command exists, the
13613     environment will contain ‘LOGNAME=rms’ and ‘PATH=/energy’, and the
13614     arguments will be ‘e=mc2’, ‘bar’, and ‘baz’.
13615          env -u EDITOR PATH=/energy -- e=mc2 bar baz
13616
1361723.2.1 General options
13618----------------------
13619
13620The program accepts the following options.  Also see *note Common
13621options::.  Options must precede operands.
13622
13623‘-0’
13624‘--null’
13625     Output a zero byte (ASCII NUL) at the end of each line, rather than
13626     a newline.  This option enables other programs to parse the output
13627     even when that output would contain data with embedded newlines.
13628
13629‘-u NAME’
13630‘--unset=NAME’
13631     Remove variable NAME from the environment, if it was in the
13632     environment.
13633
13634‘-’
13635‘-i’
13636‘--ignore-environment’
13637     Start with an empty environment, ignoring the inherited
13638     environment.
13639
13640‘-C DIR’
13641‘--chdir=DIR’
13642     Change the working directory to DIR before invoking COMMAND.  This
13643     differs from the shell built-in ‘cd’ in that it starts COMMAND as a
13644     subprocess rather than altering the shell’s own working directory;
13645     this allows it to be chained with other commands that run commands
13646     in a different context.  For example:
13647
13648          # Run 'true' with /chroot as its root directory and /srv as its working
13649          # directory.
13650          chroot /chroot env --chdir=/srv true
13651          # Run 'true' with /build as its working directory, FOO=bar in its
13652          # environment, and a time limit of five seconds.
13653          env --chdir=/build FOO=bar timeout 5 true
13654
13655‘--default-signal[=SIG]’
13656     Unblock and reset signal SIG to its default signal handler.
13657     Without SIG all known signals are unblocked and reset to their
13658     defaults.  Multiple signals can be comma-separated.  The following
13659     command runs ‘seq’ with SIGINT and SIGPIPE set to their default
13660     (which is to terminate the program):
13661
13662          env --default-signal=PIPE,INT seq 1000 | head -n1
13663
13664     In the following example, we see how this is not possible to do
13665     with traditional shells.  Here the first trap command sets SIGPIPE
13666     to ignore.  The second trap command ostensibly sets it back to its
13667     default, but POSIX mandates that the shell must not change
13668     inherited state of the signal - so it is a no-op.
13669
13670          trap '' PIPE && sh -c 'trap - PIPE ; seq inf | head -n1'
13671
13672     Using ‘--default-signal=PIPE’ we can ensure the signal handling is
13673     set to its default behavior:
13674
13675          trap '' PIPE && sh -c 'env --default-signal=PIPE seq inf | head -n1'
13676
13677‘--ignore-signal[=SIG]’
13678     Ignore signal SIG when running a program.  Without SIG all known
13679     signals are set to ignore.  Multiple signals can be
13680     comma-separated.  The following command runs ‘seq’ with SIGINT set
13681     to be ignored - pressing ‘Ctrl-C’ will not terminate it:
13682
13683          env --ignore-signal=INT seq inf > /dev/null
13684
13685     ‘SIGCHLD’ is special, in that ‘--ignore-signal=CHLD’ might have no
13686     effect (POSIX says it’s unspecified).
13687
13688     Most operating systems do not allow ignoring ‘SIGKILL’, ‘SIGSTOP’
13689     (and possibly other signals).  Attempting to ignore these signals
13690     will fail.
13691
13692     Multiple (and contradictory) ‘--default-signal=SIG’ and
13693     ‘--ignore-signal=SIG’ options are processed left-to-right, with the
13694     latter taking precedence.  In the following example, ‘SIGPIPE’ is
13695     set to default while ‘SIGINT’ is ignored:
13696
13697          env --default-signal=INT,PIPE --ignore-signal=INT
13698
13699‘--block-signal[=SIG]’
13700     Block signal(s) SIG from being delivered.
13701
13702‘--list-signal-handling’
13703     List blocked or ignored signals to stderr, before executing a
13704     command.
13705
13706‘-v’
13707‘--debug’
13708     Show verbose information for each processing step.
13709
13710          $ env -v -uTERM A=B uname -s
13711          unset:    TERM
13712          setenv:   A=B
13713          executing: uname
13714             arg[0]= 'uname'
13715             arg[1]= '-s'
13716          Linux
13717
13718     When combined with ‘-S’ it is recommended to list ‘-v’ first, e.g.
13719     ‘env -vS'string'’.
13720
13721‘-S STRING’
13722‘--split-string=STRING’
13723     process and split STRING into separate arguments used to pass
13724     multiple arguments on shebang lines.  ‘env’ supports FreeBSD’s
13725     syntax of several escape sequences and environment variable
13726     expansions.  See below for details and examples.
13727
13728   Exit status:
13729
13730     0   if no COMMAND is specified and the environment is output
13731     125 if ‘env’ itself fails
13732     126 if COMMAND is found but cannot be invoked
13733     127 if COMMAND cannot be found
13734     the exit status of COMMAND otherwise
13735
1373623.2.2 ‘-S’/‘--split-string’ usage in scripts
13737---------------------------------------------
13738
13739The ‘-S’/‘--split-string’ options enable using multiple arguments on the
13740first one of scripts (shebang line, ‘#!’).
13741
13742   When a script’s interpreter is in a known location, scripts typically
13743contain the absolute file name in their first line:
13744
13745Shell script:         #!/bin/sh
13746                      echo hello
13747
13748Perl script:          #!/usr/bin/perl
13749                      print "hello\n";
13750
13751Python script:        #!/usr/bin/python3
13752                      print("hello")
13753
13754
13755   When a script’s interpreter is in a non-standard location in the
13756‘PATH’ environment variable, it is recommended to use ‘env’ on the first
13757line of the script to find the executable and run it:
13758
13759Shell script:         #!/usr/bin/env bash
13760                      echo hello
13761
13762Perl script:          #!/usr/bin/env perl
13763                      print "hello\n";
13764
13765Python script:        #!/usr/bin/env python3
13766                      print("hello")
13767
13768
13769   Most operating systems (e.g.  GNU/Linux, BSDs) treat all text after
13770the first space as a single argument.  When using ‘env’ in a script it
13771is thus not possible to specify multiple arguments.
13772
13773   In the following example:
13774     #!/usr/bin/env perl -T -w
13775     print "hello\n";
13776
13777   The operating system treats ‘perl -T -w’ as one argument (the
13778program’s name), and executing the script fails with:
13779
13780     /usr/bin/env: 'perl -T -w': No such file or directory
13781
13782   The ‘-S’ option instructs ‘env’ to split the single string into
13783multiple arguments.  The following example works as expected:
13784
13785     $ cat hello.pl
13786     #!/usr/bin/env -S perl -T -w
13787     print "hello\n";
13788
13789     $ chmod a+x hello.pl
13790     $ ./hello.pl
13791     hello
13792
13793   And is equivalent to running ‘perl -T -w hello.pl’ on the command
13794line prompt.
13795
13796Testing and troubleshooting
13797...........................
13798
13799To test ‘env -S’ on the command line, use single quotes for the ‘-S’
13800string to emulate a single paramter.  Single quotes are not needed when
13801using ‘env -S’ in a shebang line on the first line of a script (the
13802operating system already treats it as one argument).
13803
13804   The following command is equivalent to the ‘hello.pl’ script above:
13805
13806     $ env -S'perl -T -w' hello.pl
13807
13808   To troubleshoot ‘-S’ usage add the ‘-v’ as the first argument (before
13809‘-S’).
13810
13811   Using ‘-vS’ on a shebang line in a script:
13812
13813     $ cat hello-debug.pl
13814     #!/usr/bin/env -vS perl -T -w
13815     print "hello\n";
13816
13817     $ chmod a+x hello-debug.pl
13818     $ ./hello-debug.pl
13819     split -S:  'perl -T -w'
13820      into:    'perl'
13821          &    '-T'
13822          &    '-w'
13823     executing: perl
13824        arg[0]= 'perl'
13825        arg[1]= '-T'
13826        arg[2]= '-w'
13827        arg[3]= './hello-debug.pl'
13828     hello
13829
13830   Using ‘-vS’ on the command line prompt (adding single quotes):
13831
13832     $ env -vS'perl -T -w' hello-debug.pl
13833     split -S:  'perl -T -w'
13834      into:    'perl'
13835          &    '-T'
13836          &    '-w'
13837     executing: perl
13838        arg[0]= 'perl'
13839        arg[1]= '-T'
13840        arg[2]= '-w'
13841        arg[3]= 'hello-debug.pl'
13842     hello
13843
1384423.2.3 ‘-S’/‘--split-string’ syntax
13845-----------------------------------
13846
13847Splitting arguments by whitespace
13848.................................
13849
13850Running ‘env -Sstring’ splits the STRING into arguments based on
13851unquoted spaces or tab characters.
13852
13853   In the following contrived example the ‘awk’ variable ‘OFS’ will be
13854‘<space>xyz<space>’ as these spaces are inside double quotes.  The other
13855space characters are used as argument separators:
13856
13857     $ cat one.awk
13858     #!/usr/bin/env -S awk -v OFS=" xyz " -f
13859     BEGIN {print 1,2,3}
13860
13861     $ chmod a+x one.awk
13862     $ ./one.awk
13863     1 xyz 2 xyz 3
13864
13865   When using ‘-S’ on the command line prompt, remember to add single
13866quotes around the entire string:
13867
13868     $ env -S'awk -v OFS=" xyz " -f' one.awk
13869     1 xyz 2 xyz 3
13870
13871Escape sequences
13872................
13873
13874‘env’ supports several escape sequences.  These sequences are processed
13875when unquoted or inside double quotes (unless otherwise noted).  Single
13876quotes disable escape sequences except ‘\'’ and ‘\\’.
13877
13878‘\c’    Ignore the remaining characters in the string.  Cannot be used
13879        inside double quotes.
13880
13881‘\f’    form-feed character (ASCII 0x0C)
13882
13883‘\n’    new-line character (ASCII 0x0A)
13884
13885‘\r’    carriage-return character (ASCII 0x0D)
13886
13887‘\t’    tab character (ASCII 0x09)
13888
13889‘\v’    vertical tab character (ASCII 0x0B)
13890
13891‘\#’    A hash ‘#’ character.  Used when a ‘#’ character is needed as
13892        the first character of an argument (see ’comments’ section
13893        below).
13894
13895‘\$’    A dollar-sign character ‘$’.  Unescaped ‘$’ characters are used
13896        to expand environment variables (see ’variables’ section
13897        below).
13898
13899‘\_’    Inside double-quotes, replaced with a single space character.
13900        Outside quotes, treated as an argument separator.  ‘\_’ can be
13901        used to avoid space characters in a shebang line (see examples
13902        below).
13903
13904‘\"’    A double-quote character.
13905
13906‘\'’    A single-quote character.  This escape sequence works inside
13907        single-quoted strings.
13908
13909‘\\’    A backslash character.  This escape sequence works inside
13910        single-quoted strings.
13911
13912
13913   The following ‘awk’ script will use tab character as input and output
13914field separator (instead of spaces and tabs):
13915
13916     $ cat tabs.awk
13917     #!/usr/bin/env -S awk -v FS="\t" -v OFS="\t" -f
13918     ...
13919
13920Comments
13921........
13922
13923The escape sequence ‘\c’ (used outside single/double quotes) causes
13924‘env’ to ignore the rest of the string.
13925
13926   The ‘#’ character causes ‘env’ to ignore the rest of the string when
13927it appears as the first character of an argument.  Use ‘\#’ to reverse
13928this behavior.
13929
13930     $ env -S'printf %s\n A B C'
13931     A
13932     B
13933     C
13934
13935     $ env -S'printf %s\n A# B C'
13936     A#
13937     B
13938     C
13939
13940     $ env -S'printf %s\n A #B C'
13941     A
13942
13943     $ env -S'printf %s\n A \#B C'
13944     A
13945     #B
13946     C
13947
13948     $ env -S'printf %s\n A\cB C'
13949     A
13950
13951   NOTE: The above examples use single quotes as they are executed on
13952the command-line.
13953
13954Environment variable expansion
13955..............................
13956
13957The pattern ‘${VARNAME}’ is used to substitute a value from the
13958environment variable.  The pattern must include the curly braces
13959(‘{’,‘}’).  Without them ‘env’ will reject the string.  Special shell
13960variables (such as ‘$@’, ‘$*’, ‘$$’) are not supported.
13961
13962   If the environment variable is empty or not set, the pattern will be
13963replaced by an empty string.  The value of ‘${VARNAME}’ will be that of
13964the executed ‘env’, before any modifications using
13965‘-i’/‘--ignore-environment’/‘-u’/‘--unset’ or setting new values using
13966‘VAR=VALUE’.
13967
13968   The following python script prepends ‘/opt/custom/modules’ to the
13969python module search path environment variable (‘PYTHONPATH’):
13970
13971     $ cat custom.py
13972     #!/usr/bin/env -S PYTHONPATH=/opt/custom/modules/:${PYTHONPATH} python
13973     print "hello"
13974     ...
13975
13976   The expansion of ‘${PYTHONPATH}’ is performed by ‘env’, not by a
13977shell.  If the curly braces are omitted, ‘env’ will fail:
13978
13979     $ cat custom.py
13980     #!/usr/bin/env -S PYTHONPATH=/opt/custom/modules/:$PYTHONPATH python
13981     print "hello"
13982     ...
13983
13984     $ chmod a+x custom.py
13985     $ custom.py
13986     /usr/bin/env: only ${VARNAME} expansion is supported, error at: $PYTHONPATH python
13987
13988   Environment variable expansion happens before clearing the
13989environment (with ‘-i’) or unsetting specific variables (with ‘-u’):
13990
13991     $ env -S'-i OLDUSER=${USER} env'
13992     OLDUSER=gordon
13993
13994   Use ‘-v’ to diagnose the operations step-by-step:
13995
13996     $ env -vS'-i OLDUSER=${USER} env'
13997     expanding ${USER} into 'gordon'
13998     split -S:  '-i OLDUSER=${USER} env'
13999      into:    '-i'
14000          &    'OLDUSER=gordon'
14001          &    'env'
14002     cleaning environ
14003     setenv:   OLDUSER=gordon
14004     executing: env
14005        arg[0]= 'env'
14006     OLDUSER=gordon
14007
14008
14009File: coreutils.info,  Node: nice invocation,  Next: nohup invocation,  Prev: env invocation,  Up: Modified command invocation
14010
1401123.3 ‘nice’: Run a command with modified niceness
14012=================================================
14013
14014‘nice’ prints a process’s “niceness”, or runs a command with modified
14015niceness.  “niceness” affects how favorably the process is scheduled in
14016the system.  Synopsis:
14017
14018     nice [OPTION]... [COMMAND [ARG]...]
14019
14020   If no arguments are given, ‘nice’ prints the current niceness.
14021Otherwise, ‘nice’ runs the given COMMAND with its niceness adjusted.  By
14022default, its niceness is incremented by 10.
14023
14024   Niceness values range at least from −20 (process has high priority
14025and gets more resources, thus slowing down other processes) through 19
14026(process has lower priority and runs slowly itself, but has less impact
14027on the speed of other running processes).  Some systems may have a wider
14028range of niceness values; conversely, other systems may enforce more
14029restrictive limits.  An attempt to set the niceness outside the
14030supported range is treated as an attempt to use the minimum or maximum
14031supported value.
14032
14033   A niceness should not be confused with a scheduling priority, which
14034lets applications determine the order in which threads are scheduled to
14035run.  Unlike a priority, a niceness is merely advice to the scheduler,
14036which the scheduler is free to ignore.  Also, as a point of terminology,
14037POSIX defines the behavior of ‘nice’ in terms of a “nice value”, which
14038is the non-negative difference between a niceness and the minimum
14039niceness.  Though ‘nice’ conforms to POSIX, its documentation and
14040diagnostics use the term “niceness” for compatibility with historical
14041practice.
14042
14043   COMMAND must not be a special built-in utility (*note Special
14044built-in utilities::).
14045
14046   Due to shell aliases and built-in ‘nice’ functions, using an
14047unadorned ‘nice’ interactively or in a script may get you different
14048functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
14049nice ...’) to avoid interference from the shell.
14050
14051   Note to change the “niceness” of an existing process, one needs to
14052use the ‘renice’ command.
14053
14054   The program accepts the following option.  Also see *note Common
14055options::.  Options must precede operands.
14056
14057‘-n ADJUSTMENT’
14058‘--adjustment=ADJUSTMENT’
14059     Add ADJUSTMENT instead of 10 to the command’s niceness.  If
14060     ADJUSTMENT is negative and you lack appropriate privileges, ‘nice’
14061     issues a warning but otherwise acts as if you specified a zero
14062     adjustment.
14063
14064     For compatibility ‘nice’ also supports an obsolete option syntax
14065     ‘-ADJUSTMENT’.  New scripts should use ‘-n ADJUSTMENT’ instead.
14066
14067   ‘nice’ is installed only on systems that have the POSIX ‘setpriority’
14068function, so portable scripts should not rely on its existence on
14069non-POSIX platforms.
14070
14071   Exit status:
14072
14073     0   if no COMMAND is specified and the niceness is output
14074     125 if ‘nice’ itself fails
14075     126 if COMMAND is found but cannot be invoked
14076     127 if COMMAND cannot be found
14077     the exit status of COMMAND otherwise
14078
14079   It is sometimes useful to run a non-interactive program with reduced
14080niceness.
14081
14082     $ nice factor 4611686018427387903
14083
14084   Since ‘nice’ prints the current niceness, you can invoke it through
14085itself to demonstrate how it works.
14086
14087   The default behavior is to increase the niceness by ‘10’:
14088
14089     $ nice
14090     0
14091     $ nice nice
14092     10
14093     $ nice -n 10 nice
14094     10
14095
14096   The ADJUSTMENT is relative to the current niceness.  In the next
14097example, the first ‘nice’ invocation runs the second one with niceness
1409810, and it in turn runs the final one with a niceness that is 3 more:
14099
14100     $ nice nice -n 3 nice
14101     13
14102
14103   Specifying a niceness larger than the supported range is the same as
14104specifying the maximum supported value:
14105
14106     $ nice -n 10000000000 nice
14107     19
14108
14109   Only a privileged user may run a process with lower niceness:
14110
14111     $ nice -n -1 nice
14112     nice: cannot set niceness: Permission denied
14113     0
14114     $ sudo nice -n -1 nice
14115     -1
14116
14117
14118File: coreutils.info,  Node: nohup invocation,  Next: stdbuf invocation,  Prev: nice invocation,  Up: Modified command invocation
14119
1412023.4 ‘nohup’: Run a command immune to hangups
14121=============================================
14122
14123‘nohup’ runs the given COMMAND with hangup signals ignored, so that the
14124command can continue running in the background after you log out.
14125Synopsis:
14126
14127     nohup COMMAND [ARG]...
14128
14129   If standard input is a terminal, redirect it so that terminal
14130sessions do not mistakenly consider the terminal to be used by the
14131command.  Make the substitute file descriptor unreadable, so that
14132commands that mistakenly attempt to read from standard input can report
14133an error.  This redirection is a GNU extension; programs intended to be
14134portable to non-GNU hosts can use ‘nohup COMMAND [ARG]... 0>/dev/null14135instead.
14136
14137   If standard output is a terminal, the command’s standard output is
14138appended to the file ‘nohup.out’; if that cannot be written to, it is
14139appended to the file ‘$HOME/nohup.out’; and if that cannot be written
14140to, the command is not run.  Any ‘nohup.out’ or ‘$HOME/nohup.out’ file
14141created by ‘nohup’ is made readable and writable only to the user,
14142regardless of the current umask settings.
14143
14144   If standard error is a terminal, it is normally redirected to the
14145same file descriptor as the (possibly-redirected) standard output.
14146However, if standard output is closed, standard error terminal output is
14147instead appended to the file ‘nohup.out’ or ‘$HOME/nohup.out’ as above.
14148
14149   To capture the command’s output to a file other than ‘nohup.out’ you
14150can redirect it.  For example, to capture the output of ‘make’:
14151
14152     nohup make > make.log
14153
14154   ‘nohup’ does not automatically put the command it runs in the
14155background; you must do that explicitly, by ending the command line with
14156an ‘&’.  Also, ‘nohup’ does not alter the niceness of COMMAND; use
14157‘nice’ for that, e.g., ‘nohup nice COMMAND’.
14158
14159   COMMAND must not be a special built-in utility (*note Special
14160built-in utilities::).
14161
14162   The only options are ‘--help’ and ‘--version’.  *Note Common
14163options::.  Options must precede operands.
14164
14165   Exit status:
14166
14167     125 if ‘nohup’ itself fails, and ‘POSIXLY_CORRECT’ is not set
14168     126 if COMMAND is found but cannot be invoked
14169     127 if COMMAND cannot be found
14170     the exit status of COMMAND otherwise
14171
14172   If ‘POSIXLY_CORRECT’ is set, internal failures give status 127
14173instead of 125.
14174
14175
14176File: coreutils.info,  Node: stdbuf invocation,  Next: timeout invocation,  Prev: nohup invocation,  Up: Modified command invocation
14177
1417823.5 ‘stdbuf’: Run a command with modified I/O stream buffering
14179===============================================================
14180
14181‘stdbuf’ allows one to modify the buffering operations of the three
14182standard I/O streams associated with a program.  Synopsis:
14183
14184     stdbuf OPTION... COMMAND
14185
14186   COMMAND must start with the name of a program that
14187  1. uses the ISO C ‘FILE’ streams for input/output (note the programs
14188     ‘dd’ and ‘cat’ don’t do that),
14189
14190  2. does not adjust the buffering of its standard streams (note the
14191     program ‘tee’ is not in this category).
14192
14193   Any additional ARGs are passed as additional arguments to the
14194COMMAND.
14195
14196   The program accepts the following options.  Also see *note Common
14197options::.
14198
14199‘-i MODE’
14200‘--input=MODE’
14201     Adjust the standard input stream buffering.
14202
14203‘-o MODE’
14204‘--output=MODE’
14205     Adjust the standard output stream buffering.
14206
14207‘-e MODE’
14208‘--error=MODE’
14209     Adjust the standard error stream buffering.
14210
14211   The MODE can be specified as follows:
14212
14213‘L’
14214     Set the stream to line buffered mode.  In this mode data is
14215     coalesced until a newline is output or input is read from any
14216     stream attached to a terminal device.  This option is invalid with
14217     standard input.
14218
14219‘0’
14220     Disable buffering of the selected stream.  In this mode, data is
14221     output immediately and only the amount of data requested is read
14222     from input.  Note the difference in function for input and output.
14223     Disabling buffering for input will not influence the responsiveness
14224     or blocking behavior of the stream input functions.  For example
14225     ‘fread’ will still block until ‘EOF’ or error, even if the
14226     underlying ‘read’ returns less data than requested.
14227
14228‘SIZE’
14229     Specify the size of the buffer to use in fully buffered mode.  SIZE
14230     may be, or may be an integer optionally followed by, one of the
14231     following multiplicative suffixes:
14232          ‘KB’ =>           1000 (KiloBytes)
14233          ‘K’  =>           1024 (KibiBytes)
14234          ‘MB’ =>      1000*1000 (MegaBytes)
14235          ‘M’  =>      1024*1024 (MebiBytes)
14236          ‘GB’ => 1000*1000*1000 (GigaBytes)
14237          ‘G’  => 1024*1024*1024 (GibiBytes)
14238     and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.  Binary prefixes can be
14239     used, too: ‘KiB’=‘K’, ‘MiB’=‘M’, and so on.
14240
14241   ‘stdbuf’ is installed only on platforms that use the Executable and
14242Linkable Format (ELF) and support the ‘constructor’ attribute, so
14243portable scripts should not rely on its existence.
14244
14245   Exit status:
14246
14247     125 if ‘stdbuf’ itself fails
14248     126 if COMMAND is found but cannot be invoked
14249     127 if COMMAND cannot be found
14250     the exit status of COMMAND otherwise
14251
14252
14253File: coreutils.info,  Node: timeout invocation,  Prev: stdbuf invocation,  Up: Modified command invocation
14254
1425523.6 ‘timeout’: Run a command with a time limit
14256===============================================
14257
14258‘timeout’ runs the given COMMAND and kills it if it is still running
14259after the specified time interval.  Synopsis:
14260
14261     timeout [OPTION] DURATION COMMAND [ARG]...
14262
14263   COMMAND must not be a special built-in utility (*note Special
14264built-in utilities::).
14265
14266   The program accepts the following options.  Also see *note Common
14267options::.  Options must precede operands.
14268
14269‘--preserve-status’
14270     Return the exit status of the managed COMMAND on timeout, rather
14271     than a specific exit status indicating a timeout.  This is useful
14272     if the managed COMMAND supports running for an indeterminate amount
14273     of time.
14274
14275‘--foreground’
14276     Don’t create a separate background program group, so that the
14277     managed COMMAND can use the foreground TTY normally.  This is
14278     needed to support timing out commands not started directly from an
14279     interactive shell, in two situations.
14280       1. COMMAND is interactive and needs to read from the terminal for
14281          example
14282       2. the user wants to support sending signals directly to COMMAND
14283          from the terminal (like Ctrl-C for example)
14284
14285     Note in this mode of operation, any children of COMMAND will not be
14286     timed out.  Also SIGCONT will not be sent to COMMAND, as it’s
14287     generally not needed with foreground processes, and can cause
14288     intermittent signal delivery issues with programs that are monitors
14289     themselves (like GDB for example).
14290
14291‘-k DURATION’
14292‘--kill-after=DURATION’
14293     Ensure the monitored COMMAND is killed by also sending a ‘KILL’
14294     signal, after the specified DURATION.  Without this option, if the
14295     selected signal proves not to be fatal, ‘timeout’ does not kill the
14296     COMMAND.
14297
14298‘-s SIGNAL’
14299‘--signal=SIGNAL’
14300     Send this SIGNAL to COMMAND on timeout, rather than the default
14301     ‘TERM’ signal.  SIGNAL may be a name like ‘HUP’ or a number.  *Note
14302     Signal specifications::.
14303
14304‘-v’
14305‘--verbose’
14306     Diagnose to stderr, any signal sent upon timeout.
14307
14308   DURATION is a floating point number in either the current or the C
14309locale (*note Floating point::) followed by an optional unit:
14310     ‘s’ for seconds (the default)
14311     ‘m’ for minutes
14312     ‘h’ for hours
14313     ‘d’ for days
14314   A duration of 0 disables the associated timeout.  Note that the
14315actual timeout duration is dependent on system conditions, which should
14316be especially considered when specifying sub-second timeouts.
14317
14318   Exit status:
14319
14320     124 if COMMAND times out
14321     125 if ‘timeout’ itself fails
14322     126 if COMMAND is found but cannot be invoked
14323     127 if COMMAND cannot be found
14324     137 if COMMAND is sent the KILL(9) signal (128+9)
14325     the exit status of COMMAND otherwise
14326
14327
14328File: coreutils.info,  Node: Process control,  Next: Delaying,  Prev: Modified command invocation,  Up: Top
14329
1433024 Process control
14331******************
14332
14333* Menu:
14334
14335* kill invocation::             Sending a signal to processes.
14336
14337
14338File: coreutils.info,  Node: kill invocation,  Up: Process control
14339
1434024.1 ‘kill’: Send a signal to processes
14341=======================================
14342
14343The ‘kill’ command sends a signal to processes, causing them to
14344terminate or otherwise act upon receiving the signal in some way.
14345Alternatively, it lists information about signals.  Synopses:
14346
14347     kill [-s SIGNAL | --signal SIGNAL | -SIGNAL] PID...
14348     kill [-l | --list | -t | --table] [SIGNAL]...
14349
14350   Due to shell aliases and built-in ‘kill’ functions, using an
14351unadorned ‘kill’ interactively or in a script may get you different
14352functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
14353kill ...’) to avoid interference from the shell.
14354
14355   The first form of the ‘kill’ command sends a signal to all PID
14356arguments.  The default signal to send if none is specified is ‘TERM’.
14357The special signal number ‘0’ does not denote a valid signal, but can be
14358used to test whether the PID arguments specify processes to which a
14359signal could be sent.
14360
14361   If PID is positive, the signal is sent to the process with the
14362process ID PID.  If PID is zero, the signal is sent to all processes in
14363the process group of the current process.  If PID is −1, the signal is
14364sent to all processes for which the user has permission to send a
14365signal.  If PID is less than −1, the signal is sent to all processes in
14366the process group that equals the absolute value of PID.
14367
14368   If PID is not positive, a system-dependent set of system processes is
14369excluded from the list of processes to which the signal is sent.
14370
14371   If a negative PID argument is desired as the first one, it should be
14372preceded by ‘--’.  However, as a common extension to POSIX, ‘--’ is not
14373required with ‘kill -SIGNAL -PID’.  The following commands are
14374equivalent:
14375
14376     kill -15 -1
14377     kill -TERM -1
14378     kill -s TERM -- -1
14379     kill -- -1
14380
14381   The first form of the ‘kill’ command succeeds if every PID argument
14382specifies at least one process that the signal was sent to.
14383
14384   The second form of the ‘kill’ command lists signal information.
14385Either the ‘-l’ or ‘--list’ option, or the ‘-t’ or ‘--table’ option must
14386be specified.  Without any SIGNAL argument, all supported signals are
14387listed.  The output of ‘-l’ or ‘--list’ is a list of the signal names,
14388one per line; if SIGNAL is already a name, the signal number is printed
14389instead.  The output of ‘-t’ or ‘--table’ is a table of signal numbers,
14390names, and descriptions.  This form of the ‘kill’ command succeeds if
14391all SIGNAL arguments are valid and if there is no output error.
14392
14393   The ‘kill’ command also supports the ‘--help’ and ‘--version’
14394options.  *Note Common options::.
14395
14396   A SIGNAL may be a signal name like ‘HUP’, or a signal number like
14397‘1’, or an exit status of a process terminated by the signal.  A signal
14398name can be given in canonical form or prefixed by ‘SIG’.  The case of
14399the letters is ignored, except for the ‘-SIGNAL’ option which must use
14400upper case to avoid ambiguity with lower case option letters.  *Note
14401Signal specifications::, for a list of supported signal names and
14402numbers.
14403
14404
14405File: coreutils.info,  Node: Delaying,  Next: Numeric operations,  Prev: Process control,  Up: Top
14406
1440725 Delaying
14408***********
14409
14410* Menu:
14411
14412* sleep invocation::            Delay for a specified time.
14413
14414
14415File: coreutils.info,  Node: sleep invocation,  Up: Delaying
14416
1441725.1 ‘sleep’: Delay for a specified time
14418========================================
14419
14420‘sleep’ pauses for an amount of time specified by the sum of the values
14421of the command line arguments.  Synopsis:
14422
14423     sleep NUMBER[smhd]...
14424
14425   Each argument is a non-negative number followed by an optional unit;
14426the default is seconds.  The units are:
14427
14428‘s’
14429     seconds
14430‘m’
14431     minutes
14432‘h’
14433     hours
14434‘d’
14435     days
14436
14437   Although portable POSIX scripts must give ‘sleep’ a single
14438non-negative integer argument without a suffix, GNU ‘sleep’ also accepts
14439two or more arguments, unit suffixes, and floating-point numbers in
14440either the current or the C locale.  *Note Floating point::.
14441
14442   For instance, the following could be used to ‘sleep’ for 1 second,
14443234 milli-, 567 micro- and 890 nanoseconds:
14444
14445     sleep 1234e-3 567.89e-6
14446
14447   The only options are ‘--help’ and ‘--version’.  *Note Common
14448options::.
14449
14450   Due to shell aliases and built-in ‘sleep’ functions, using an
14451unadorned ‘sleep’ interactively or in a script may get you different
14452functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
14453sleep ...’) to avoid interference from the shell.
14454
14455   An exit status of zero indicates success, and a nonzero value
14456indicates failure.
14457
14458
14459File: coreutils.info,  Node: Numeric operations,  Next: File permissions,  Prev: Delaying,  Up: Top
14460
1446126 Numeric operations
14462*********************
14463
14464These programs do numerically-related operations.
14465
14466* Menu:
14467
14468* factor invocation::              Show factors of numbers.
14469* numfmt invocation::              Reformat numbers.
14470* seq invocation::                 Print sequences of numbers.
14471
14472
14473File: coreutils.info,  Node: factor invocation,  Next: numfmt invocation,  Up: Numeric operations
14474
1447526.1 ‘factor’: Print prime factors
14476==================================
14477
14478‘factor’ prints prime factors.  Synopses:
14479
14480     factor [NUMBER]...
14481     factor OPTION
14482
14483   If no NUMBER is specified on the command line, ‘factor’ reads numbers
14484from standard input, delimited by newlines, tabs, or spaces.
14485
14486   The ‘factor’ command supports only a small number of options:
14487
14488‘--help’
14489     Print a short help on standard output, then exit without further
14490     processing.
14491
14492‘--version’
14493     Print the program version on standard output, then exit without
14494     further processing.
14495
14496   Factoring the product of the eighth and ninth Mersenne primes takes
14497about 30 milliseconds of CPU time on a 2.2 GHz Athlon.
14498
14499     M8=$(echo 2^31-1|bc)
14500     M9=$(echo 2^61-1|bc)
14501     n=$(echo "$M8 * $M9" | bc)
14502     /usr/bin/time -f %U factor $n
14503     4951760154835678088235319297: 2147483647 2305843009213693951
14504     0.03
14505
14506   Similarly, factoring the eighth Fermat number 2^{256}+1 takes about
1450720 seconds on the same machine.
14508
14509   Factoring large numbers is, in general, hard.  The Pollard-Brent rho
14510algorithm used by ‘factor’ is particularly effective for numbers with
14511relatively small factors.  If you wish to factor large numbers which do
14512not have small factors (for example, numbers which are the product of
14513two large primes), other methods are far better.
14514
14515   If ‘factor’ is built without using GNU MP, only single-precision
14516arithmetic is available, and so large numbers (typically 2^{128} and
14517above) will not be supported.  The single-precision code uses an
14518algorithm which is designed for factoring smaller numbers.
14519
14520   An exit status of zero indicates success, and a nonzero value
14521indicates failure.
14522
14523
14524File: coreutils.info,  Node: numfmt invocation,  Next: seq invocation,  Prev: factor invocation,  Up: Numeric operations
14525
1452626.2 ‘numfmt’: Reformat numbers
14527===============================
14528
14529‘numfmt’ reads numbers in various representations and reformats them as
14530requested.  The most common usage is converting numbers to/from _human_
14531representation (e.g.  ‘4G’ ↦ ‘4,000,000,000’).
14532
14533     numfmt [OPTION]... [NUMBER]
14534
14535   ‘numfmt’ converts each NUMBER on the command-line according to the
14536specified options (see below).  If no NUMBERs are given, it reads
14537numbers from standard input.  ‘numfmt’ can optionally extract numbers
14538from specific columns, maintaining proper line padding and alignment.
14539
14540   An exit status of zero indicates success, and a nonzero value
14541indicates failure.
14542
14543   See ‘--invalid’ for additional information regarding exit status.
14544
1454526.2.1 General options
14546----------------------
14547
14548The program accepts the following options.  Also see *note Common
14549options::.
14550
14551‘--debug’
14552     Print (to standard error) warning messages about possible erroneous
14553     usage.
14554
14555‘-d D’
14556‘--delimiter=D’
14557     Use the character D as input field separator (default: whitespace).
14558     _Note_: Using non-default delimiter turns off automatic padding.
14559
14560‘--field=FIELDS’
14561     Convert the number in input field FIELDS (default: 1).  FIELDS
14562     supports ‘cut’ style field ranges:
14563
14564          N    N'th field, counted from 1
14565          N-   from N'th field, to end of line
14566          N-M  from N'th to M'th field (inclusive)
14567          -M   from first to M'th field (inclusive)
14568          -    all fields
14569
14570‘--format=FORMAT’
14571     Use printf-style floating FORMAT string.  The FORMAT string must
14572     contain one ‘%f’ directive, optionally with ‘'’, ‘-’, ‘0’, width or
14573     precision modifiers.  The ‘'’ modifier will enable ‘--grouping’,
14574     the ‘-’ modifier will enable left-aligned ‘--padding’ and the width
14575     modifier will enable right-aligned ‘--padding’.  The ‘0’ width
14576     modifier (without the ‘-’ modifier) will generate leading zeros on
14577     the number, up to the specified width.  A precision specification
14578     like ‘%.1f’ will override the precision determined from the input
14579     data or set due to ‘--to’ option auto scaling.
14580
14581‘--from=UNIT’
14582     Auto-scales input numbers according to UNIT.  See UNITS below.  The
14583     default is no scaling, meaning suffixes (e.g.  ‘M’, ‘G’) will
14584     trigger an error.
14585
14586‘--from-unit=N’
14587     Specify the input unit size (instead of the default 1).  Use this
14588     option when the input numbers represent other units (e.g.  if the
14589     input number ‘10’ represents 10 units of 512 bytes, use
14590     ‘--from-unit=512’).  Suffixes are handled as with ‘--from=auto’.
14591
14592‘--grouping’
14593     Group digits in output numbers according to the current locale’s
14594     grouping rules (e.g _Thousands Separator_ character, commonly ‘.’
14595     (dot) or ‘,’ comma).  This option has no effect in ‘POSIX/C’
14596     locale.
14597
14598‘--header[=N]’
14599     Print the first N (default: 1) lines without any conversion.
14600
14601‘--invalid=MODE’
14602     The default action on input errors is to exit immediately with
14603     status code 2.  ‘--invalid=‘abort’’ explicitly specifies this
14604     default mode.  With a MODE of ‘fail’, print a warning for _each_
14605     conversion error, and exit with status 2.  With a MODE of ‘warn’,
14606     exit with status 0, even in the presence of conversion errors, and
14607     with a MODE of ‘ignore’ do not even print diagnostics.
14608
14609‘--padding=N’
14610     Pad the output numbers to N characters, by adding spaces.  If N is
14611     a positive number, numbers will be right-aligned.  If N is a
14612     negative number, numbers will be left-aligned.  By default, numbers
14613     are automatically aligned based on the input line’s width (only
14614     with the default delimiter).
14615
14616‘--round=METHOD’
14617     When converting number representations, round the number according
14618     to METHOD, which can be ‘up’, ‘down’, ‘from-zero’ (the default),
14619     ‘towards-zero’, ‘nearest’.
14620
14621‘--suffix=SUFFIX’
14622     Add ‘SUFFIX’ to the output numbers, and accept optional ‘SUFFIX’ in
14623     input numbers.
14624
14625‘--to=UNIT’
14626     Auto-scales output numbers according to UNIT.  See _Units_ below.
14627     The default is no scaling, meaning all the digits of the number are
14628     printed.
14629
14630‘--to-unit=N’
14631     Specify the output unit size (instead of the default 1).  Use this
14632     option when the output numbers represent other units (e.g.  to
14633     represent ‘4,000,000’ bytes in blocks of 1KB, use ‘--to=si
14634     --to-unit=1000’).  Suffixes are handled as with ‘--from=auto’.
14635
14636‘-z’
14637‘--zero-terminated’
14638     Delimit items with a zero byte rather than a newline (ASCII LF).
14639     I.e., treat input as items separated by ASCII NUL and terminate
14640     output items with ASCII NUL. This option can be useful in
14641     conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
14642     do the same in order to reliably handle arbitrary file names (even
14643     those containing blanks or other special characters).  Note with
14644     ‘-z’ the newline character is treated as a field separator.
14645
1464626.2.2 Possible UNITs:
14647----------------------
14648
14649The following are the possible UNIT options with ‘--from=UNITS’ and
14650‘--to=UNITS’:
14651
14652NONE
14653     No scaling is performed.  For input numbers, no suffixes are
14654     accepted, and any trailing characters following the number will
14655     trigger an error.  For output numbers, all digits of the numbers
14656     will be printed.
14657
14658SI
14659     Auto-scale numbers according to the _International System of Units
14660     (SI)_ standard.  For input numbers, accept one of the following
14661     suffixes.  For output numbers, values larger than 1000 will be
14662     rounded, and printed with one of the following suffixes:
14663
14664          ‘K’  =>  1000^1 = 10^3 (Kilo)
14665          ‘M’  =>  1000^2 = 10^6 (Mega)
14666          ‘G’  =>  1000^3 = 10^9 (Giga)
14667          ‘T’  =>  1000^4 = 10^{12} (Tera)
14668          ‘P’  =>  1000^5 = 10^{15} (Peta)
14669          ‘E’  =>  1000^6 = 10^{18} (Exa)
14670          ‘Z’  =>  1000^7 = 10^{21} (Zetta)
14671          ‘Y’  =>  1000^8 = 10^{24} (Yotta)
14672
14673IEC
14674     Auto-scale numbers according to the _International Electrotechnical
14675     Commission (IEC)_ standard.  For input numbers, accept one of the
14676     following suffixes.  For output numbers, values larger than 1024
14677     will be rounded, and printed with one of the following suffixes:
14678
14679          ‘K’  =>  1024^1 = 2^{10} (Kibi)
14680          ‘M’  =>  1024^2 = 2^{20} (Mebi)
14681          ‘G’  =>  1024^3 = 2^{30} (Gibi)
14682          ‘T’  =>  1024^4 = 2^{40} (Tebi)
14683          ‘P’  =>  1024^5 = 2^{50} (Pebi)
14684          ‘E’  =>  1024^6 = 2^{60} (Exbi)
14685          ‘Z’  =>  1024^7 = 2^{70} (Zebi)
14686          ‘Y’  =>  1024^8 = 2^{80} (Yobi)
14687
14688     The ‘iec’ option uses a single letter suffix (e.g.  ‘G’), which is
14689     not fully standard, as the _iec_ standard recommends a two-letter
14690     symbol (e.g ‘Gi’) - but in practice, this method common.  Compare
14691     with the ‘iec-i’ option.
14692
14693IEC-I
14694     Auto-scale numbers according to the _International Electrotechnical
14695     Commission (IEC)_ standard.  For input numbers, accept one of the
14696     following suffixes.  For output numbers, values larger than 1024
14697     will be rounded, and printed with one of the following suffixes:
14698
14699          ‘Ki’  =>  1024^1 = 2^{10} (Kibi)
14700          ‘Mi’  =>  1024^2 = 2^{20} (Mebi)
14701          ‘Gi’  =>  1024^3 = 2^{30} (Gibi)
14702          ‘Ti’  =>  1024^4 = 2^{40} (Tebi)
14703          ‘Pi’  =>  1024^5 = 2^{50} (Pebi)
14704          ‘Ei’  =>  1024^6 = 2^{60} (Exbi)
14705          ‘Zi’  =>  1024^7 = 2^{70} (Zebi)
14706          ‘Yi’  =>  1024^8 = 2^{80} (Yobi)
14707
14708     The ‘iec-i’ option uses a two-letter suffix symbol (e.g.  ‘Gi’), as
14709     the _iec_ standard recommends, but this is not always common in
14710     practice.  Compare with the ‘iec’ option.
14711
14712AUTO
14713     ‘auto’ can only be used with ‘--from’.  With this method, numbers
14714     with ‘K’,‘M’,‘G’,‘T’,‘P’,‘E’,‘Z’,‘Y’ suffixes are interpreted as
14715     _SI_ values, and numbers with ‘Ki’,
14716     ‘Mi’,‘Gi’,‘Ti’,‘Pi’,‘Ei’,‘Zi’,‘Yi’ suffixes are interpreted as
14717     _IEC_ values.
14718
1471926.2.3 Examples of using ‘numfmt’
14720---------------------------------
14721
14722Converting a single number from/to _human_ representation:
14723     $ numfmt --to=si 500000
14724     500K
14725
14726     $ numfmt --to=iec 500000
14727     489K
14728
14729     $ numfmt --to=iec-i 500000
14730     489Ki
14731
14732     $ numfmt --from=si 1M
14733     1000000
14734
14735     $ numfmt --from=iec 1M
14736     1048576
14737
14738     # with '--from=auto', M=Mega, Mi=Mebi
14739     $ numfmt --from=auto 1M
14740     1000000
14741     $ numfmt --from=auto 1Mi
14742     1048576
14743
14744   Converting from ‘SI’ to ‘IEC’ scales (e.g.  when a harddisk capacity
14745is advertised as ‘1TB’, while checking the drive’s capacity gives lower
14746values):
14747
14748     $ numfmt --from=si --to=iec 1T
14749     932G
14750
14751   Converting a single field from an input file / piped input (these
14752contrived examples are for demonstration purposes only, as both ‘ls’ and
14753‘df’ support the ‘--human-readable’ option to output sizes in
14754human-readable format):
14755
14756     # Third field (file size) will be shown in SI representation
14757     $ ls -log | numfmt --field 3 --header --to=si | head -n4
14758     -rw-r--r--  1     94K Aug 23  2011 ABOUT-NLS
14759     -rw-r--r--  1    3.7K Jan  7 16:15 AUTHORS
14760     -rw-r--r--  1     36K Jun  1  2011 COPYING
14761     -rw-r--r--  1       0 Jan  7 15:15 ChangeLog
14762
14763     # Second field (size) will be shown in IEC representation
14764     $ df --block-size=1 | numfmt --field 2 --header --to=iec | head -n4
14765     File system   1B-blocks        Used  Available Use% Mounted on
14766     rootfs             132G   104741408   26554036  80% /
14767     tmpfs              794M        7580     804960   1% /run/shm
14768     /dev/sdb1          694G   651424756   46074696  94% /home
14769
14770   Output can be tweaked using ‘--padding’ or ‘--format’:
14771
14772     # Pad to 10 characters, right-aligned
14773     $ du -s * | numfmt --to=si --padding=10
14774           2.5K config.log
14775            108 config.status
14776           1.7K configure
14777             20 configure.ac
14778
14779     # Pad to 10 characters, left-aligned
14780     $ du -s * | numfmt --to=si --padding=-10
14781     2.5K       config.log
14782     108        config.status
14783     1.7K       configure
14784     20         configure.ac
14785
14786     # Pad to 10 characters, left-aligned, using 'format'
14787     $ du -s * | numfmt --to=si --format="%10f"
14788           2.5K config.log
14789            108 config.status
14790           1.7K configure
14791             20 configure.ac
14792
14793     # Pad to 10 characters, left-aligned, using 'format'
14794     $ du -s * | numfmt --to=si --padding="%-10f"
14795     2.5K       config.log
14796     108        config.status
14797     1.7K       configure
14798     20         configure.ac
14799
14800   With locales that support grouping digits, using ‘--grouping’ or
14801‘--format’ enables grouping.  In ‘POSIX’ locale, grouping is silently
14802ignored:
14803
14804     $ LC_ALL=C numfmt --from=iec --grouping 2G
14805     2147483648
14806
14807     $ LC_ALL=en_US.utf8 numfmt --from=iec --grouping 2G
14808     2,147,483,648
14809
14810     $ LC_ALL=ta_IN numfmt --from=iec --grouping 2G
14811     2,14,74,83,648
14812
14813     $ LC_ALL=C ./src/numfmt --from=iec --format="==%'15f==" 2G
14814     ==     2147483648==
14815
14816     $ LC_ALL=en_US.utf8 ./src/numfmt --from=iec --format="==%'15f==" 2G
14817     ==  2,147,483,648==
14818
14819     $ LC_ALL=en_US.utf8 ./src/numfmt --from=iec --format="==%'-15f==" 2G
14820     ==2,147,483,648  ==
14821
14822     $ LC_ALL=ta_IN ./src/numfmt --from=iec --format="==%'15f==" 2G
14823     == 2,14,74,83,648==
14824
14825
14826File: coreutils.info,  Node: seq invocation,  Prev: numfmt invocation,  Up: Numeric operations
14827
1482826.3 ‘seq’: Print numeric sequences
14829===================================
14830
14831‘seq’ prints a sequence of numbers to standard output.  Synopses:
14832
14833     seq [OPTION]... LAST
14834     seq [OPTION]... FIRST LAST
14835     seq [OPTION]... FIRST INCREMENT LAST
14836
14837   ‘seq’ prints the numbers from FIRST to LAST by INCREMENT.  By
14838default, each number is printed on a separate line.  When INCREMENT is
14839not specified, it defaults to ‘1’, even when FIRST is larger than LAST.
14840FIRST also defaults to ‘1’.  So ‘seq 1’ prints ‘1’, but ‘seq 0’ and ‘seq
1484110 5’ produce no output.  The sequence of numbers ends when the sum of
14842the current number and INCREMENT would become greater than LAST, so ‘seq
148431 10 10’ only produces ‘1’.  INCREMENT must not be ‘0’; use the tool
14844‘yes’ to get repeated output of a constant number.  FIRST, INCREMENT and
14845LAST must not be ‘NaN’.  Floating-point numbers may be specified in
14846either the current or the C locale.  *Note Floating point::.
14847
14848   The program accepts the following options.  Also see *note Common
14849options::.  Options must precede operands.
14850
14851‘-f FORMAT’
14852‘--format=FORMAT’
14853     Print all numbers using FORMAT.  FORMAT must contain exactly one of
14854     the ‘printf’-style floating point conversion specifications ‘%a’,
14855     ‘%e’, ‘%f’, ‘%g’, ‘%A’, ‘%E’, ‘%F’, ‘%G’.  The ‘%’ may be followed
14856     by zero or more flags taken from the set ‘-+#0 '’, then an optional
14857     width containing one or more digits, then an optional precision
14858     consisting of a ‘.’ followed by zero or more digits.  FORMAT may
14859     also contain any number of ‘%%’ conversion specifications.  All
14860     conversion specifications have the same meaning as with ‘printf’.
14861
14862     The default format is derived from FIRST, STEP, and LAST.  If these
14863     all use a fixed point decimal representation, the default format is
14864     ‘%.Pf’, where P is the minimum precision that can represent the
14865     output numbers exactly.  Otherwise, the default format is ‘%g’.
14866
14867‘-s STRING’
14868‘--separator=STRING’
14869     Separate numbers with STRING; default is a newline.  The output
14870     always terminates with a newline.
14871
14872‘-w’
14873‘--equal-width’
14874     Print all numbers with the same width, by padding with leading
14875     zeros.  FIRST, STEP, and LAST should all use a fixed point decimal
14876     representation.  (To have other kinds of padding, use ‘--format’).
14877
14878   You can get finer-grained control over output with ‘-f’:
14879
14880     $ seq -f '(%9.2E)' -9e5 1.1e6 1.3e6
14881     (-9.00E+05)
14882     ( 2.00E+05)
14883     ( 1.30E+06)
14884
14885   If you want hexadecimal integer output, you can use ‘printf’ to
14886perform the conversion:
14887
14888     $ printf '%x\n' $(seq 1048575 1024 1050623)
14889     fffff
14890     1003ff
14891     1007ff
14892
14893   For very long lists of numbers, use xargs to avoid system limitations
14894on the length of an argument list:
14895
14896     $ seq 1000000 | xargs printf '%x\n' | tail -n 3
14897     f423e
14898     f423f
14899     f4240
14900
14901   To generate octal output, use the printf ‘%o’ format instead of ‘%x’.
14902
14903   On most systems, seq can produce whole-number output for values up to
14904at least 2^{53}.  Larger integers are approximated.  The details differ
14905depending on your floating-point implementation.  *Note Floating
14906point::.  A common case is that ‘seq’ works with integers through
149072^{64}, and larger integers may not be numerically correct:
14908
14909     $ seq 50000000000000000000 2 50000000000000000004
14910     50000000000000000000
14911     50000000000000000000
14912     50000000000000000004
14913
14914   However, note that when limited to non-negative whole numbers, an
14915increment of 1 and no format-specifying option, seq can print
14916arbitrarily large numbers.
14917
14918   Be careful when using ‘seq’ with outlandish values: otherwise you may
14919see surprising results, as ‘seq’ uses floating point internally.  For
14920example, on the x86 platform, where the internal representation uses a
1492164-bit fraction, the command:
14922
14923     seq 1 0.0000000000000000001 1.0000000000000000009
14924
14925   outputs 1.0000000000000000007 twice and skips 1.0000000000000000008.
14926
14927   An exit status of zero indicates success, and a nonzero value
14928indicates failure.
14929
14930
14931File: coreutils.info,  Node: File permissions,  Next: File timestamps,  Prev: Numeric operations,  Up: Top
14932
1493327 File permissions
14934*******************
14935
14936Each file has a set of “file mode bits” that control the kinds of access
14937that users have to that file.  They can be represented either in
14938symbolic form or as an octal number.
14939
14940* Menu:
14941
14942* Mode Structure::              Structure of file mode bits.
14943* Symbolic Modes::              Mnemonic representation of file mode bits.
14944* Numeric Modes::               File mode bits as octal numbers.
14945* Operator Numeric Modes::      ANDing, ORing, and setting modes octally.
14946* Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories.
14947
14948
14949File: coreutils.info,  Node: Mode Structure,  Next: Symbolic Modes,  Up: File permissions
14950
1495127.1 Structure of File Mode Bits
14952================================
14953
14954The file mode bits have two parts: the “file permission bits”, which
14955control ordinary access to the file, and “special mode bits”, which
14956affect only some files.
14957
14958   There are three kinds of permissions that a user can have for a file:
14959
14960  1. permission to read the file.  For directories, this means
14961     permission to list the contents of the directory.
14962  2. permission to write to (change) the file.  For directories, this
14963     means permission to create and remove files in the directory.
14964  3. permission to execute the file (run it as a program).  For
14965     directories, this means permission to access files in the
14966     directory.
14967
14968   There are three categories of users who may have different
14969permissions to perform any of the above operations on a file:
14970
14971  1. the file’s owner;
14972  2. other users who are in the file’s group;
14973  3. everyone else.
14974
14975   Files are given an owner and group when they are created.  Usually
14976the owner is the current user and the group is the group of the
14977directory the file is in, but this varies with the operating system, the
14978file system the file is created on, and the way the file is created.
14979You can change the owner and group of a file by using the ‘chown’ and
14980‘chgrp’ commands.
14981
14982   In addition to the three sets of three permissions listed above, the
14983file mode bits have three special components, which affect only
14984executable files (programs) and, on most systems, directories:
14985
14986The “set-user-ID bit” (“setuid bit”).
14987     On execution, set the process’s effective user ID to that of the
14988     file.  For directories on a few systems, give files created in the
14989     directory the same owner as the directory, no matter who creates
14990     them, and set the set-user-ID bit of newly-created subdirectories.
14991
14992The “set-group-ID bit” (“setgid bit”).
14993     On execution, set the process’s effective group ID to that of the
14994     file.  For directories on most systems, give files created in the
14995     directory the same group as the directory, no matter what group the
14996     user who creates them is in, and set the set-group-ID bit of
14997     newly-created subdirectories.
14998
14999The “restricted deletion flag” or “sticky bit”.
15000     Prevent unprivileged users from removing or renaming a file in a
15001     directory unless they own the file or the directory; this is
15002     commonly found on world-writable directories like ‘/tmp’.  For
15003     regular files on some older systems, save the program’s text image
15004     on the swap device so it will load more quickly when run, so that
15005     the image is “sticky”.
15006
15007   In addition to the file mode bits listed above, there may be file
15008attributes specific to the file system, e.g., access control lists
15009(ACLs), whether a file is compressed, whether a file can be modified
15010(immutability), and whether a file can be dumped.  These are usually set
15011using programs specific to the file system.  For example:
15012
15013ext2
15014     On GNU and GNU/Linux the file attributes specific to the ext2 file
15015     system are set using ‘chattr’.
15016
15017FFS
15018     On FreeBSD the file flags specific to the FFS file system are set
15019     using ‘chflags’.
15020
15021   Even if a file’s mode bits allow an operation on that file, that
15022operation may still fail, because:
15023
15024   • the file-system-specific attributes or flags do not permit it; or
15025
15026   • the file system is mounted as read-only.
15027
15028   For example, if the immutable attribute is set on a file, it cannot
15029be modified, regardless of the fact that you may have just run ‘chmod
15030a+w FILE’.
15031
15032
15033File: coreutils.info,  Node: Symbolic Modes,  Next: Numeric Modes,  Prev: Mode Structure,  Up: File permissions
15034
1503527.2 Symbolic Modes
15036===================
15037
15038“Symbolic modes” represent changes to files’ mode bits as operations on
15039single-character symbols.  They allow you to modify either all or
15040selected parts of files’ mode bits, optionally based on their previous
15041values, and perhaps on the current ‘umask’ as well (*note Umask and
15042Protection::).
15043
15044   The format of symbolic modes is:
15045
15046     [ugoa...][-+=]PERMS...[,...]
15047
15048where PERMS is either zero or more letters from the set ‘rwxXst’, or a
15049single letter from the set ‘ugo’.
15050
15051   The following sections describe the operators and other details of
15052symbolic modes.
15053
15054* Menu:
15055
15056* Setting Permissions::          Basic operations on permissions.
15057* Copying Permissions::          Copying existing permissions.
15058* Changing Special Mode Bits::   Special mode bits.
15059* Conditional Executability::    Conditionally affecting executability.
15060* Multiple Changes::             Making multiple changes.
15061* Umask and Protection::              The effect of the umask.
15062
15063
15064File: coreutils.info,  Node: Setting Permissions,  Next: Copying Permissions,  Up: Symbolic Modes
15065
1506627.2.1 Setting Permissions
15067--------------------------
15068
15069The basic symbolic operations on a file’s permissions are adding,
15070removing, and setting the permission that certain users have to read,
15071write, and execute or search the file.  These operations have the
15072following format:
15073
15074     USERS OPERATION PERMISSIONS
15075
15076The spaces between the three parts above are shown for readability only;
15077symbolic modes cannot contain spaces.
15078
15079   The USERS part tells which users’ access to the file is changed.  It
15080consists of one or more of the following letters (or it can be empty;
15081*note Umask and Protection::, for a description of what happens then).
15082When more than one of these letters is given, the order that they are in
15083does not matter.
15084
15085‘u’
15086     the user who owns the file;
15087‘g’
15088     other users who are in the file’s group;
15089‘o’
15090     all other users;
15091‘a’
15092     all users; the same as ‘ugo’.
15093
15094   The OPERATION part tells how to change the affected users’ access to
15095the file, and is one of the following symbols:
15096
15097‘+’
15098     to add the PERMISSIONS to whatever permissions the USERS already
15099     have for the file;
15100‘-’
15101     to remove the PERMISSIONS from whatever permissions the USERS
15102     already have for the file;
15103‘=’
15104     to make the PERMISSIONS the only permissions that the USERS have
15105     for the file.
15106
15107   The PERMISSIONS part tells what kind of access to the file should be
15108changed; it is normally zero or more of the following letters.  As with
15109the USERS part, the order does not matter when more than one letter is
15110given.  Omitting the PERMISSIONS part is useful only with the ‘=’
15111operation, where it gives the specified USERS no access at all to the
15112file.
15113
15114‘r’
15115     the permission the USERS have to read the file;
15116‘w’
15117     the permission the USERS have to write to the file;
15118‘x’
15119     the permission the USERS have to execute the file, or search it if
15120     it is a directory.
15121
15122   For example, to give everyone permission to read and write a regular
15123file, but not to execute it, use:
15124
15125     a=rw
15126
15127   To remove write permission for all users other than the file’s owner,
15128use:
15129
15130     go-w
15131
15132The above command does not affect the access that the owner of the file
15133has to it, nor does it affect whether other users can read or execute
15134the file.
15135
15136   To give everyone except a file’s owner no permission to do anything
15137with that file, use the mode below.  Other users could still remove the
15138file, if they have write permission on the directory it is in.
15139
15140     go=
15141
15142Another way to specify the same thing is:
15143
15144     og-rwx
15145
15146
15147File: coreutils.info,  Node: Copying Permissions,  Next: Changing Special Mode Bits,  Prev: Setting Permissions,  Up: Symbolic Modes
15148
1514927.2.2 Copying Existing Permissions
15150-----------------------------------
15151
15152You can base a file’s permissions on its existing permissions.  To do
15153this, instead of using a series of ‘r’, ‘w’, or ‘x’ letters after the
15154operator, you use the letter ‘u’, ‘g’, or ‘o’.  For example, the mode
15155
15156     o+g
15157
15158adds the permissions for users who are in a file’s group to the
15159permissions that other users have for the file.  Thus, if the file
15160started out as mode 664 (‘rw-rw-r--’), the above mode would change it to
15161mode 666 (‘rw-rw-rw-’).  If the file had started out as mode 741
15162(‘rwxr----x’), the above mode would change it to mode 745 (‘rwxr--r-x’).
15163The ‘-’ and ‘=’ operations work analogously.
15164
15165
15166File: coreutils.info,  Node: Changing Special Mode Bits,  Next: Conditional Executability,  Prev: Copying Permissions,  Up: Symbolic Modes
15167
1516827.2.3 Changing Special Mode Bits
15169---------------------------------
15170
15171In addition to changing a file’s read, write, and execute/search
15172permissions, you can change its special mode bits.  *Note Mode
15173Structure::, for a summary of these special mode bits.
15174
15175   To change the file mode bits to set the user ID on execution, use ‘u’
15176in the USERS part of the symbolic mode and ‘s’ in the PERMISSIONS part.
15177
15178   To change the file mode bits to set the group ID on execution, use
15179‘g’ in the USERS part of the symbolic mode and ‘s’ in the PERMISSIONS
15180part.
15181
15182   To set both user and group ID on execution, omit the USERS part of
15183the symbolic mode (or use ‘a’) and use ‘s’ in the PERMISSIONS part.
15184
15185   To change the file mode bits to set the restricted deletion flag or
15186sticky bit, omit the USERS part of the symbolic mode (or use ‘a’) and
15187use ‘t’ in the PERMISSIONS part.
15188
15189   For example, to set the set-user-ID mode bit of a program, you can
15190use the mode:
15191
15192     u+s
15193
15194   To remove both set-user-ID and set-group-ID mode bits from it, you
15195can use the mode:
15196
15197     a-s
15198
15199   To set the restricted deletion flag or sticky bit, you can use the
15200mode:
15201
15202     +t
15203
15204   The combination ‘o+s’ has no effect.  On GNU systems the combinations
15205‘u+t’ and ‘g+t’ have no effect, and ‘o+t’ acts like plain ‘+t’.
15206
15207   The ‘=’ operator is not very useful with special mode bits.  For
15208example, the mode:
15209
15210     o=t
15211
15212does set the restricted deletion flag or sticky bit, but it also removes
15213all read, write, and execute/search permissions that users not in the
15214file’s group might have had for it.
15215
15216   *Note Directory Setuid and Setgid::, for additional rules concerning
15217set-user-ID and set-group-ID bits and directories.
15218
15219
15220File: coreutils.info,  Node: Conditional Executability,  Next: Multiple Changes,  Prev: Changing Special Mode Bits,  Up: Symbolic Modes
15221
1522227.2.4 Conditional Executability
15223--------------------------------
15224
15225There is one more special type of symbolic permission: if you use ‘X’
15226instead of ‘x’, execute/search permission is affected only if the file
15227is a directory or already had execute permission.
15228
15229   For example, this mode:
15230
15231     a+X
15232
15233gives all users permission to search directories, or to execute files if
15234anyone could execute them before.
15235
15236
15237File: coreutils.info,  Node: Multiple Changes,  Next: Umask and Protection,  Prev: Conditional Executability,  Up: Symbolic Modes
15238
1523927.2.5 Making Multiple Changes
15240------------------------------
15241
15242The format of symbolic modes is actually more complex than described
15243above (*note Setting Permissions::).  It provides two ways to make
15244multiple changes to files’ mode bits.
15245
15246   The first way is to specify multiple OPERATION and PERMISSIONS parts
15247after a USERS part in the symbolic mode.
15248
15249   For example, the mode:
15250
15251     og+rX-w
15252
15253gives users other than the owner of the file read permission and, if it
15254is a directory or if someone already had execute permission to it, gives
15255them execute/search permission; and it also denies them write permission
15256to the file.  It does not affect the permission that the owner of the
15257file has for it.  The above mode is equivalent to the two modes:
15258
15259     og+rX
15260     og-w
15261
15262   The second way to make multiple changes is to specify more than one
15263simple symbolic mode, separated by commas.  For example, the mode:
15264
15265     a+r,go-w
15266
15267gives everyone permission to read the file and removes write permission
15268on it for all users except its owner.  Another example:
15269
15270     u=rwx,g=rx,o=
15271
15272sets all of the permission bits for the file explicitly.  (It gives
15273users who are not in the file’s group no permission at all for it.)
15274
15275   The two methods can be combined.  The mode:
15276
15277     a+r,g+x-w
15278
15279gives all users permission to read the file, and gives users who are in
15280the file’s group permission to execute/search it as well, but not
15281permission to write to it.  The above mode could be written in several
15282different ways; another is:
15283
15284     u+r,g+rx,o+r,g-w
15285
15286
15287File: coreutils.info,  Node: Umask and Protection,  Prev: Multiple Changes,  Up: Symbolic Modes
15288
1528927.2.6 The Umask and Protection
15290-------------------------------
15291
15292If the USERS part of a symbolic mode is omitted, it defaults to ‘a’
15293(affect all users), except that any permissions that are _set_ in the
15294system variable ‘umask’ are _not affected_.  The value of ‘umask’ can be
15295set using the ‘umask’ command.  Its default value varies from system to
15296system.
15297
15298   Omitting the USERS part of a symbolic mode is generally not useful
15299with operations other than ‘+’.  It is useful with ‘+’ because it allows
15300you to use ‘umask’ as an easily customizable protection against giving
15301away more permission to files than you intended to.
15302
15303   As an example, if ‘umask’ has the value 2, which removes write
15304permission for users who are not in the file’s group, then the mode:
15305
15306     +w
15307
15308adds permission to write to the file to its owner and to other users who
15309are in the file’s group, but _not_ to other users.  In contrast, the
15310mode:
15311
15312     a+w
15313
15314ignores ‘umask’, and _does_ give write permission for the file to all
15315users.
15316
15317
15318File: coreutils.info,  Node: Numeric Modes,  Next: Operator Numeric Modes,  Prev: Symbolic Modes,  Up: File permissions
15319
1532027.3 Numeric Modes
15321==================
15322
15323As an alternative to giving a symbolic mode, you can give an octal (base
153248) number that represents the mode.
15325
15326   The permissions granted to the user, to other users in the file’s
15327group, and to other users not in the file’s group each require three
15328bits: one bit for read, one for write, and one for execute/search
15329permission.  These three bits are represented as one octal digit; for
15330example, if all three are present, the resulting 111 (in binary) is
15331represented as the digit 7 (in octal).  The three special mode bits also
15332require one bit each, and they are as a group represented as another
15333octal digit.  Here is how the bits are arranged, starting with the
15334highest valued bit:
15335
15336     Value in  Corresponding
15337     Mode      Mode Bit
15338
15339               Special mode bits:
15340     4000      Set user ID
15341     2000      Set group ID
15342     1000      Restricted deletion flag or sticky bit
15343
15344               The file's owner:
15345      400      Read
15346      200      Write
15347      100      Execute/search
15348
15349               Other users in the file's group:
15350       40      Read
15351       20      Write
15352       10      Execute/search
15353
15354               Other users not in the file's group:
15355        4      Read
15356        2      Write
15357        1      Execute/search
15358
15359   For example, numeric mode ‘4751’ corresponds to symbolic mode
15360‘u=srwx,g=rx,o=x’, and numeric mode ‘664’ corresponds to symbolic mode
15361‘ug=rw,o=r’.  Numeric mode ‘0’ corresponds to symbolic mode ‘a=’.
15362
15363   A numeric mode is usually shorter than the corresponding symbolic
15364mode, but it is limited in that normally it cannot take into account the
15365previous file mode bits; it can only set them absolutely.  The
15366set-user-ID and set-group-ID bits of directories are an exception to
15367this general limitation.  *Note Directory Setuid and Setgid::.  Also,
15368operator numeric modes can take previous file mode bits into account.
15369*Note Operator Numeric Modes::.
15370
15371   Numeric modes are always interpreted in octal; you do not have to add
15372a leading ‘0’, as you do in C.  Mode ‘0055’ is the same as mode ‘55’.
15373However, modes of five digits or more, such as ‘00055’, are sometimes
15374special (*note Directory Setuid and Setgid::).
15375
15376
15377File: coreutils.info,  Node: Operator Numeric Modes,  Next: Directory Setuid and Setgid,  Prev: Numeric Modes,  Up: File permissions
15378
1537927.4 Operator Numeric Modes
15380===========================
15381
15382An operator numeric mode is a numeric mode that is prefixed by a ‘-’,
15383‘+’, or ‘=’ operator, which has the same interpretation as in symbolic
15384modes.  For example, ‘+440’ enables read permission for the file’s owner
15385and group, ‘-1’ disables execute permission for other users, and ‘=600’
15386clears all permissions except for enabling read-write permissions for
15387the file’s owner.  Operator numeric modes can be combined with symbolic
15388modes by separating them with a comma; for example, ‘=0,u+r’ clears all
15389permissions except for enabling read permission for the file’s owner.
15390
15391   The commands ‘chmod =755 DIR’ and ‘chmod 755 DIR’ differ in that the
15392former clears the directory DIR’s setuid and setgid bits, whereas the
15393latter preserves them.  *Note Directory Setuid and Setgid::.
15394
15395   Operator numeric modes are a GNU extension.
15396
15397
15398File: coreutils.info,  Node: Directory Setuid and Setgid,  Prev: Operator Numeric Modes,  Up: File permissions
15399
1540027.5 Directories and the Set-User-ID and Set-Group-ID Bits
15401==========================================================
15402
15403On most systems, if a directory’s set-group-ID bit is set, newly created
15404subfiles inherit the same group as the directory, and newly created
15405subdirectories inherit the set-group-ID bit of the parent directory.  On
15406a few systems, a directory’s set-user-ID bit has a similar effect on the
15407ownership of new subfiles and the set-user-ID bits of new
15408subdirectories.  These mechanisms let users share files more easily, by
15409lessening the need to use ‘chmod’ or ‘chown’ to share new files.
15410
15411   These convenience mechanisms rely on the set-user-ID and set-group-ID
15412bits of directories.  If commands like ‘chmod’ and ‘mkdir’ routinely
15413cleared these bits on directories, the mechanisms would be less
15414convenient and it would be harder to share files.  Therefore, a command
15415like ‘chmod’ does not affect the set-user-ID or set-group-ID bits of a
15416directory unless the user specifically mentions them in a symbolic mode,
15417or uses an operator numeric mode such as ‘=755’, or sets them in a
15418numeric mode, or clears them in a numeric mode that has five or more
15419octal digits.  For example, on systems that support set-group-ID
15420inheritance:
15421
15422     # These commands leave the set-user-ID and
15423     # set-group-ID bits of the subdirectories alone,
15424     # so that they retain their default values.
15425     mkdir A B C
15426     chmod 755 A
15427     chmod 0755 B
15428     chmod u=rwx,go=rx C
15429     mkdir -m 755 D
15430     mkdir -m 0755 E
15431     mkdir -m u=rwx,go=rx F
15432
15433   If you want to try to set these bits, you must mention them
15434explicitly in the symbolic or numeric modes, e.g.:
15435
15436     # These commands try to set the set-user-ID
15437     # and set-group-ID bits of the subdirectories.
15438     mkdir G
15439     chmod 6755 G
15440     chmod +6000 G
15441     chmod u=rwx,go=rx,a+s G
15442     mkdir -m 6755 H
15443     mkdir -m +6000 I
15444     mkdir -m u=rwx,go=rx,a+s J
15445
15446   If you want to try to clear these bits, you must mention them
15447explicitly in a symbolic mode, or use an operator numeric mode, or
15448specify a numeric mode with five or more octal digits, e.g.:
15449
15450     # These commands try to clear the set-user-ID
15451     # and set-group-ID bits of the directory D.
15452     chmod a-s D
15453     chmod -6000 D
15454     chmod =755 D
15455     chmod 00755 D
15456
15457   This behavior is a GNU extension.  Portable scripts should not rely
15458on requests to set or clear these bits on directories, as POSIX allows
15459implementations to ignore these requests.  The GNU behavior with numeric
15460modes of four or fewer digits is intended for scripts portable to
15461systems that preserve these bits; the behavior with numeric modes of
15462five or more digits is for scripts portable to systems that do not
15463preserve the bits.
15464
15465
15466File: coreutils.info,  Node: File timestamps,  Next: Date input formats,  Prev: File permissions,  Up: Top
15467
1546828 File timestamps
15469******************
15470
15471Standard POSIX files have three timestamps: the access timestamp (atime)
15472of the last read, the modification timestamp (mtime) of the last write,
15473and the status change timestamp (ctime) of the last change to the file’s
15474meta-information.  Some file systems support a fourth time: the birth
15475timestamp (birthtime) of when the file was created; by definition,
15476birthtime never changes.
15477
15478   One common example of a ctime change is when the permissions of a
15479file change.  Changing the permissions doesn’t access the file, so atime
15480doesn’t change, nor does it modify the file, so the mtime doesn’t
15481change.  Yet, something about the file itself has changed, and this must
15482be noted somewhere.  This is the job of the ctime field.  This is
15483necessary, so that, for example, a backup program can make a fresh copy
15484of the file, including the new permissions value.  Another operation
15485that modifies a file’s ctime without affecting the others is renaming.
15486
15487   Naively, a file’s atime, mtime, and ctime are set to the current time
15488whenever you read, write, or change the attributes of the file
15489respectively, and searching a directory counts as reading it.  A file’s
15490atime and mtime can also be set directly, via the ‘touch’ command (*note
15491touch invocation::).  In practice, though, timestamps are not updated
15492quite that way.
15493
15494   For efficiency reasons, many systems are lazy about updating atimes:
15495when a program accesses a file, they may delay updating the file’s
15496atime, or may not update the file’s atime if the file has been accessed
15497recently, or may not update the atime at all.  Similar laziness, though
15498typically not quite so extreme, applies to mtimes and ctimes.
15499
15500   Some systems emulate timestamps instead of supporting them directly,
15501and these emulations may disagree with the naive interpretation.  For
15502example, a system may fake an atime or ctime by using the mtime.
15503
15504   The determination of what time is “current” depends on the platform.
15505Platforms with network file systems often use different clocks for the
15506operating system and for file systems; because updates typically uses
15507file systems’ clocks by default, clock skew can cause the resulting file
15508timestamps to appear to be in a program’s “future” or “past”.
15509
15510   When the system updates a file timestamp to a desired time T (which
15511is either the current time, or a time specified via the ‘touch’
15512command), there are several reasons the file’s timestamp may be set to a
15513value that differs from T.  First, T may have a higher resolution than
15514supported.  Second, a file system may use different resolutions for
15515different types of times.  Third, file timestamps may use a different
15516resolution than operating system timestamps.  Fourth, the operating
15517system primitives used to update timestamps may employ yet a different
15518resolution.  For example, in theory a file system might use
1551910-microsecond resolution for access timestamp and 100-nanosecond
15520resolution for modification timestamp, and the operating system might
15521use nanosecond resolution for the current time and microsecond
15522resolution for the primitive that ‘touch’ uses to set a file’s timestamp
15523to an arbitrary value.
15524
15525
15526File: coreutils.info,  Node: Date input formats,  Next: Version sort ordering,  Prev: File timestamps,  Up: Top
15527
1552829 Date input formats
15529*********************
15530
15531First, a quote:
15532
15533     Our units of temporal measurement, from seconds on up to months,
15534     are so complicated, asymmetrical and disjunctive so as to make
15535     coherent mental reckoning in time all but impossible.  Indeed, had
15536     some tyrannical god contrived to enslave our minds to time, to make
15537     it all but impossible for us to escape subjection to sodden
15538     routines and unpleasant surprises, he could hardly have done better
15539     than handing down our present system.  It is like a set of
15540     trapezoidal building blocks, with no vertical or horizontal
15541     surfaces, like a language in which the simplest thought demands
15542     ornate constructions, useless particles and lengthy
15543     circumlocutions.  Unlike the more successful patterns of language
15544     and science, which enable us to face experience boldly or at least
15545     level-headedly, our system of temporal calculation silently and
15546     persistently encourages our terror of time.
15547
15548     ... It is as though architects had to measure length in feet, width
15549     in meters and height in ells; as though basic instruction manuals
15550     demanded a knowledge of five different languages.  It is no wonder
15551     then that we often look into our own immediate past or future, last
15552     Tuesday or a week from Sunday, with feelings of helpless confusion.
15553     ...
15554
15555     —Robert Grudin, ‘Time and the Art of Living’.
15556
15557   This section describes the textual date representations that GNU
15558programs accept.  These are the strings you, as a user, can supply as
15559arguments to the various programs.  The C interface (via the
15560‘parse_datetime’ function) is not described here.
15561
15562* Menu:
15563
15564* General date syntax::            Common rules.
15565* Calendar date items::            19 Dec 1994.
15566* Time of day items::              9:20pm.
15567* Time zone items::                EST, PDT, UTC, ...
15568* Combined date and time of day items:: 1972-09-24T20:02:00,000000-0500.
15569* Day of week items::              Monday and others.
15570* Relative items in date strings:: next tuesday, 2 years ago.
15571* Pure numbers in date strings::   19931219, 1440.
15572* Seconds since the Epoch::        @1078100502.
15573* Specifying time zone rules::     TZ="America/New_York", TZ="UTC0".
15574* Authors of parse_datetime::      Bellovin, Eggert, Salz, Berets, et al.
15575
15576
15577File: coreutils.info,  Node: General date syntax,  Next: Calendar date items,  Up: Date input formats
15578
1557929.1 General date syntax
15580========================
15581
15582A “date” is a string, possibly empty, containing many items separated by
15583whitespace.  The whitespace may be omitted when no ambiguity arises.
15584The empty string means the beginning of today (i.e., midnight).  Order
15585of the items is immaterial.  A date string may contain many flavors of
15586items:
15587
15588   • calendar date items
15589   • time of day items
15590   • time zone items
15591   • combined date and time of day items
15592   • day of the week items
15593   • relative items
15594   • pure numbers.
15595
15596We describe each of these item types in turn, below.
15597
15598   A few ordinal numbers may be written out in words in some contexts.
15599This is most useful for specifying day of the week items or relative
15600items (see below).  Among the most commonly used ordinal numbers, the
15601word ‘last’ stands for -1, ‘this’ stands for 0, and ‘first’ and ‘next’
15602both stand for 1.  Because the word ‘second’ stands for the unit of time
15603there is no way to write the ordinal number 2, but for convenience
15604‘third’ stands for 3, ‘fourth’ for 4, ‘fifth’ for 5, ‘sixth’ for 6,
15605‘seventh’ for 7, ‘eighth’ for 8, ‘ninth’ for 9, ‘tenth’ for 10,
15606‘eleventh’ for 11 and ‘twelfth’ for 12.
15607
15608   When a month is written this way, it is still considered to be
15609written numerically, instead of being “spelled in full”; this changes
15610the allowed strings.
15611
15612   In the current implementation, only English is supported for words
15613and abbreviations like ‘AM’, ‘DST’, ‘EST’, ‘first’, ‘January’, ‘Sunday’,
15614‘tomorrow’, and ‘year’.
15615
15616   The output of the ‘date’ command is not always acceptable as a date
15617string, not only because of the language problem, but also because there
15618is no standard meaning for time zone items like ‘IST’.  When using
15619‘date’ to generate a date string intended to be parsed later, specify a
15620date format that is independent of language and that does not use time
15621zone items other than ‘UTC’ and ‘Z’.  Here are some ways to do this:
15622
15623     $ LC_ALL=C TZ=UTC0 date
15624     Mon Mar  1 00:21:42 UTC 2004
15625     $ TZ=UTC0 date +'%Y-%m-%d %H:%M:%SZ'
15626     2004-03-01 00:21:42Z
15627     $ date --rfc-3339=ns  # --rfc-3339 is a GNU extension.
15628     2004-02-29 16:21:42.692722128-08:00
15629     $ date --rfc-2822  # a GNU extension
15630     Sun, 29 Feb 2004 16:21:42 -0800
15631     $ date +'%Y-%m-%d %H:%M:%S %z'  # %z is a GNU extension.
15632     2004-02-29 16:21:42 -0800
15633     $ date +'@%s.%N'  # %s and %N are GNU extensions.
15634     @1078100502.692722128
15635
15636   Alphabetic case is completely ignored in dates.  Comments may be
15637introduced between round parentheses, as long as included parentheses
15638are properly nested.  Hyphens not followed by a digit are currently
15639ignored.  Leading zeros on numbers are ignored.
15640
15641   Invalid dates like ‘2005-02-29’ or times like ‘24:00’ are rejected.
15642In the typical case of a host that does not support leap seconds, a time
15643like ‘23:59:60’ is rejected even if it corresponds to a valid leap
15644second.
15645
15646
15647File: coreutils.info,  Node: Calendar date items,  Next: Time of day items,  Prev: General date syntax,  Up: Date input formats
15648
1564929.2 Calendar date items
15650========================
15651
15652A “calendar date item” specifies a day of the year.  It is specified
15653differently, depending on whether the month is specified numerically or
15654literally.  All these strings specify the same calendar date:
15655
15656     1972-09-24     # ISO 8601.
15657     72-9-24        # Assume 19xx for 69 through 99,
15658                    # 20xx for 00 through 68.
15659     72-09-24       # Leading zeros are ignored.
15660     9/24/72        # Common U.S. writing.
15661     24 September 1972
15662     24 Sept 72     # September has a special abbreviation.
15663     24 Sep 72      # Three-letter abbreviations always allowed.
15664     Sep 24, 1972
15665     24-sep-72
15666     24sep72
15667
15668   The year can also be omitted.  In this case, the last specified year
15669is used, or the current year if none.  For example:
15670
15671     9/24
15672     sep 24
15673
15674   Here are the rules.
15675
15676   For numeric months, the ISO 8601 format ‘YEAR-MONTH-DAY’ is allowed,
15677where YEAR is any positive number, MONTH is a number between 01 and 12,
15678and DAY is a number between 01 and 31.  A leading zero must be present
15679if a number is less than ten.  If YEAR is 68 or smaller, then 2000 is
15680added to it; otherwise, if YEAR is less than 100, then 1900 is added to
15681it.  The construct ‘MONTH/DAY/YEAR’, popular in the United States, is
15682accepted.  Also ‘MONTH/DAY’, omitting the year.
15683
15684   Literal months may be spelled out in full: ‘January’, ‘February’,
15685‘March’, ‘April’, ‘May’, ‘June’, ‘July’, ‘August’, ‘September’,
15686‘October’, ‘November’ or ‘December’.  Literal months may be abbreviated
15687to their first three letters, possibly followed by an abbreviating dot.
15688It is also permitted to write ‘Sept’ instead of ‘September’.
15689
15690   When months are written literally, the calendar date may be given as
15691any of the following:
15692
15693     DAY MONTH YEAR
15694     DAY MONTH
15695     MONTH DAY YEAR
15696     DAY-MONTH-YEAR
15697
15698   Or, omitting the year:
15699
15700     MONTH DAY
15701
15702
15703File: coreutils.info,  Node: Time of day items,  Next: Time zone items,  Prev: Calendar date items,  Up: Date input formats
15704
1570529.3 Time of day items
15706======================
15707
15708A “time of day item” in date strings specifies the time on a given day.
15709Here are some examples, all of which represent the same time:
15710
15711     20:02:00.000000
15712     20:02
15713     8:02pm
15714     20:02-0500      # In EST (U.S. Eastern Standard Time).
15715
15716   More generally, the time of day may be given as ‘HOUR:MINUTE:SECOND’,
15717where HOUR is a number between 0 and 23, MINUTE is a number between 0
15718and 59, and SECOND is a number between 0 and 59 possibly followed by ‘.’
15719or ‘,’ and a fraction containing one or more digits.  Alternatively,
15720‘:SECOND’ can be omitted, in which case it is taken to be zero.  On the
15721rare hosts that support leap seconds, SECOND may be 60.
15722
15723   If the time is followed by ‘am’ or ‘pm’ (or ‘a.m.’ or ‘p.m.’), HOUR
15724is restricted to run from 1 to 12, and ‘:MINUTE’ may be omitted (taken
15725to be zero).  ‘am’ indicates the first half of the day, ‘pm’ indicates
15726the second half of the day.  In this notation, 12 is the predecessor of
157271: midnight is ‘12am’ while noon is ‘12pm’.  (This is the zero-oriented
15728interpretation of ‘12am’ and ‘12pm’, as opposed to the old tradition
15729derived from Latin which uses ‘12m’ for noon and ‘12pm’ for midnight.)
15730
15731   The time may alternatively be followed by a time zone correction,
15732expressed as ‘SHHMM’, where S is ‘+’ or ‘-’, HH is a number of zone
15733hours and MM is a number of zone minutes.  The zone minutes term, MM,
15734may be omitted, in which case the one- or two-digit correction is
15735interpreted as a number of hours.  You can also separate HH from MM with
15736a colon.  When a time zone correction is given this way, it forces
15737interpretation of the time relative to Coordinated Universal Time (UTC),
15738overriding any previous specification for the time zone or the local
15739time zone.  For example, ‘+0530’ and ‘+05:30’ both stand for the time
15740zone 5.5 hours ahead of UTC (e.g., India).  This is the best way to
15741specify a time zone correction by fractional parts of an hour.  The
15742maximum zone correction is 24 hours.
15743
15744   Either ‘am’/‘pm’ or a time zone correction may be specified, but not
15745both.
15746
15747
15748File: coreutils.info,  Node: Time zone items,  Next: Combined date and time of day items,  Prev: Time of day items,  Up: Date input formats
15749
1575029.4 Time zone items
15751====================
15752
15753A “time zone item” specifies an international time zone, indicated by a
15754small set of letters, e.g., ‘UTC’ or ‘Z’ for Coordinated Universal Time.
15755Any included periods are ignored.  By following a non-daylight-saving
15756time zone by the string ‘DST’ in a separate word (that is, separated by
15757some white space), the corresponding daylight saving time zone may be
15758specified.  Alternatively, a non-daylight-saving time zone can be
15759followed by a time zone correction, to add the two values.  This is
15760normally done only for ‘UTC’; for example, ‘UTC+05:30’ is equivalent to
15761‘+05:30’.
15762
15763   Time zone items other than ‘UTC’ and ‘Z’ are obsolescent and are not
15764recommended, because they are ambiguous; for example, ‘EST’ has a
15765different meaning in Australia than in the United States, and ‘A’ has
15766different meaning as a military time zone than as an obsolescent RFC 822
15767time zone.  Instead, it’s better to use unambiguous numeric time zone
15768corrections like ‘-0500’, as described in the previous section.
15769
15770   If neither a time zone item nor a time zone correction is supplied,
15771timestamps are interpreted using the rules of the default time zone
15772(*note Specifying time zone rules::).
15773
15774
15775File: coreutils.info,  Node: Combined date and time of day items,  Next: Day of week items,  Prev: Time zone items,  Up: Date input formats
15776
1577729.5 Combined date and time of day items
15778========================================
15779
15780The ISO 8601 date and time of day extended format consists of an ISO
157818601 date, a ‘T’ character separator, and an ISO 8601 time of day.  This
15782format is also recognized if the ‘T’ is replaced by a space.
15783
15784   In this format, the time of day should use 24-hour notation.
15785Fractional seconds are allowed, with either comma or period preceding
15786the fraction.  ISO 8601 fractional minutes and hours are not supported.
15787Typically, hosts support nanosecond timestamp resolution; excess
15788precision is silently discarded.
15789
15790   Here are some examples:
15791
15792     2012-09-24T20:02:00.052-05:00
15793     2012-12-31T23:59:59,999999999+11:00
15794     1970-01-01 00:00Z
15795
15796
15797File: coreutils.info,  Node: Day of week items,  Next: Relative items in date strings,  Prev: Combined date and time of day items,  Up: Date input formats
15798
1579929.6 Day of week items
15800======================
15801
15802The explicit mention of a day of the week will forward the date (only if
15803necessary) to reach that day of the week in the future.
15804
15805   Days of the week may be spelled out in full: ‘Sunday’, ‘Monday’,
15806‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’ or ‘Saturday’.  Days may be
15807abbreviated to their first three letters, optionally followed by a
15808period.  The special abbreviations ‘Tues’ for ‘Tuesday’, ‘Wednes’ for
15809‘Wednesday’ and ‘Thur’ or ‘Thurs’ for ‘Thursday’ are also allowed.
15810
15811   A number may precede a day of the week item to move forward
15812supplementary weeks.  It is best used in expression like ‘third monday’.
15813In this context, ‘last DAY’ or ‘next DAY’ is also acceptable; they move
15814one week before or after the day that DAY by itself would represent.
15815
15816   A comma following a day of the week item is ignored.
15817
15818
15819File: coreutils.info,  Node: Relative items in date strings,  Next: Pure numbers in date strings,  Prev: Day of week items,  Up: Date input formats
15820
1582129.7 Relative items in date strings
15822===================================
15823
15824“Relative items” adjust a date (or the current date if none) forward or
15825backward.  The effects of relative items accumulate.  Here are some
15826examples:
15827
15828     1 year
15829     1 year ago
15830     3 years
15831     2 days
15832
15833   The unit of time displacement may be selected by the string ‘year’ or
15834‘month’ for moving by whole years or months.  These are fuzzy units, as
15835years and months are not all of equal duration.  More precise units are
15836‘fortnight’ which is worth 14 days, ‘week’ worth 7 days, ‘day’ worth 24
15837hours, ‘hour’ worth 60 minutes, ‘minute’ or ‘min’ worth 60 seconds, and
15838‘second’ or ‘sec’ worth one second.  An ‘s’ suffix on these units is
15839accepted and ignored.
15840
15841   The unit of time may be preceded by a multiplier, given as an
15842optionally signed number.  Unsigned numbers are taken as positively
15843signed.  No number at all implies 1 for a multiplier.  Following a
15844relative item by the string ‘ago’ is equivalent to preceding the unit by
15845a multiplier with value -1.
15846
15847   The string ‘tomorrow’ is worth one day in the future (equivalent to
15848‘day’), the string ‘yesterday’ is worth one day in the past (equivalent
15849to ‘day ago’).
15850
15851   The strings ‘now’ or ‘today’ are relative items corresponding to
15852zero-valued time displacement, these strings come from the fact a
15853zero-valued time displacement represents the current time when not
15854otherwise changed by previous items.  They may be used to stress other
15855items, like in ‘12:00 today’.  The string ‘this’ also has the meaning of
15856a zero-valued time displacement, but is preferred in date strings like
15857‘this thursday’.
15858
15859   When a relative item causes the resulting date to cross a boundary
15860where the clocks were adjusted, typically for daylight saving time, the
15861resulting date and time are adjusted accordingly.
15862
15863   The fuzz in units can cause problems with relative items.  For
15864example, ‘2003-07-31 -1 month’ might evaluate to 2003-07-01, because
158652003-06-31 is an invalid date.  To determine the previous month more
15866reliably, you can ask for the month before the 15th of the current
15867month.  For example:
15868
15869     $ date -R
15870     Thu, 31 Jul 2003 13:02:39 -0700
15871     $ date --date='-1 month' +'Last month was %B?'
15872     Last month was July?
15873     $ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
15874     Last month was June!
15875
15876   Also, take care when manipulating dates around clock changes such as
15877daylight saving leaps.  In a few cases these have added or subtracted as
15878much as 24 hours from the clock, so it is often wise to adopt universal
15879time by setting the ‘TZ’ environment variable to ‘UTC0’ before embarking
15880on calendrical calculations.
15881
15882
15883File: coreutils.info,  Node: Pure numbers in date strings,  Next: Seconds since the Epoch,  Prev: Relative items in date strings,  Up: Date input formats
15884
1588529.8 Pure numbers in date strings
15886=================================
15887
15888The precise interpretation of a pure decimal number depends on the
15889context in the date string.
15890
15891   If the decimal number is of the form YYYYMMDD and no other calendar
15892date item (*note Calendar date items::) appears before it in the date
15893string, then YYYY is read as the year, MM as the month number and DD as
15894the day of the month, for the specified calendar date.
15895
15896   If the decimal number is of the form HHMM and no other time of day
15897item appears before it in the date string, then HH is read as the hour
15898of the day and MM as the minute of the hour, for the specified time of
15899day.  MM can also be omitted.
15900
15901   If both a calendar date and a time of day appear to the left of a
15902number in the date string, but no relative item, then the number
15903overrides the year.
15904
15905
15906File: coreutils.info,  Node: Seconds since the Epoch,  Next: Specifying time zone rules,  Prev: Pure numbers in date strings,  Up: Date input formats
15907
1590829.9 Seconds since the Epoch
15909============================
15910
15911If you precede a number with ‘@’, it represents an internal timestamp as
15912a count of seconds.  The number can contain an internal decimal point
15913(either ‘.’ or ‘,’); any excess precision not supported by the internal
15914representation is truncated toward minus infinity.  Such a number cannot
15915be combined with any other date item, as it specifies a complete
15916timestamp.
15917
15918   Internally, computer times are represented as a count of seconds
15919since an epoch—a well-defined point of time.  On GNU and POSIX systems,
15920the epoch is 1970-01-01 00:00:00 UTC, so ‘@0’ represents this time, ‘@1’
15921represents 1970-01-01 00:00:01 UTC, and so forth.  GNU and most other
15922POSIX-compliant systems support such times as an extension to POSIX,
15923using negative counts, so that ‘@-1’ represents 1969-12-31 23:59:59 UTC.
15924
15925   Traditional Unix systems count seconds with 32-bit two’s-complement
15926integers and can represent times from 1901-12-13 20:45:52 through
159272038-01-19 03:14:07 UTC.  More modern systems use 64-bit counts of
15928seconds with nanosecond subcounts, and can represent all the times in
15929the known lifetime of the universe to a resolution of 1 nanosecond.
15930
15931   On most hosts, these counts ignore the presence of leap seconds.  For
15932example, on most hosts ‘@915148799’ represents 1998-12-31 23:59:59 UTC,
15933‘@915148800’ represents 1999-01-01 00:00:00 UTC, and there is no way to
15934represent the intervening leap second 1998-12-31 23:59:60 UTC.
15935
15936
15937File: coreutils.info,  Node: Specifying time zone rules,  Next: Authors of parse_datetime,  Prev: Seconds since the Epoch,  Up: Date input formats
15938
1593929.10 Specifying time zone rules
15940================================
15941
15942Normally, dates are interpreted using the rules of the current time
15943zone, which in turn are specified by the ‘TZ’ environment variable, or
15944by a system default if ‘TZ’ is not set.  To specify a different set of
15945default time zone rules that apply just to one date, start the date with
15946a string of the form ‘TZ="RULE"’.  The two quote characters (‘"’) must
15947be present in the date, and any quotes or backslashes within RULE must
15948be escaped by a backslash.
15949
15950   For example, with the GNU ‘date’ command you can answer the question
15951“What time is it in New York when a Paris clock shows 6:30am on October
1595231, 2004?” by using a date beginning with ‘TZ="Europe/Paris"’ as shown
15953in the following shell transcript:
15954
15955     $ export TZ="America/New_York"
15956     $ date --date='TZ="Europe/Paris" 2004-10-31 06:30'
15957     Sun Oct 31 01:30:00 EDT 2004
15958
15959   In this example, the ‘--date’ operand begins with its own ‘TZ’
15960setting, so the rest of that operand is processed according to
15961Europe/Paris’ rules, treating the string ‘2004-10-31 06:30’ as if it
15962were in Paris.  However, since the output of the ‘date’ command is
15963processed according to the overall time zone rules, it uses New York
15964time.  (Paris was normally six hours ahead of New York in 2004, but this
15965example refers to a brief Halloween period when the gap was five hours.)
15966
15967   A ‘TZ’ value is a rule that typically names a location in the ‘tz’
15968database (https://www.iana.org/time-zones).  A recent catalog of
15969location names appears in the TWiki Date and Time Gateway
15970(https://twiki.org/cgi-bin/xtra/tzdatepick.html).  A few non-GNU hosts
15971require a colon before a location name in a ‘TZ’ setting, e.g.,
15972‘TZ=":America/New_York"’.
15973
15974   The ‘tz’ database includes a wide variety of locations ranging from
15975Arctic/Longyearbyen’ to ‘Antarctica/South_Pole’, but if you are at sea
15976and have your own private time zone, or if you are using a non-GNU host
15977that does not support the ‘tz’ database, you may need to use a POSIX
15978rule instead.  Simple POSIX rules like ‘UTC0’ specify a time zone
15979without daylight saving time; other rules can specify simple daylight
15980saving regimes.  *Note Specifying the Time Zone with ‘TZ’: (libc)TZ
15981Variable.
15982
15983
15984File: coreutils.info,  Node: Authors of parse_datetime,  Prev: Specifying time zone rules,  Up: Date input formats
15985
1598629.11 Authors of ‘parse_datetime’
15987=================================
15988
15989‘parse_datetime’ started life as ‘getdate’, as originally implemented by
15990Steven M. Bellovin (<smb@research.att.com>) while at the University of
15991North Carolina at Chapel Hill.  The code was later tweaked by a couple
15992of people on Usenet, then completely overhauled by Rich $alz
15993(<rsalz@bbn.com>) and Jim Berets (<jberets@bbn.com>) in August, 1990.
15994Various revisions for the GNU system were made by David MacKenzie, Jim
15995Meyering, Paul Eggert and others, including renaming it to ‘get_date’ to
15996avoid a conflict with the alternative Posix function ‘getdate’, and a
15997later rename to ‘parse_datetime’.  The Posix function ‘getdate’ can
15998parse more locale-specific dates using ‘strptime’, but relies on an
15999environment variable and external file, and lacks the thread-safety of
16000‘parse_datetime’.
16001
16002   This chapter was originally produced by François Pinard
16003(<pinard@iro.umontreal.ca>) from the ‘parse_datetime.y’ source code, and
16004then edited by K. Berry (<kb@cs.umb.edu>).
16005
16006
16007File: coreutils.info,  Node: Version sort ordering,  Next: Opening the software toolbox,  Prev: Date input formats,  Up: Top
16008
1600930 Version sort ordering
16010************************
16011
16012* Menu:
16013
16014* Version sort overview::
16015* Implementation Details::
16016* Differences from the official Debian Algorithm::
16017* Advanced Topics::
16018
16019
16020File: coreutils.info,  Node: Version sort overview,  Next: Implementation Details,  Up: Version sort ordering
16021
1602230.1 Version sort overview
16023==========================
16024
16025“version sort” ordering (and similarly, “natural sort” ordering) is a
16026method to sort items such as file names and lines of text in an order
16027that feels more natural to people, when the text contains a mixture of
16028letters and digits.
16029
16030   Standard sorting usually does not produce the order that one expects
16031because comparisons are made on a character-by-character basis.
16032
16033   Compare the sorting of the following items:
16034
16035     Alphabetical sort:           Version Sort:
16036
16037     a1                           a1
16038     a120                         a2
16039     a13                          a13
16040     a2                           a120
16041
16042   version sort functionality in GNU coreutils is available in the ‘ls
16043-v’, ‘ls --sort=version’, ‘sort -V’, ‘sort --version-sort’ commands.
16044
16045* Menu:
16046
16047* Using version sort in GNU coreutils::
16048* Origin of version sort and differences from natural sort::
16049* Correct/Incorrect ordering and Expected/Unexpected results::
16050
16051
16052File: coreutils.info,  Node: Using version sort in GNU coreutils,  Next: Origin of version sort and differences from natural sort,  Up: Version sort overview
16053
1605430.1.1 Using version sort in GNU coreutils
16055------------------------------------------
16056
16057Two GNU coreutils programs use version sort: ‘ls’ and ‘sort’.
16058
16059   To list files in version sort order, use ‘ls’ with ‘-v’ or
16060‘--sort=version’ options:
16061
16062     default sort:              version sort:
16063
16064     $ ls -1                    $ ls -1 -v
16065     a1                         a1
16066     a100                       a1.4
16067     a1.13                      a1.13
16068     a1.4                       a1.40
16069     a1.40                      a2
16070     a2                         a100
16071
16072   To sort text files in version sort order, use ‘sort’ with the ‘-V’
16073option:
16074
16075     $ cat input
16076     b3
16077     b11
16078     b1
16079     b20
16080
16081
16082     alphabetical order:        version sort order:
16083
16084     $ sort input               $ sort -V input
16085     b1                         b1
16086     b11                        b3
16087     b20                        b11
16088     b3                         b20
16089
16090   To sort a specific column in a file use ‘-k/--key’ with ‘V’ ordering
16091option:
16092
16093     $ cat input2
16094     1000  b3   apples
16095     2000  b11  oranges
16096     3000  b1   potatoes
16097     4000  b20  bananas
16098
16099     $ sort -k2V,2 input2
16100     3000  b1   potatoes
16101     1000  b3   apples
16102     2000  b11  oranges
16103     4000  b20  bananas
16104
16105
16106File: coreutils.info,  Node: Origin of version sort and differences from natural sort,  Next: Correct/Incorrect ordering and Expected/Unexpected results,  Prev: Using version sort in GNU coreutils,  Up: Version sort overview
16107
1610830.1.2 Origin of version sort and differences from natural sort
16109---------------------------------------------------------------
16110
16111In GNU coreutils, the name “version sort” was chosen because it is based
16112on Debian GNU/Linux’s algorithm of sorting packages’ versions.
16113
16114   Its goal is to answer the question “which package is newer,
16115‘firefox-60.7.2’ or ‘firefox-60.12.3’ ?”
16116
16117   In coreutils this algorithm was slightly modified to work on more
16118general input such as textual strings and file names (see *note
16119Differences from the official Debian Algorithm::).
16120
16121   In other contexts, such as other programs and other programming
16122languages, a similar sorting functionality is called natural sort
16123(https://en.wikipedia.org/wiki/Natural_sort_order).
16124
16125
16126File: coreutils.info,  Node: Correct/Incorrect ordering and Expected/Unexpected results,  Prev: Origin of version sort and differences from natural sort,  Up: Version sort overview
16127
1612830.1.3 Correct/Incorrect ordering and Expected/Unexpected results
16129-----------------------------------------------------------------
16130
16131Currently there is no standard for version/natural sort ordering.
16132
16133   That is: there is no one correct way or universally agreed-upon way
16134to order items.  Each program and each programming language can decide
16135its own ordering algorithm and call it ’natural sort’ (or other various
16136names).
16137
16138   See *note Other version/natural sort implementations:: for many
16139examples of differing sorting possibilities, each with its own rules and
16140variations.
16141
16142   If you do suspect a bug in coreutils’ implementation of version-sort,
16143see *note Reporting bugs or incorrect results:: on how to report them.
16144
16145
16146File: coreutils.info,  Node: Implementation Details,  Next: Differences from the official Debian Algorithm,  Prev: Version sort overview,  Up: Version sort ordering
16147
1614830.2 Implementation Details
16149===========================
16150
16151GNU coreutils’ version sort algorithm is based on Debian’s versioning
16152scheme
16153(https://www.debian.org/doc/debian-policy/ch-controlfields.html#version),
16154specifically on the "upstream version" part.
16155
16156   This section describes the ordering rules.
16157
16158   The next section (*note Differences from the official Debian
16159Algorithm::) describes some differences between GNU coreutils
16160implementation and Debian’s official algorithm.
16161
16162* Menu:
16163
16164* Version-sort ordering rules::
16165* Version sort is not the same as numeric sort::
16166* Punctuation Characters::
16167* Punctuation Characters vs letters::
16168* Tilde ~ character::
16169* Version sort ignores locale::
16170
16171
16172File: coreutils.info,  Node: Version-sort ordering rules,  Next: Version sort is not the same as numeric sort,  Up: Implementation Details
16173
1617430.2.1 Version-sort ordering rules
16175----------------------------------
16176
16177The version sort ordering rules are:
16178
16179  1. The strings are compared from left to right.
16180
16181  2. First the initial part of each string consisting entirely of
16182     non-digit characters is determined.
16183
16184       1. These two parts (one of which may be empty) are compared
16185          lexically.  If a difference is found it is returned.
16186
16187       2. The lexical comparison is a comparison of ASCII values
16188          modified so that:
16189
16190            1. all the letters sort earlier than all the non-letters and
16191            2. so that a tilde sorts before anything, even the end of a
16192               part.
16193
16194  3. Then the initial part of the remainder of each string which
16195     consists entirely of digit characters is determined.  The numerical
16196     values of these two parts are compared, and any difference found is
16197     returned as the result of the comparison.
16198       1. For these purposes an empty string (which can only occur at
16199          the end of one or both version strings being compared) counts
16200          as zero.
16201
16202  4. These two steps (comparing and removing initial non-digit strings
16203     and initial digit strings) are repeated until a difference is found
16204     or both strings are exhausted.
16205
16206   Consider the version-sort comparison of two file names: ‘foo07.7z’
16207and ‘foo7a.7z’.  The two strings will be broken down to the following
16208parts, and the parts compared respectively from each string:
16209
16210     foo  vs  foo   (rule 2, non-digits characters)
16211     07   vs  7     (rule 3, digits characters)
16212     .    vs  a.    (rule 2)
16213     7    vs  7     (rule 3)
16214     z    vs  z     (rule 2)
16215
16216   Comparison flow based on above algorithm:
16217
16218  1. The first parts (‘foo’) are identical in both strings.
16219
16220  2. The second parts (‘07’ and ‘7’) are compared numerically, and are
16221     identical.
16222
16223  3. The third parts (‘‘.’’ vs ‘‘a.’’) are compared lexically by ASCII
16224     value (rule 2.2).
16225
16226  4. The first character of the first string (‘‘.’’) is compared to the
16227     first character of the second string (‘‘a’’).
16228
16229  5. Rule 2.2.1 dictates that "all letters sorts earlier than all
16230     non-letters".  Hence, ‘‘a’’ comes before ‘‘.’’.
16231
16232  6. The returned result is that ‘foo7a.7z’ comes before ‘foo07.7z’.
16233
16234   Result when using sort:
16235
16236     $ cat input3
16237     foo07.7z
16238     foo7a.7z
16239
16240     $ sort -V input3
16241     foo7a.7z
16242     foo07.7z
16243
16244   See *note Differences from the official Debian Algorithm:: for
16245additional rules that extend the Debian algorithm in coreutils.
16246
16247
16248File: coreutils.info,  Node: Version sort is not the same as numeric sort,  Next: Punctuation Characters,  Prev: Version-sort ordering rules,  Up: Implementation Details
16249
1625030.2.2 Version sort is not the same as numeric sort
16251---------------------------------------------------
16252
16253Consider the following text file:
16254
16255     $ cat input4
16256     8.10
16257     8.5
16258     8.1
16259     8.01
16260     8.010
16261     8.100
16262     8.49
16263
16264
16265
16266     Numerical Sort:                   Version Sort:
16267
16268     $ sort -n input4                  $ sort -V input4
16269     8.01                              8.01
16270     8.010                             8.1
16271     8.1                               8.5
16272     8.10                              8.010
16273     8.100                             8.10
16274     8.49                              8.49
16275     8.5                               8.100
16276
16277   Numeric sort (‘sort -n’) treats the entire string as a single numeric
16278value, and compares it to other values.  For example, ‘8.1’, ‘8.10’ and
16279‘8.100’ are numerically equivalent, and are ordered together.
16280Similarly, ‘8.49’ is numerically smaller than ‘8.5’, and appears before
16281first.
16282
16283   Version sort (‘sort -V’) first breaks down the string into digits and
16284non-digits parts, and only then compares each part (see annotated
16285example in Version-sort ordering rules).
16286
16287   Comparing the string ‘8.1’ to ‘8.01’, first the ‘‘8’’ characters are
16288compared (and are identical), then the dots (‘‘.’’) are compared and are
16289identical, and lastly the remaining digits are compared numerically (‘1’
16290and ‘01’) - which are numerically equivalent.  Hence, ‘8.01’ and ‘8.1’
16291are grouped together.
16292
16293   Similarly, comparing ‘8.5’ to ‘8.49’ - the ‘‘8’’ and ‘‘.’’ parts are
16294identical, then the numeric values ‘5’ and ‘49’ are compared.  The
16295resulting ‘5’ appears before ‘49’.
16296
16297   This sorting order (where ‘8.5’ comes before ‘8.49’) is common when
16298assigning versions to computer programs (while perhaps not intuitive or
16299’natural’ for people).
16300
16301
16302File: coreutils.info,  Node: Punctuation Characters,  Next: Punctuation Characters vs letters,  Prev: Version sort is not the same as numeric sort,  Up: Implementation Details
16303
1630430.2.3 Punctuation Characters
16305-----------------------------
16306
16307Punctuation characters are sorted by ASCII order (rule 2.2).
16308
16309     $ touch    1.0.5_src.tar.gz    1.0_src.tar.gz
16310
16311     $ ls -v -1
16312     1.0.5_src.tar.gz
16313     1.0_src.tar.gz
16314
16315   Why is ‘1.0.5_src.tar.gz’ listed before ‘1.0_src.tar.gz’ ?
16316
16317   Based on the *note algorithm: Version-sort ordering rules. above, the
16318strings are broken down into the following parts:
16319
16320               1   vs  1               (rule 3, all digit characters)
16321               .   vs  .               (rule 2, all non-digit characters)
16322               0   vs  0               (rule 3)
16323               .   vs  _src.tar.gz     (rule 2)
16324               5   vs  empty string    (no more character in the file name)
16325     _src.tar.gz   vs  empty string
16326
16327   The fourth parts (‘‘.’’ and ‘_src.tar.gz’) are compared lexically by
16328ASCII order.  The character ‘‘.’’ (ASCII value 46) is smaller than ‘‘_’’
16329(ASCII value 95) - and should be listed before it.
16330
16331   Hence, ‘1.0.5_src.tar.gz’ is listed first.
16332
16333   If a different character appears instead of the underscore (for
16334example, percent sign ‘‘%’’ ASCII value 37, which is smaller than dot’s
16335ASCII value of 46), that file will be listed first:
16336
16337     $ touch   1.0.5_src.tar.gz     1.0%zzzzz.gz
16338     1.0%zzzzz.gz
16339     1.0.5_src.tar.gz
16340
16341   The same reasoning applies to the following example: The character
16342‘‘.’’ has ASCII value 46, and is smaller than slash character ‘‘/’’
16343ASCII value 47:
16344
16345     $ cat input5
16346     3.0/
16347     3.0.5
16348
16349     $ sort -V input5
16350     3.0.5
16351     3.0/
16352
16353
16354File: coreutils.info,  Node: Punctuation Characters vs letters,  Next: Tilde ~ character,  Prev: Punctuation Characters,  Up: Implementation Details
16355
1635630.2.4 Punctuation Characters vs letters
16357----------------------------------------
16358
16359Rule 2.2.1 dictates that letters sorts earlier than all non-letters
16360(after breaking down a string to digits and non-digits parts).
16361
16362     $ cat input6
16363     a%
16364     az
16365
16366     $ sort -V input6
16367     az
16368     a%
16369
16370   The input strings consist entirely of non-digits, and based on the
16371above algorithm have only one part, all non-digit characters (‘‘a%’’ vs
16372‘‘az’’).
16373
16374   Each part is then compared lexically, character-by-character.  ‘‘a’’
16375compares identically in both strings.
16376
16377   Rule 2.2.1 dictates that letters (‘‘z’’) sorts earlier than all
16378non-letters (‘‘%’’) - hence ‘‘az’’ appears first (despite ‘‘z’’ having
16379ASCII value of 122, much bigger than ‘‘%’’ with ASCII value 37).
16380
16381
16382File: coreutils.info,  Node: Tilde ~ character,  Next: Version sort ignores locale,  Prev: Punctuation Characters vs letters,  Up: Implementation Details
16383
1638430.2.5 Tilde ‘~’ character
16385--------------------------
16386
16387Rule 2.2.2 dictates that tilde character ‘‘~’’ (ASCII 126) sorts before
16388all other non-digit characters, including an empty part.
16389
16390     $ cat input7
16391     1
16392     1%
16393     1.2
16394     1~
16395     ~
16396
16397     $ sort -V input7
16398     ~
16399     1~
16400     1
16401     1%
16402     1.2
16403
16404   The sorting algorithm starts by breaking down the string into
16405non-digits (rule 2) and digits parts (rule 3).
16406
16407   In the above input file, only the last line in the input file starts
16408with a non-digit (‘‘~’’).  This is the first part.  All other lines in
16409the input file start with a digit - their first non-digit part is empty.
16410
16411   Based on rule 2.2.2, tilde ‘‘~’’ sorts before all other non-digits
16412including the empty part - hence it comes before all other strings, and
16413is listed first in the sorted output.
16414
16415   The remaining lines (‘1’, ‘1%’, ‘1.2’, ‘1~’) follow similar logic:
16416The digit part is extracted (1 for all strings) and compares identical.
16417The following extracted parts for the remaining input lines are: empty
16418part, ‘%’, ‘.’, ‘~’.
16419
16420   Tilde sorts before all others, hence the line ‘1~’ appears next.
16421
16422   The remaining lines (‘1’, ‘1%’, ‘1.2’) are sorted based on previously
16423explained rules.
16424
16425
16426File: coreutils.info,  Node: Version sort ignores locale,  Prev: Tilde ~ character,  Up: Implementation Details
16427
1642830.2.6 Version sort uses ASCII order, ignores locale, unicode characters
16429------------------------------------------------------------------------
16430
16431In version sort, unicode characters are compared byte-by-byte according
16432to their binary representation, ignoring their unicode value or the
16433current locale.
16434
16435   Most commonly, unicode characters (e.g.  Greek Small Letter Alpha
16436U+03B1 ‘α’) are encoded as UTF-8 bytes (e.g.  ‘α’ is encoded as UTF-8
16437sequence ‘0xCE 0xB1’).  The encoding will be compared byte-by-byte, e.g.
16438first ‘0xCE’ (decimal value 206) then ‘0xB1’ (decimal value 177).
16439
16440     $ touch   aa    az    "a%"    "aα"
16441
16442     $ ls -1 -v
16443     aa
16444     az
16445     a%
1644616447
16448   Ignoring the first letter (‘a’) which is identical in all strings,
16449the compared values are:
16450
16451   ‘‘a’’ and ‘‘z’’ are letters, and sort earlier than all other
16452non-digit characters.
16453
16454   Then, percent sign ‘‘%’’ (ASCII value 37) is compared to the first
16455byte of the UTF-8 sequence of ‘‘α’’, which is 0xCE or 206).  The value
1645637 is smaller, hence ‘‘a%’’ is listed before ‘‘aα’’.
16457
16458
16459File: coreutils.info,  Node: Differences from the official Debian Algorithm,  Next: Advanced Topics,  Prev: Implementation Details,  Up: Version sort ordering
16460
1646130.3 Differences from the official Debian Algorithm
16462===================================================
16463
16464The GNU coreutils’ version sort algorithm differs slightly from the
16465official Debian algorithm, in order to accommodate more general usage
16466and file name listing.
16467
16468* Menu:
16469
16470* Minus/Hyphen and Colon characters::
16471* Additional hard-coded priorities in GNU coreutils' version sort::
16472* Special handling of file extensions::
16473
16474
16475File: coreutils.info,  Node: Minus/Hyphen and Colon characters,  Next: Additional hard-coded priorities in GNU coreutils' version sort,  Up: Differences from the official Debian Algorithm
16476
1647730.3.1 Minus/Hyphen ‘-’ and Colon ‘:’ characters
16478------------------------------------------------
16479
16480In Debian’s version string syntax the version consists of three parts:
16481     [epoch:]upstream_version[-debian_revision]
16482   The ‘epoch’ and ‘debian_revision’ parts are optional.
16483
16484   Example of such version strings:
16485
16486     60.7.2esr-1~deb9u1
16487     52.9.0esr-1~deb9u1
16488     1:2.3.4-1+b2
16489     327-2
16490     1:1.0.13-3
16491     2:1.19.2-1+deb9u5
16492
16493   If the ‘debian_revision part’ is not present, hyphen characters ‘-’
16494are not allowed.  If epoch is not present, colons ‘:’ are not allowed.
16495
16496   If these parts are present, hyphen and/or colons can appear only once
16497in valid Debian version strings.
16498
16499   In GNU coreutils, such restrictions are not reasonable (a file name
16500can have many hyphens, a line of text can have many colons).
16501
16502   As a result, in GNU coreutils hyphens and colons are treated exactly
16503like all other punctuation characters (i.e., they are sorted after
16504letters.  See Punctuation Characters above).
16505
16506   In Debian, these characters are treated differently than in
16507coreutils: a version string with hyphen will sort before similar strings
16508without hyphens.
16509
16510   Compare:
16511
16512     $ touch   abb   ab-cd
16513
16514     $ ls -v -1
16515     abb
16516     ab-cd
16517
16518   With Debian’s ‘dpkg’ they will be listed as ‘ab-cd’ first and ‘abb’
16519second.
16520
16521   For further technical details see bug35939
16522(https://bugs.gnu.org/35939).
16523
16524
16525File: coreutils.info,  Node: Additional hard-coded priorities in GNU coreutils' version sort,  Next: Special handling of file extensions,  Prev: Minus/Hyphen and Colon characters,  Up: Differences from the official Debian Algorithm
16526
1652730.3.2 Additional hard-coded priorities in GNU coreutils’ version sort
16528----------------------------------------------------------------------
16529
16530In GNU coreutils’ version sort algorithm, the following items have
16531special priority and sort earlier than all other characters (listed in
16532order);
16533
16534  1. The empty string
16535
16536  2. The string ‘‘.’’ (a single dot character, ASCII 46)
16537
16538  3. The string ‘‘..’’ (two dot characters)
16539
16540  4. Strings start with a dot (‘‘.’’) sort earlier than strings starting
16541     with any other characters.
16542
16543   Example:
16544
16545     $ printf "%s\n" a "" b "." c  ".."  ".d20" ".d3"  | sort -V
16546
16547     .
16548     ..
16549     .d3
16550     .d20
16551     a
16552     b
16553     c
16554
16555   These priorities make perfect sense for ‘ls -v’: The special files
16556dot ‘‘.’’ and dot-dot ‘‘..’’ will be listed first, followed by any
16557hidden files (files starting with a dot), followed by non-hidden files.
16558
16559   For ‘sort -V’ these priorities might seem arbitrary.  However,
16560because the sorting code is shared between the ‘ls’ and ‘sort’ program,
16561the ordering rules are the same.
16562
16563
16564File: coreutils.info,  Node: Special handling of file extensions,  Prev: Additional hard-coded priorities in GNU coreutils' version sort,  Up: Differences from the official Debian Algorithm
16565
1656630.3.3 Special handling of file extensions
16567------------------------------------------
16568
16569GNU coreutils’ version sort algorithm implements specialized handling of
16570file extensions (or strings that look like file names with extensions).
16571
16572   This nuanced implementation enables slightly more natural ordering of
16573files.
16574
16575   The additional rules are:
16576
16577  1. A suffix (i.e., a file extension) is defined as: a dot, followed by
16578     a letter or tilde, followed by one or more letters, digits, or
16579     tildes (possibly repeated more than once), until the end of the
16580     string (technically, matching the regular expression
16581     ‘(\.[A-Za-z~][A-Za-z0-9~]*)*’).
16582
16583  2. If the strings contains suffixes, the suffixes are temporarily
16584     removed, and the strings are compared without them (using the *note
16585     algorithm: Version-sort ordering rules. above).
16586
16587  3. If the suffix-less strings are identical, the suffix is restored
16588     and the entire strings are compared.
16589
16590  4. If the non-suffixed strings differ, the result is returned and the
16591     suffix is effectively ignored.
16592
16593   Examples for rule 1:
16594
16595   • ‘hello-8.txt’: the suffix is ‘.txt’
16596
16597   • ‘hello-8.2.txt’: the suffix is ‘.txt’ (‘‘.2’’ is not included
16598     because the dot is not followed by a letter)
16599
16600   • ‘hello-8.0.12.tar.gz’: the suffix is ‘.tar.gz’ (‘‘.0.12’’ is not
16601     included)
16602
16603   • ‘hello-8.2’: no suffix (suffix is an empty string)
16604
16605   • ‘hello.foobar65’: the suffix is ‘.foobar65’
16606
16607   • ‘gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2’: the suffix is ‘.fc9.tar.bz216608     (‘.7rc2’ is not included as it begins with a digit)
16609
16610   Examples for rule 2:
16611
16612   • Comparing ‘hello-8.txt’ to ‘hello-8.2.12.txt’, the ‘.txt’ suffix is
16613     temporarily removed from both strings.
16614
16615   • Comparing ‘foo-10.3.tar.gz’ to ‘foo-10.tar.xz’, the suffixes
16616.tar.gz’ and ‘.tar.xz’ are temporarily removed from the strings.
16617
16618   Example for rule 3:
16619
16620   • Comparing ‘hello.foobar65’ to ‘hello.foobar4’, the suffixes
16621     (‘.foobar65’ and ‘.foobar4’) are temporarily removed.  The
16622     remaining strings are identical (‘hello’).  The suffixes are then
16623     restored, and the entire strings are compared (‘hello.foobar416624     comes first).
16625
16626   Examples for rule 4:
16627
16628   • When comparing the strings ‘hello-8.2.txt’ and ‘hello-8.10.txt’,
16629     the suffixes (‘.txt’) are temporarily removed.  The remaining
16630     strings (‘hello-8.2’ and ‘hello-8.10’) are compared as previously
16631     described (‘hello-8.2’ comes first).  (In this case the suffix
16632     removal algorithm does not have a noticeable effect on the
16633     resulting order.)
16634
16635   How does the suffix-removal algorithm effect ordering results?
16636
16637   Consider the comparison of hello-8.txt and hello-8.2.txt.
16638
16639   Without the suffix-removal algorithm, the strings will be broken down
16640to the following parts:
16641
16642     hello-  vs  hello-  (rule 2, all non-digit characters)
16643     8       vs  8       (rule 3, all digit characters)
16644     .txt    vs  .       (rule 2)
16645     empty   vs  2
16646     empty   vs  .txt
16647
16648   The comparison of the third parts (‘‘.’’ vs ‘‘.txt’’) will determine
16649that the shorter string comes first - resulting in ‘hello-8.2.txt16650appearing first.
16651
16652   Indeed this is the order in which Debian’s ‘dpkg’ compares the
16653strings.
16654
16655   A more natural result is that ‘hello-8.txt’ should come before
16656hello-8.2.txt’, and this is where the suffix-removal comes into play:
16657
16658   The suffixes (‘.txt’) are removed, and the remaining strings are
16659broken down into the following parts:
16660
16661     hello-  vs  hello-  (rule 2, all non-digit characters)
16662     8       vs  8       (rule 3, all digit characters)
16663     empty   vs  .       (rule 2)
16664     empty   vs  2
16665
16666   As empty strings sort before non-empty strings, the result is
16667‘hello-8’ being first.
16668
16669   A real-world example would be listing files such as:
16670gcc_10.fc9.tar.gz’ and ‘gcc_10.8.12.7rc2.fc9.tar.bz2’: Debian’s
16671algorithm would list ‘gcc_10.8.12.7rc2.fc9.tar.bz2’ first, while ‘ls -v’
16672will list ‘gcc_10.fc9.tar.gz’ first.
16673
16674   These priorities make sense for ‘ls -v’: Versioned files will be
16675listed in a more natural order.
16676
16677   For ‘sort -V’ these priorities might seem arbitrary.  However,
16678because the sorting code is shared between the ‘ls’ and ‘sort’ program,
16679the ordering rules are the same.
16680
16681
16682File: coreutils.info,  Node: Advanced Topics,  Prev: Differences from the official Debian Algorithm,  Up: Version sort ordering
16683
1668430.4 Advanced Topics
16685====================
16686
16687* Menu:
16688
16689* Comparing two strings using Debian's algorithm::
16690* Reporting bugs or incorrect results::
16691* Other version/natural sort implementations::
16692* Related Source code::
16693
16694
16695File: coreutils.info,  Node: Comparing two strings using Debian's algorithm,  Next: Reporting bugs or incorrect results,  Up: Advanced Topics
16696
1669730.4.1 Comparing two strings using Debian’s algorithm
16698-----------------------------------------------------
16699
16700The Debian program ‘dpkg’ (available on all Debian and Ubuntu
16701installations) can compare two strings using the ‘--compare-versions’
16702option.
16703
16704   To use it, create a helper shell function (simply copy & paste the
16705following snippet to your shell command-prompt):
16706
16707     compver() {
16708       dpkg --compare-versions "$1" lt "$2" \
16709         && printf "%s\n" "$1" "$2" \
16710         || printf "%s\n" "$2" "$1" ; \
16711     }
16712
16713   Then compare two strings by calling compver:
16714
16715     $ compver 8.49 8.5
16716     8.5
16717     8.49
16718
16719   Note that ‘dpkg’ will warn if the strings have invalid syntax:
16720
16721     $ compver "foo07.7z" "foo7a.7z"
16722     dpkg: warning: version 'foo07.7z' has bad syntax:
16723                    version number does not start with digit
16724     dpkg: warning: version 'foo7a.7z' has bad syntax:
16725                    version number does not start with digit
16726     foo7a.7z
16727     foo07.7z
16728
16729     $ compver "3.0/" "3.0.5"
16730     dpkg: warning: version '3.0/' has bad syntax:
16731                    invalid character in version number
16732     3.0.5
16733     3.0/
16734
16735   To illustrate the different handling of hyphens between Debian and
16736coreutils’ algorithms (see *note Minus/Hyphen and Colon characters::):
16737
16738     $ compver abb ab-cd 2>/dev/null     $ printf "abb\nab-cd\n" | sort -V
16739     ab-cd                               abb
16740     abb                                 ab-cd
16741
16742   To illustrate the different handling of file extension: (see *note
16743Special handling of file extensions::):
16744
16745     $ compver hello-8.txt hello-8.2.txt 2>/dev/null
16746     hello-8.2.txt
16747     hello-8.txt
16748
16749     $ printf "%s\n" hello-8.txt hello-8.2.txt | sort -V
16750     hello-8.txt
16751     hello-8.2.txt
16752
16753
16754File: coreutils.info,  Node: Reporting bugs or incorrect results,  Next: Other version/natural sort implementations,  Prev: Comparing two strings using Debian's algorithm,  Up: Advanced Topics
16755
1675630.4.2 Reporting bugs or incorrect results
16757------------------------------------------
16758
16759If you suspect a bug in GNU coreutils’ version sort (i.e., in the output
16760of ‘ls -v’ or ‘sort -V’), please first check the following:
16761
16762  1. Is the result consistent with Debian’s own ordering (using ‘dpkg’,
16763     see *note Comparing two strings using Debian's algorithm::) ?  If
16764     it is, then this is not a bug - please do not report it.
16765
16766  2. If the result differs from Debian’s, is it explained by one of the
16767     sections in *note Differences from the official Debian Algorithm::?
16768     If it is, then this is not a bug - please do not report it.
16769
16770  3. If you have a question about specific ordering which is not
16771     explained here, please write to <coreutils@gnu.org>, and provide a
16772     concise example that will help us diagnose the issue.
16773
16774  4. If you still suspect a bug which is not explained by the above,
16775     please write to <bug-coreutils@gnu.org> with a concrete example of
16776     the suspected incorrect output, with details on why you think it is
16777     incorrect.
16778
16779
16780File: coreutils.info,  Node: Other version/natural sort implementations,  Next: Related Source code,  Prev: Reporting bugs or incorrect results,  Up: Advanced Topics
16781
1678230.4.3 Other version/natural sort implementations
16783-------------------------------------------------
16784
16785As previously mentioned, there are multiple variations on
16786version/natural sort, each with its own rules.  Some examples are:
16787
16788   • Natural Sorting variants in Rosetta Code
16789     (https://rosettacode.org/wiki/Natural_sorting).
16790
16791   • Python’s natsort package (https://pypi.org/project/natsort/)
16792     (includes detailed description of their sorting rules: natsort -
16793     how it works
16794     (https://natsort.readthedocs.io/en/master/howitworks.html)).
16795
16796   • Ruby’s version_sorter (https://github.com/github/version_sorter).
16797
16798   • Perl has multiple packages for natual and version sorts (each
16799     likely with its own rules and nuances): Sort::Naturally
16800     (https://metacpan.org/pod/Sort::Naturally), Sort::Versions
16801     (https://metacpan.org/pod/Sort::Versions), CPAN::Version
16802     (https://metacpan.org/pod/CPAN::Version).
16803
16804   • PHP has a built-in function natsort
16805     (https://www.php.net/manual/en/function.natsort.php).
16806
16807   • NodeJS’s natural-sort package
16808     (https://www.npmjs.com/package/natural-sort).
16809
16810   • In zsh, the glob modifier
16811     (http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers)
16812     ‘*(n)’ will expand to files in natural sort order.
16813
16814   • When writing ‘C’ programs, the GNU libc library (‘glibc’) provides
16815     the strvercmp(3)
16816     (http://man7.org/linux/man-pages/man3/strverscmp.3.html) function
16817     to compare two strings, and versionsort(3)
16818     (http://man7.org/linux/man-pages/man3/versionsort.3.html) function
16819     to compare two directory entries (despite the names, they are not
16820     identical to GNU coreutils’ version sort ordering).
16821
16822   • Using Debian’s sorting algorithm in:
16823
16824        • python: Stack Overflow Example #4957741
16825          (https://stackoverflow.com/a/4957741).
16826
16827        • NodeJS: deb-version-compare
16828          (https://www.npmjs.com/package/deb-version-compare).
16829
16830
16831File: coreutils.info,  Node: Related Source code,  Prev: Other version/natural sort implementations,  Up: Advanced Topics
16832
1683330.4.4 Related Source code
16834--------------------------
16835
16836   • Debian’s code which splits a version string into
16837epoch/upstream_version/debian_revision’ parts:
16838     parsehelp.c:parseversion()
16839     (https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/parsehelp.c#n191).
16840
16841   • Debian’s code which performs the ‘upstream_version’ comparison:
16842     version.c
16843     (https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/version.c#n140).
16844
16845   • GNULIB code (used by GNU coreutils) which performs the version
16846     comparison: filevercmp.c
16847     (https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/filevercmp.c).
16848
16849
16850File: coreutils.info,  Node: Opening the software toolbox,  Next: GNU Free Documentation License,  Prev: Version sort ordering,  Up: Top
16851
1685231 Opening the Software Toolbox
16853*******************************
16854
16855An earlier version of this chapter appeared in the ‘What’s GNU?’  column
16856of the June 1994 ‘Linux Journal’
16857(https://www.linuxjournal.com/article.php?sid=2762).  It was written by
16858Arnold Robbins.
16859
16860* Menu:
16861
16862* Toolbox introduction::        Toolbox introduction
16863* I/O redirection::             I/O redirection
16864* The who command::             The ‘who’ command
16865* The cut command::             The ‘cut’ command
16866* The sort command::            The ‘sort’ command
16867* The uniq command::            The ‘uniq’ command
16868* Putting the tools together::  Putting the tools together
16869
16870
16871File: coreutils.info,  Node: Toolbox introduction,  Next: I/O redirection,  Up: Opening the software toolbox
16872
16873Toolbox Introduction
16874====================
16875
16876This month’s column is only peripherally related to the GNU Project, in
16877that it describes a number of the GNU tools on your GNU/Linux system and
16878how they might be used.  What it’s really about is the “Software Tools”
16879philosophy of program development and usage.
16880
16881   The software tools philosophy was an important and integral concept
16882in the initial design and development of Unix (of which Linux and GNU
16883are essentially clones).  Unfortunately, in the modern day press of
16884Internetworking and flashy GUIs, it seems to have fallen by the wayside.
16885This is a shame, since it provides a powerful mental model for solving
16886many kinds of problems.
16887
16888   Many people carry a Swiss Army knife around in their pants pockets
16889(or purse).  A Swiss Army knife is a handy tool to have: it has several
16890knife blades, a screwdriver, tweezers, toothpick, nail file, corkscrew,
16891and perhaps a number of other things on it.  For the everyday, small
16892miscellaneous jobs where you need a simple, general purpose tool, it’s
16893just the thing.
16894
16895   On the other hand, an experienced carpenter doesn’t build a house
16896using a Swiss Army knife.  Instead, he has a toolbox chock full of
16897specialized tools—a saw, a hammer, a screwdriver, a plane, and so on.
16898And he knows exactly when and where to use each tool; you won’t catch
16899him hammering nails with the handle of his screwdriver.
16900
16901   The Unix developers at Bell Labs were all professional programmers
16902and trained computer scientists.  They had found that while a
16903one-size-fits-all program might appeal to a user because there’s only
16904one program to use, in practice such programs are
16905
16906  a. difficult to write,
16907
16908  b. difficult to maintain and debug, and
16909
16910  c. difficult to extend to meet new situations.
16911
16912   Instead, they felt that programs should be specialized tools.  In
16913short, each program “should do one thing well.” No more and no less.
16914Such programs are simpler to design, write, and get right—they only do
16915one thing.
16916
16917   Furthermore, they found that with the right machinery for hooking
16918programs together, that the whole was greater than the sum of the parts.
16919By combining several special purpose programs, you could accomplish a
16920specific task that none of the programs was designed for, and accomplish
16921it much more quickly and easily than if you had to write a special
16922purpose program.  We will see some (classic) examples of this further on
16923in the column.  (An important additional point was that, if necessary,
16924take a detour and build any software tools you may need first, if you
16925don’t already have something appropriate in the toolbox.)
16926
16927
16928File: coreutils.info,  Node: I/O redirection,  Next: The who command,  Prev: Toolbox introduction,  Up: Opening the software toolbox
16929
16930I/O Redirection
16931===============
16932
16933Hopefully, you are familiar with the basics of I/O redirection in the
16934shell, in particular the concepts of “standard input,” “standard
16935output,” and “standard error”.  Briefly, “standard input” is a data
16936source, where data comes from.  A program should not need to either know
16937or care if the data source is a disk file, a keyboard, a magnetic tape,
16938or even a punched card reader.  Similarly, “standard output” is a data
16939sink, where data goes to.  The program should neither know nor care
16940where this might be.  Programs that only read their standard input, do
16941something to the data, and then send it on, are called “filters”, by
16942analogy to filters in a water pipeline.
16943
16944   With the Unix shell, it’s very easy to set up data pipelines:
16945
16946     program_to_create_data | filter1 | ... | filterN > final.pretty.data
16947
16948   We start out by creating the raw data; each filter applies some
16949successive transformation to the data, until by the time it comes out of
16950the pipeline, it is in the desired form.
16951
16952   This is fine and good for standard input and standard output.  Where
16953does the standard error come in to play?  Well, think about ‘filter1’ in
16954the pipeline above.  What happens if it encounters an error in the data
16955it sees?  If it writes an error message to standard output, it will just
16956disappear down the pipeline into ‘filter2’’s input, and the user will
16957probably never see it.  So programs need a place where they can send
16958error messages so that the user will notice them.  This is standard
16959error, and it is usually connected to your console or window, even if
16960you have redirected standard output of your program away from your
16961screen.
16962
16963   For filter programs to work together, the format of the data has to
16964be agreed upon.  The most straightforward and easiest format to use is
16965simply lines of text.  Unix data files are generally just streams of
16966bytes, with lines delimited by the ASCII LF (Line Feed) character,
16967conventionally called a “newline” in the Unix literature.  (This is
16968‘'\n'’ if you’re a C programmer.)  This is the format used by all the
16969traditional filtering programs.  (Many earlier operating systems had
16970elaborate facilities and special purpose programs for managing binary
16971data.  Unix has always shied away from such things, under the philosophy
16972that it’s easiest to simply be able to view and edit your data with a
16973text editor.)
16974
16975   OK, enough introduction.  Let’s take a look at some of the tools, and
16976then we’ll see how to hook them together in interesting ways.  In the
16977following discussion, we will only present those command line options
16978that interest us.  As you should always do, double check your system
16979documentation for the full story.
16980
16981
16982File: coreutils.info,  Node: The who command,  Next: The cut command,  Prev: I/O redirection,  Up: Opening the software toolbox
16983
16984The ‘who’ Command
16985=================
16986
16987The first program is the ‘who’ command.  By itself, it generates a list
16988of the users who are currently logged in.  Although I’m writing this on
16989a single-user system, we’ll pretend that several people are logged in:
16990
16991     $ who
16992     ⊣ arnold   console Jan 22 19:57
16993     ⊣ miriam   ttyp0   Jan 23 14:19(:0.0)
16994     ⊣ bill     ttyp1   Jan 21 09:32(:0.0)
16995     ⊣ arnold   ttyp2   Jan 23 20:48(:0.0)
16996
16997   Here, the ‘$’ is the usual shell prompt, at which I typed ‘who’.
16998There are three people logged in, and I am logged in twice.  On
16999traditional Unix systems, user names are never more than eight
17000characters long.  This little bit of trivia will be useful later.  The
17001output of ‘who’ is nice, but the data is not all that exciting.
17002
17003
17004File: coreutils.info,  Node: The cut command,  Next: The sort command,  Prev: The who command,  Up: Opening the software toolbox
17005
17006The ‘cut’ Command
17007=================
17008
17009The next program we’ll look at is the ‘cut’ command.  This program cuts
17010out columns or fields of input data.  For example, we can tell it to
17011print just the login name and full name from the ‘/etc/passwd’ file.
17012The ‘/etc/passwd’ file has seven fields, separated by colons:
17013
17014     arnold:xyzzy:2076:10:Arnold D. Robbins:/home/arnold:/bin/bash
17015
17016   To get the first and fifth fields, we would use ‘cut’ like this:
17017
17018     $ cut -d: -f1,5 /etc/passwd
17019     ⊣ root:Operator
17020     ...
17021     ⊣ arnold:Arnold D. Robbins
17022     ⊣ miriam:Miriam A. Robbins
17023     ...
17024
17025   With the ‘-c’ option, ‘cut’ will cut out specific characters (i.e.,
17026columns) in the input lines.  This is useful for input data that has
17027fixed width fields, and does not have a field separator.  For example,
17028list the Monday dates for the current month:
17029
17030     $ cal | cut -c 3-5
17031     ⊣Mo
1703217033     ⊣  6
17034     ⊣ 13
17035     ⊣ 20
17036     ⊣ 27
17037
17038
17039File: coreutils.info,  Node: The sort command,  Next: The uniq command,  Prev: The cut command,  Up: Opening the software toolbox
17040
17041The ‘sort’ Command
17042==================
17043
17044Next we’ll look at the ‘sort’ command.  This is one of the most powerful
17045commands on a Unix-style system; one that you will often find yourself
17046using when setting up fancy data plumbing.
17047
17048   The ‘sort’ command reads and sorts each file named on the command
17049line.  It then merges the sorted data and writes it to standard output.
17050It will read standard input if no files are given on the command line
17051(thus making it into a filter).  The sort is based on the character
17052collating sequence or based on user-supplied ordering criteria.
17053
17054
17055File: coreutils.info,  Node: The uniq command,  Next: Putting the tools together,  Prev: The sort command,  Up: Opening the software toolbox
17056
17057The ‘uniq’ Command
17058==================
17059
17060Finally (at least for now), we’ll look at the ‘uniq’ program.  When
17061sorting data, you will often end up with duplicate lines, lines that are
17062identical.  Usually, all you need is one instance of each line.  This is
17063where ‘uniq’ comes in.  The ‘uniq’ program reads its standard input.  It
17064prints only one copy of each repeated line.  It does have several
17065options.  Later on, we’ll use the ‘-c’ option, which prints each unique
17066line, preceded by a count of the number of times that line occurred in
17067the input.
17068
17069
17070File: coreutils.info,  Node: Putting the tools together,  Prev: The uniq command,  Up: Opening the software toolbox
17071
17072Putting the Tools Together
17073==========================
17074
17075Now, let’s suppose this is a large ISP server system with dozens of
17076users logged in.  The management wants the system administrator to write
17077a program that will generate a sorted list of logged in users.
17078Furthermore, even if a user is logged in multiple times, his or her name
17079should only show up in the output once.
17080
17081   The administrator could sit down with the system documentation and
17082write a C program that did this.  It would take perhaps a couple of
17083hundred lines of code and about two hours to write it, test it, and
17084debug it.  However, knowing the software toolbox, the administrator can
17085instead start out by generating just a list of logged on users:
17086
17087     $ who | cut -c1-8
17088     ⊣ arnold
17089     ⊣ miriam
17090     ⊣ bill
17091     ⊣ arnold
17092
17093   Next, sort the list:
17094
17095     $ who | cut -c1-8 | sort
17096     ⊣ arnold
17097     ⊣ arnold
17098     ⊣ bill
17099     ⊣ miriam
17100
17101   Finally, run the sorted list through ‘uniq’, to weed out duplicates:
17102
17103     $ who | cut -c1-8 | sort | uniq
17104     ⊣ arnold
17105     ⊣ bill
17106     ⊣ miriam
17107
17108   The ‘sort’ command actually has a ‘-u’ option that does what ‘uniq’
17109does.  However, ‘uniq’ has other uses for which one cannot substitute
17110‘sort -u’.
17111
17112   The administrator puts this pipeline into a shell script, and makes
17113it available for all the users on the system (‘#’ is the system
17114administrator, or ‘root’, prompt):
17115
17116     # cat > /usr/local/bin/listusers
17117     who | cut -c1-8 | sort | uniq
17118     ^D
17119     # chmod +x /usr/local/bin/listusers
17120
17121   There are four major points to note here.  First, with just four
17122programs, on one command line, the administrator was able to save about
17123two hours worth of work.  Furthermore, the shell pipeline is just about
17124as efficient as the C program would be, and it is much more efficient in
17125terms of programmer time.  People time is much more expensive than
17126computer time, and in our modern “there’s never enough time to do
17127everything” society, saving two hours of programmer time is no mean
17128feat.
17129
17130   Second, it is also important to emphasize that with the _combination_
17131of the tools, it is possible to do a special purpose job never imagined
17132by the authors of the individual programs.
17133
17134   Third, it is also valuable to build up your pipeline in stages, as we
17135did here.  This allows you to view the data at each stage in the
17136pipeline, which helps you acquire the confidence that you are indeed
17137using these tools correctly.
17138
17139   Finally, by bundling the pipeline in a shell script, other users can
17140use your command, without having to remember the fancy plumbing you set
17141up for them.  In terms of how you run them, shell scripts and compiled
17142programs are indistinguishable.
17143
17144   After the previous warm-up exercise, we’ll look at two additional,
17145more complicated pipelines.  For them, we need to introduce two more
17146tools.
17147
17148   The first is the ‘tr’ command, which stands for “transliterate.” The
17149‘tr’ command works on a character-by-character basis, changing
17150characters.  Normally it is used for things like mapping upper case to
17151lower case:
17152
17153     $ echo ThIs ExAmPlE HaS MIXED case! | tr '[:upper:]' '[:lower:]'
17154     ⊣ this example has mixed case!
17155
17156   There are several options of interest:
17157
17158‘-c’
17159     work on the complement of the listed characters, i.e., operations
17160     apply to characters not in the given set
17161
17162‘-d’
17163     delete characters in the first set from the output
17164
17165‘-s’
17166     squeeze repeated characters in the output into just one character.
17167
17168   We will be using all three options in a moment.
17169
17170   The other command we’ll look at is ‘comm’.  The ‘comm’ command takes
17171two sorted input files as input data, and prints out the files’ lines in
17172three columns.  The output columns are the data lines unique to the
17173first file, the data lines unique to the second file, and the data lines
17174that are common to both.  The ‘-1’, ‘-2’, and ‘-3’ command line options
17175_omit_ the respective columns.  (This is non-intuitive and takes a
17176little getting used to.)  For example:
17177
17178     $ cat f1
17179     ⊣ 11111
17180     ⊣ 22222
17181     ⊣ 33333
17182     ⊣ 44444
17183     $ cat f2
17184     ⊣ 00000
17185     ⊣ 22222
17186     ⊣ 33333
17187     ⊣ 55555
17188     $ comm f1 f2
17189     ⊣         00000
17190     ⊣ 11111
17191     ⊣                 22222
17192     ⊣                 33333
17193     ⊣ 44444
17194     ⊣         55555
17195
17196   The file name ‘-’ tells ‘comm’ to read standard input instead of a
17197regular file.
17198
17199   Now we’re ready to build a fancy pipeline.  The first application is
17200a word frequency counter.  This helps an author determine if he or she
17201is over-using certain words.
17202
17203   The first step is to change the case of all the letters in our input
17204file to one case.  “The” and “the” are the same word when doing
17205counting.
17206
17207     $ tr '[:upper:]' '[:lower:]' < whats.gnu | ...
17208
17209   The next step is to get rid of punctuation.  Quoted words and
17210unquoted words should be treated identically; it’s easiest to just get
17211the punctuation out of the way.
17212
17213     $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | ...
17214
17215   The second ‘tr’ command operates on the complement of the listed
17216characters, which are all the letters, the digits, the underscore, and
17217the blank.  The ‘\n’ represents the newline character; it has to be left
17218alone.  (The ASCII tab character should also be included for good
17219measure in a production script.)
17220
17221   At this point, we have data consisting of words separated by blank
17222space.  The words only contain alphanumeric characters (and the
17223underscore).  The next step is break the data apart so that we have one
17224word per line.  This makes the counting operation much easier, as we
17225will see shortly.
17226
17227     $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' |
17228     > tr -s ' ' '\n' | ...
17229
17230   This command turns blanks into newlines.  The ‘-s’ option squeezes
17231multiple newline characters in the output into just one, removing blank
17232lines.  (The ‘>’ is the shell’s “secondary prompt.” This is what the
17233shell prints when it notices you haven’t finished typing in all of a
17234command.)
17235
17236   We now have data consisting of one word per line, no punctuation, all
17237one case.  We’re ready to count each word:
17238
17239     $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' |
17240     > tr -s ' ' '\n' | sort | uniq -c | ...
17241
17242   At this point, the data might look something like this:
17243
17244          60 a
17245           2 able
17246           6 about
17247           1 above
17248           2 accomplish
17249           1 acquire
17250           1 actually
17251           2 additional
17252
17253   The output is sorted by word, not by count!  What we want is the most
17254frequently used words first.  Fortunately, this is easy to accomplish,
17255with the help of two more ‘sort’ options:
17256
17257‘-n’
17258     do a numeric sort, not a textual one
17259
17260‘-r’
17261     reverse the order of the sort
17262
17263   The final pipeline looks like this:
17264
17265     $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' |
17266     > tr -s ' ' '\n' | sort | uniq -c | sort -n -r
17267     ⊣    156 the
17268     ⊣     60 a
17269     ⊣     58 to
17270     ⊣     51 of
17271     ⊣     51 and
17272     ...
17273
17274   Whew!  That’s a lot to digest.  Yet, the same principles apply.  With
17275six commands, on two lines (really one long one split for convenience),
17276we’ve created a program that does something interesting and useful, in
17277much less time than we could have written a C program to do the same
17278thing.
17279
17280   A minor modification to the above pipeline can give us a simple
17281spelling checker!  To determine if you’ve spelled a word correctly, all
17282you have to do is look it up in a dictionary.  If it is not there, then
17283chances are that your spelling is incorrect.  So, we need a dictionary.
17284The conventional location for a dictionary is ‘/usr/dict/words’.  On my
17285GNU/Linux system,(1) this is a sorted, 45,402 word dictionary.
17286
17287   Now, how to compare our file with the dictionary?  As before, we
17288generate a sorted list of words, one per line:
17289
17290     $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' |
17291     > tr -s ' ' '\n' | sort -u | ...
17292
17293   Now, all we need is a list of words that are _not_ in the dictionary.
17294Here is where the ‘comm’ command comes in.
17295
17296     $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' |
17297     > tr -s ' ' '\n' | sort -u |
17298     > comm -23 - /usr/dict/words
17299
17300   The ‘-2’ and ‘-3’ options eliminate lines that are only in the
17301dictionary (the second file), and lines that are in both files.  Lines
17302only in the first file (standard input, our stream of words), are words
17303that are not in the dictionary.  These are likely candidates for
17304spelling errors.  This pipeline was the first cut at a production
17305spelling checker on Unix.
17306
17307   There are some other tools that deserve brief mention.
17308
17309‘grep’
17310     search files for text that matches a regular expression
17311
17312‘wc’
17313     count lines, words, characters
17314
17315‘tee’
17316     a T-fitting for data pipes, copies data to files and to standard
17317     output
17318
17319‘sed’
17320     the stream editor, an advanced tool
17321
17322‘awk’
17323     a data manipulation language, another advanced tool
17324
17325   The software tools philosophy also espoused the following bit of
17326advice: “Let someone else do the hard part.” This means, take something
17327that gives you most of what you need, and then massage it the rest of
17328the way until it’s in the form that you want.
17329
17330   To summarize:
17331
17332  1. Each program should do one thing well.  No more, no less.
17333
17334  2. Combining programs with appropriate plumbing leads to results where
17335     the whole is greater than the sum of the parts.  It also leads to
17336     novel uses of programs that the authors might never have imagined.
17337
17338  3. Programs should never print extraneous header or trailer data,
17339     since these could get sent on down a pipeline.  (A point we didn’t
17340     mention earlier.)
17341
17342  4. Let someone else do the hard part.
17343
17344  5. Know your toolbox!  Use each program appropriately.  If you don’t
17345     have an appropriate tool, build one.
17346
17347   All the programs discussed are available as described in GNU core
17348utilities (https://www.gnu.org/software/coreutils/coreutils.html).
17349
17350   None of what I have presented in this column is new.  The Software
17351Tools philosophy was first introduced in the book ‘Software Tools’, by
17352Brian Kernighan and P.J. Plauger (Addison-Wesley, ISBN 0-201-03669-X).
17353This book showed how to write and use software tools.  It was written in
173541976, using a preprocessor for FORTRAN named ‘ratfor’ (RATional
17355FORtran).  At the time, C was not as ubiquitous as it is now; FORTRAN
17356was.  The last chapter presented a ‘ratfor’ to FORTRAN processor,
17357written in ‘ratfor’.  ‘ratfor’ looks an awful lot like C; if you know C,
17358you won’t have any problem following the code.
17359
17360   In 1981, the book was updated and made available as ‘Software Tools
17361in Pascal’ (Addison-Wesley, ISBN 0-201-10342-7).  Both books are still
17362in print and are well worth reading if you’re a programmer.  They
17363certainly made a major change in how I view programming.
17364
17365   The programs in both books are available from Brian Kernighan’s home
17366page (https://www.cs.princeton.edu/~bwk/).  For a number of years, there
17367was an active Software Tools Users Group, whose members had ported the
17368original ‘ratfor’ programs to essentially every computer system with a
17369FORTRAN compiler.  The popularity of the group waned in the middle 1980s
17370as Unix began to spread beyond universities.
17371
17372   With the current proliferation of GNU code and other clones of Unix
17373programs, these programs now receive little attention; modern C versions
17374are much more efficient and do more than these programs do.
17375Nevertheless, as exposition of good programming style, and evangelism
17376for a still-valuable philosophy, these books are unparalleled, and I
17377recommend them highly.
17378
17379   Acknowledgment: I would like to express my gratitude to Brian
17380Kernighan of Bell Labs, the original Software Toolsmith, for reviewing
17381this column.
17382
17383   ---------- Footnotes ----------
17384
17385   (1) Redhat Linux 6.1, for the November 2000 revision of this article.
17386
17387
17388File: coreutils.info,  Node: GNU Free Documentation License,  Next: Concept index,  Prev: Opening the software toolbox,  Up: Top
17389
17390Appendix A GNU Free Documentation License
17391*****************************************
17392
17393                     Version 1.3, 3 November 2008
17394
17395     Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
17396     <https://fsf.org/>
17397
17398     Everyone is permitted to copy and distribute verbatim copies
17399     of this license document, but changing it is not allowed.
17400
17401  0. PREAMBLE
17402
17403     The purpose of this License is to make a manual, textbook, or other
17404     functional and useful document “free” in the sense of freedom: to
17405     assure everyone the effective freedom to copy and redistribute it,
17406     with or without modifying it, either commercially or
17407     noncommercially.  Secondarily, this License preserves for the
17408     author and publisher a way to get credit for their work, while not
17409     being considered responsible for modifications made by others.
17410
17411     This License is a kind of “copyleft”, which means that derivative
17412     works of the document must themselves be free in the same sense.
17413     It complements the GNU General Public License, which is a copyleft
17414     license designed for free software.
17415
17416     We have designed this License in order to use it for manuals for
17417     free software, because free software needs free documentation: a
17418     free program should come with manuals providing the same freedoms
17419     that the software does.  But this License is not limited to
17420     software manuals; it can be used for any textual work, regardless
17421     of subject matter or whether it is published as a printed book.  We
17422     recommend this License principally for works whose purpose is
17423     instruction or reference.
17424
17425  1. APPLICABILITY AND DEFINITIONS
17426
17427     This License applies to any manual or other work, in any medium,
17428     that contains a notice placed by the copyright holder saying it can
17429     be distributed under the terms of this License.  Such a notice
17430     grants a world-wide, royalty-free license, unlimited in duration,
17431     to use that work under the conditions stated herein.  The
17432     “Document”, below, refers to any such manual or work.  Any member
17433     of the public is a licensee, and is addressed as “you”.  You accept
17434     the license if you copy, modify or distribute the work in a way
17435     requiring permission under copyright law.
17436
17437     A “Modified Version” of the Document means any work containing the
17438     Document or a portion of it, either copied verbatim, or with
17439     modifications and/or translated into another language.
17440
17441     A “Secondary Section” is a named appendix or a front-matter section
17442     of the Document that deals exclusively with the relationship of the
17443     publishers or authors of the Document to the Document’s overall
17444     subject (or to related matters) and contains nothing that could
17445     fall directly within that overall subject.  (Thus, if the Document
17446     is in part a textbook of mathematics, a Secondary Section may not
17447     explain any mathematics.)  The relationship could be a matter of
17448     historical connection with the subject or with related matters, or
17449     of legal, commercial, philosophical, ethical or political position
17450     regarding them.
17451
17452     The “Invariant Sections” are certain Secondary Sections whose
17453     titles are designated, as being those of Invariant Sections, in the
17454     notice that says that the Document is released under this License.
17455     If a section does not fit the above definition of Secondary then it
17456     is not allowed to be designated as Invariant.  The Document may
17457     contain zero Invariant Sections.  If the Document does not identify
17458     any Invariant Sections then there are none.
17459
17460     The “Cover Texts” are certain short passages of text that are
17461     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
17462     that says that the Document is released under this License.  A
17463     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
17464     be at most 25 words.
17465
17466     A “Transparent” copy of the Document means a machine-readable copy,
17467     represented in a format whose specification is available to the
17468     general public, that is suitable for revising the document
17469     straightforwardly with generic text editors or (for images composed
17470     of pixels) generic paint programs or (for drawings) some widely
17471     available drawing editor, and that is suitable for input to text
17472     formatters or for automatic translation to a variety of formats
17473     suitable for input to text formatters.  A copy made in an otherwise
17474     Transparent file format whose markup, or absence of markup, has
17475     been arranged to thwart or discourage subsequent modification by
17476     readers is not Transparent.  An image format is not Transparent if
17477     used for any substantial amount of text.  A copy that is not
17478     “Transparent” is called “Opaque”.
17479
17480     Examples of suitable formats for Transparent copies include plain
17481     ASCII without markup, Texinfo input format, LaTeX input format,
17482     SGML or XML using a publicly available DTD, and standard-conforming
17483     simple HTML, PostScript or PDF designed for human modification.
17484     Examples of transparent image formats include PNG, XCF and JPG.
17485     Opaque formats include proprietary formats that can be read and
17486     edited only by proprietary word processors, SGML or XML for which
17487     the DTD and/or processing tools are not generally available, and
17488     the machine-generated HTML, PostScript or PDF produced by some word
17489     processors for output purposes only.
17490
17491     The “Title Page” means, for a printed book, the title page itself,
17492     plus such following pages as are needed to hold, legibly, the
17493     material this License requires to appear in the title page.  For
17494     works in formats which do not have any title page as such, “Title
17495     Page” means the text near the most prominent appearance of the
17496     work’s title, preceding the beginning of the body of the text.
17497
17498     The “publisher” means any person or entity that distributes copies
17499     of the Document to the public.
17500
17501     A section “Entitled XYZ” means a named subunit of the Document
17502     whose title either is precisely XYZ or contains XYZ in parentheses
17503     following text that translates XYZ in another language.  (Here XYZ
17504     stands for a specific section name mentioned below, such as
17505     “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.)
17506     To “Preserve the Title” of such a section when you modify the
17507     Document means that it remains a section “Entitled XYZ” according
17508     to this definition.
17509
17510     The Document may include Warranty Disclaimers next to the notice
17511     which states that this License applies to the Document.  These
17512     Warranty Disclaimers are considered to be included by reference in
17513     this License, but only as regards disclaiming warranties: any other
17514     implication that these Warranty Disclaimers may have is void and
17515     has no effect on the meaning of this License.
17516
17517  2. VERBATIM COPYING
17518
17519     You may copy and distribute the Document in any medium, either
17520     commercially or noncommercially, provided that this License, the
17521     copyright notices, and the license notice saying this License
17522     applies to the Document are reproduced in all copies, and that you
17523     add no other conditions whatsoever to those of this License.  You
17524     may not use technical measures to obstruct or control the reading
17525     or further copying of the copies you make or distribute.  However,
17526     you may accept compensation in exchange for copies.  If you
17527     distribute a large enough number of copies you must also follow the
17528     conditions in section 3.
17529
17530     You may also lend copies, under the same conditions stated above,
17531     and you may publicly display copies.
17532
17533  3. COPYING IN QUANTITY
17534
17535     If you publish printed copies (or copies in media that commonly
17536     have printed covers) of the Document, numbering more than 100, and
17537     the Document’s license notice requires Cover Texts, you must
17538     enclose the copies in covers that carry, clearly and legibly, all
17539     these Cover Texts: Front-Cover Texts on the front cover, and
17540     Back-Cover Texts on the back cover.  Both covers must also clearly
17541     and legibly identify you as the publisher of these copies.  The
17542     front cover must present the full title with all words of the title
17543     equally prominent and visible.  You may add other material on the
17544     covers in addition.  Copying with changes limited to the covers, as
17545     long as they preserve the title of the Document and satisfy these
17546     conditions, can be treated as verbatim copying in other respects.
17547
17548     If the required texts for either cover are too voluminous to fit
17549     legibly, you should put the first ones listed (as many as fit
17550     reasonably) on the actual cover, and continue the rest onto
17551     adjacent pages.
17552
17553     If you publish or distribute Opaque copies of the Document
17554     numbering more than 100, you must either include a machine-readable
17555     Transparent copy along with each Opaque copy, or state in or with
17556     each Opaque copy a computer-network location from which the general
17557     network-using public has access to download using public-standard
17558     network protocols a complete Transparent copy of the Document, free
17559     of added material.  If you use the latter option, you must take
17560     reasonably prudent steps, when you begin distribution of Opaque
17561     copies in quantity, to ensure that this Transparent copy will
17562     remain thus accessible at the stated location until at least one
17563     year after the last time you distribute an Opaque copy (directly or
17564     through your agents or retailers) of that edition to the public.
17565
17566     It is requested, but not required, that you contact the authors of
17567     the Document well before redistributing any large number of copies,
17568     to give them a chance to provide you with an updated version of the
17569     Document.
17570
17571  4. MODIFICATIONS
17572
17573     You may copy and distribute a Modified Version of the Document
17574     under the conditions of sections 2 and 3 above, provided that you
17575     release the Modified Version under precisely this License, with the
17576     Modified Version filling the role of the Document, thus licensing
17577     distribution and modification of the Modified Version to whoever
17578     possesses a copy of it.  In addition, you must do these things in
17579     the Modified Version:
17580
17581       A. Use in the Title Page (and on the covers, if any) a title
17582          distinct from that of the Document, and from those of previous
17583          versions (which should, if there were any, be listed in the
17584          History section of the Document).  You may use the same title
17585          as a previous version if the original publisher of that
17586          version gives permission.
17587
17588       B. List on the Title Page, as authors, one or more persons or
17589          entities responsible for authorship of the modifications in
17590          the Modified Version, together with at least five of the
17591          principal authors of the Document (all of its principal
17592          authors, if it has fewer than five), unless they release you
17593          from this requirement.
17594
17595       C. State on the Title page the name of the publisher of the
17596          Modified Version, as the publisher.
17597
17598       D. Preserve all the copyright notices of the Document.
17599
17600       E. Add an appropriate copyright notice for your modifications
17601          adjacent to the other copyright notices.
17602
17603       F. Include, immediately after the copyright notices, a license
17604          notice giving the public permission to use the Modified
17605          Version under the terms of this License, in the form shown in
17606          the Addendum below.
17607
17608       G. Preserve in that license notice the full lists of Invariant
17609          Sections and required Cover Texts given in the Document’s
17610          license notice.
17611
17612       H. Include an unaltered copy of this License.
17613
17614       I. Preserve the section Entitled “History”, Preserve its Title,
17615          and add to it an item stating at least the title, year, new
17616          authors, and publisher of the Modified Version as given on the
17617          Title Page.  If there is no section Entitled “History” in the
17618          Document, create one stating the title, year, authors, and
17619          publisher of the Document as given on its Title Page, then add
17620          an item describing the Modified Version as stated in the
17621          previous sentence.
17622
17623       J. Preserve the network location, if any, given in the Document
17624          for public access to a Transparent copy of the Document, and
17625          likewise the network locations given in the Document for
17626          previous versions it was based on.  These may be placed in the
17627          “History” section.  You may omit a network location for a work
17628          that was published at least four years before the Document
17629          itself, or if the original publisher of the version it refers
17630          to gives permission.
17631
17632       K. For any section Entitled “Acknowledgements” or “Dedications”,
17633          Preserve the Title of the section, and preserve in the section
17634          all the substance and tone of each of the contributor
17635          acknowledgements and/or dedications given therein.
17636
17637       L. Preserve all the Invariant Sections of the Document, unaltered
17638          in their text and in their titles.  Section numbers or the
17639          equivalent are not considered part of the section titles.
17640
17641       M. Delete any section Entitled “Endorsements”.  Such a section
17642          may not be included in the Modified Version.
17643
17644       N. Do not retitle any existing section to be Entitled
17645          “Endorsements” or to conflict in title with any Invariant
17646          Section.
17647
17648       O. Preserve any Warranty Disclaimers.
17649
17650     If the Modified Version includes new front-matter sections or
17651     appendices that qualify as Secondary Sections and contain no
17652     material copied from the Document, you may at your option designate
17653     some or all of these sections as invariant.  To do this, add their
17654     titles to the list of Invariant Sections in the Modified Version’s
17655     license notice.  These titles must be distinct from any other
17656     section titles.
17657
17658     You may add a section Entitled “Endorsements”, provided it contains
17659     nothing but endorsements of your Modified Version by various
17660     parties—for example, statements of peer review or that the text has
17661     been approved by an organization as the authoritative definition of
17662     a standard.
17663
17664     You may add a passage of up to five words as a Front-Cover Text,
17665     and a passage of up to 25 words as a Back-Cover Text, to the end of
17666     the list of Cover Texts in the Modified Version.  Only one passage
17667     of Front-Cover Text and one of Back-Cover Text may be added by (or
17668     through arrangements made by) any one entity.  If the Document
17669     already includes a cover text for the same cover, previously added
17670     by you or by arrangement made by the same entity you are acting on
17671     behalf of, you may not add another; but you may replace the old
17672     one, on explicit permission from the previous publisher that added
17673     the old one.
17674
17675     The author(s) and publisher(s) of the Document do not by this
17676     License give permission to use their names for publicity for or to
17677     assert or imply endorsement of any Modified Version.
17678
17679  5. COMBINING DOCUMENTS
17680
17681     You may combine the Document with other documents released under
17682     this License, under the terms defined in section 4 above for
17683     modified versions, provided that you include in the combination all
17684     of the Invariant Sections of all of the original documents,
17685     unmodified, and list them all as Invariant Sections of your
17686     combined work in its license notice, and that you preserve all
17687     their Warranty Disclaimers.
17688
17689     The combined work need only contain one copy of this License, and
17690     multiple identical Invariant Sections may be replaced with a single
17691     copy.  If there are multiple Invariant Sections with the same name
17692     but different contents, make the title of each such section unique
17693     by adding at the end of it, in parentheses, the name of the
17694     original author or publisher of that section if known, or else a
17695     unique number.  Make the same adjustment to the section titles in
17696     the list of Invariant Sections in the license notice of the
17697     combined work.
17698
17699     In the combination, you must combine any sections Entitled
17700     “History” in the various original documents, forming one section
17701     Entitled “History”; likewise combine any sections Entitled
17702     “Acknowledgements”, and any sections Entitled “Dedications”.  You
17703     must delete all sections Entitled “Endorsements.”
17704
17705  6. COLLECTIONS OF DOCUMENTS
17706
17707     You may make a collection consisting of the Document and other
17708     documents released under this License, and replace the individual
17709     copies of this License in the various documents with a single copy
17710     that is included in the collection, provided that you follow the
17711     rules of this License for verbatim copying of each of the documents
17712     in all other respects.
17713
17714     You may extract a single document from such a collection, and
17715     distribute it individually under this License, provided you insert
17716     a copy of this License into the extracted document, and follow this
17717     License in all other respects regarding verbatim copying of that
17718     document.
17719
17720  7. AGGREGATION WITH INDEPENDENT WORKS
17721
17722     A compilation of the Document or its derivatives with other
17723     separate and independent documents or works, in or on a volume of a
17724     storage or distribution medium, is called an “aggregate” if the
17725     copyright resulting from the compilation is not used to limit the
17726     legal rights of the compilation’s users beyond what the individual
17727     works permit.  When the Document is included in an aggregate, this
17728     License does not apply to the other works in the aggregate which
17729     are not themselves derivative works of the Document.
17730
17731     If the Cover Text requirement of section 3 is applicable to these
17732     copies of the Document, then if the Document is less than one half
17733     of the entire aggregate, the Document’s Cover Texts may be placed
17734     on covers that bracket the Document within the aggregate, or the
17735     electronic equivalent of covers if the Document is in electronic
17736     form.  Otherwise they must appear on printed covers that bracket
17737     the whole aggregate.
17738
17739  8. TRANSLATION
17740
17741     Translation is considered a kind of modification, so you may
17742     distribute translations of the Document under the terms of section
17743     4.  Replacing Invariant Sections with translations requires special
17744     permission from their copyright holders, but you may include
17745     translations of some or all Invariant Sections in addition to the
17746     original versions of these Invariant Sections.  You may include a
17747     translation of this License, and all the license notices in the
17748     Document, and any Warranty Disclaimers, provided that you also
17749     include the original English version of this License and the
17750     original versions of those notices and disclaimers.  In case of a
17751     disagreement between the translation and the original version of
17752     this License or a notice or disclaimer, the original version will
17753     prevail.
17754
17755     If a section in the Document is Entitled “Acknowledgements”,
17756     “Dedications”, or “History”, the requirement (section 4) to
17757     Preserve its Title (section 1) will typically require changing the
17758     actual title.
17759
17760  9. TERMINATION
17761
17762     You may not copy, modify, sublicense, or distribute the Document
17763     except as expressly provided under this License.  Any attempt
17764     otherwise to copy, modify, sublicense, or distribute it is void,
17765     and will automatically terminate your rights under this License.
17766
17767     However, if you cease all violation of this License, then your
17768     license from a particular copyright holder is reinstated (a)
17769     provisionally, unless and until the copyright holder explicitly and
17770     finally terminates your license, and (b) permanently, if the
17771     copyright holder fails to notify you of the violation by some
17772     reasonable means prior to 60 days after the cessation.
17773
17774     Moreover, your license from a particular copyright holder is
17775     reinstated permanently if the copyright holder notifies you of the
17776     violation by some reasonable means, this is the first time you have
17777     received notice of violation of this License (for any work) from
17778     that copyright holder, and you cure the violation prior to 30 days
17779     after your receipt of the notice.
17780
17781     Termination of your rights under this section does not terminate
17782     the licenses of parties who have received copies or rights from you
17783     under this License.  If your rights have been terminated and not
17784     permanently reinstated, receipt of a copy of some or all of the
17785     same material does not give you any rights to use it.
17786
17787  10. FUTURE REVISIONS OF THIS LICENSE
17788
17789     The Free Software Foundation may publish new, revised versions of
17790     the GNU Free Documentation License from time to time.  Such new
17791     versions will be similar in spirit to the present version, but may
17792     differ in detail to address new problems or concerns.  See
17793     <https://www.gnu.org/copyleft/>.
17794
17795     Each version of the License is given a distinguishing version
17796     number.  If the Document specifies that a particular numbered
17797     version of this License “or any later version” applies to it, you
17798     have the option of following the terms and conditions either of
17799     that specified version or of any later version that has been
17800     published (not as a draft) by the Free Software Foundation.  If the
17801     Document does not specify a version number of this License, you may
17802     choose any version ever published (not as a draft) by the Free
17803     Software Foundation.  If the Document specifies that a proxy can
17804     decide which future versions of this License can be used, that
17805     proxy’s public statement of acceptance of a version permanently
17806     authorizes you to choose that version for the Document.
17807
17808  11. RELICENSING
17809
17810     “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
17811     World Wide Web server that publishes copyrightable works and also
17812     provides prominent facilities for anybody to edit those works.  A
17813     public wiki that anybody can edit is an example of such a server.
17814     A “Massive Multiauthor Collaboration” (or “MMC”) contained in the
17815     site means any set of copyrightable works thus published on the MMC
17816     site.
17817
17818     “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
17819     license published by Creative Commons Corporation, a not-for-profit
17820     corporation with a principal place of business in San Francisco,
17821     California, as well as future copyleft versions of that license
17822     published by that same organization.
17823
17824     “Incorporate” means to publish or republish a Document, in whole or
17825     in part, as part of another Document.
17826
17827     An MMC is “eligible for relicensing” if it is licensed under this
17828     License, and if all works that were first published under this
17829     License somewhere other than this MMC, and subsequently
17830     incorporated in whole or in part into the MMC, (1) had no cover
17831     texts or invariant sections, and (2) were thus incorporated prior
17832     to November 1, 2008.
17833
17834     The operator of an MMC Site may republish an MMC contained in the
17835     site under CC-BY-SA on the same site at any time before August 1,
17836     2009, provided the MMC is eligible for relicensing.
17837
17838ADDENDUM: How to use this License for your documents
17839====================================================
17840
17841To use this License in a document you have written, include a copy of
17842the License in the document and put the following copyright and license
17843notices just after the title page:
17844
17845       Copyright (C)  YEAR  YOUR NAME.
17846       Permission is granted to copy, distribute and/or modify this document
17847       under the terms of the GNU Free Documentation License, Version 1.3
17848       or any later version published by the Free Software Foundation;
17849       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
17850       Texts.  A copy of the license is included in the section entitled ``GNU
17851       Free Documentation License''.
17852
17853   If you have Invariant Sections, Front-Cover Texts and Back-Cover
17854Texts, replace the “with...Texts.” line with this:
17855
17856         with the Invariant Sections being LIST THEIR TITLES, with
17857         the Front-Cover Texts being LIST, and with the Back-Cover Texts
17858         being LIST.
17859
17860   If you have Invariant Sections without Cover Texts, or some other
17861combination of the three, merge those two alternatives to suit the
17862situation.
17863
17864   If your document contains nontrivial examples of program code, we
17865recommend releasing these examples in parallel under your choice of free
17866software license, such as the GNU General Public License, to permit
17867their use in free software.
17868
17869
17870File: coreutils.info,  Node: Concept index,  Prev: GNU Free Documentation License,  Up: Top
17871
17872Index
17873*****
17874
17875�[index�]
17876* Menu:
17877
17878* !:                                     Connectives for test.
17879                                                              (line  23)
17880* !=:                                    String tests.        (line  28)
17881* %:                                     Numeric expressions. (line  16)
17882* %b:                                    printf invocation.   (line  37)
17883* %q:                                    printf invocation.   (line  44)
17884* &:                                     Relations for expr.  (line  17)
17885* *:                                     Numeric expressions. (line  16)
17886* +:                                     String expressions.  (line  53)
17887* + <1>:                                 Numeric expressions. (line  12)
17888* +PAGE_RANGE:                           pr invocation.       (line  39)
17889* -:                                     Numeric expressions. (line  12)
17890* - <1>:                                 env invocation.      (line 102)
17891* - and Unix rm:                         rm invocation.       (line 113)
17892* -, removing files beginning with:      rm invocation.       (line 101)
17893* --:                                    Common options.      (line  43)
17894* --across:                              pr invocation.       (line  62)
17895* --additional-suffix:                   split invocation.    (line 135)
17896* --address-radix:                       od invocation.       (line  36)
17897* --adjustment:                          nice invocation.     (line  51)
17898* --all:                                 unexpand invocation. (line  51)
17899* --all <1>:                             Which files are listed.
17900                                                              (line  13)
17901* --all <2>:                             df invocation.       (line  42)
17902* --all <3>:                             du invocation.       (line  32)
17903* --all <4>:                             stty invocation.     (line  26)
17904* --all <5>:                             who invocation.      (line  35)
17905* --all <6>:                             nproc invocation.    (line  20)
17906* --all <7>:                             uname invocation.    (line  30)
17907* --all-repeated:                        uniq invocation.     (line  69)
17908* --almost-all:                          Which files are listed.
17909                                                              (line  17)
17910* --apparent-size:                       du invocation.       (line  35)
17911* --append:                              tee invocation.      (line  27)
17912* --archive:                             cp invocation.       (line  63)
17913* --attributes-only:                     cp invocation.       (line  72)
17914* --author:                              What information is listed.
17915                                                              (line  10)
17916* --auto-reference:                      Output formatting in ptx.
17917                                                              (line  45)
17918* --backup:                              Backup options.      (line  13)
17919* --backup <1>:                          cp invocation.       (line  79)
17920* --backup <2>:                          install invocation.  (line  41)
17921* --backup <3>:                          mv invocation.       (line  59)
17922* --backup <4>:                          ln invocation.       (line  82)
17923* --base16:                              basenc invocation.   (line  49)
17924* --base2lsbf:                           basenc invocation.   (line  55)
17925* --base2msbf:                           basenc invocation.   (line  59)
17926* --base32:                              basenc invocation.   (line  35)
17927* --base32hex:                           basenc invocation.   (line  42)
17928* --base64:                              basenc invocation.   (line  23)
17929* --base64url:                           basenc invocation.   (line  29)
17930* --batch-size:                          sort invocation.     (line 262)
17931* --before:                              tac invocation.      (line  21)
17932* --binary:                              md5sum invocation.   (line  41)
17933* --block-size:                          Block size.          (line 121)
17934* --block-size <1>:                      df invocation.       (line  54)
17935* --block-size <2>:                      du invocation.       (line  52)
17936* --block-size=SIZE:                     Block size.          (line  12)
17937* --body-numbering:                      nl invocation.       (line  45)
17938* --boot:                                who invocation.      (line  39)
17939* --bourne-shell:                        dircolors invocation.
17940                                                              (line  34)
17941* --break-file:                          Input processing in ptx.
17942                                                              (line   8)
17943* --buffer-size:                         sort invocation.     (line 316)
17944* --bytes:                               fold invocation.     (line  23)
17945* --bytes <1>:                           head invocation.     (line  24)
17946* --bytes <2>:                           tail invocation.     (line  39)
17947* --bytes <3>:                           split invocation.    (line  41)
17948* --bytes <4>:                           wc invocation.       (line  43)
17949* --bytes <5>:                           cut invocation.      (line  26)
17950* --bytes <6>:                           du invocation.       (line  57)
17951* --c-shell:                             dircolors invocation.
17952                                                              (line  40)
17953* --cached=MODE:                         stat invocation.     (line  33)
17954* --canonicalize:                        readlink invocation. (line  31)
17955* --canonicalize-existing:               readlink invocation. (line  38)
17956* --canonicalize-existing <1>:           realpath invocation. (line  22)
17957* --canonicalize-missing:                readlink invocation. (line  45)
17958* --canonicalize-missing <1>:            realpath invocation. (line  30)
17959* --changes:                             chown invocation.    (line  73)
17960* --changes <1>:                         chgrp invocation.    (line  24)
17961* --changes <2>:                         chmod invocation.    (line  43)
17962* --characters:                          cut invocation.      (line  34)
17963* --chars:                               wc invocation.       (line  47)
17964* --chdir:                               env invocation.      (line 107)
17965* --check:                               sort invocation.     (line  39)
17966* --check <1>:                           sort invocation.     (line  47)
17967* --check-chars:                         uniq invocation.     (line 133)
17968* --classify:                            General output formatting.
17969                                                              (line  46)
17970* --color:                               General output formatting.
17971                                                              (line  22)
17972* --columns:                             pr invocation.       (line  49)
17973* --compare:                             install invocation.  (line  46)
17974* --complement:                          cut invocation.      (line  86)
17975* --compute:                             runcon invocation.   (line  32)
17976* --context:                             What information is listed.
17977                                                              (line 259)
17978* --context <1>:                         cp invocation.       (line 384)
17979* --context <2>:                         install invocation.  (line 139)
17980* --context <3>:                         mv invocation.       (line 117)
17981* --context <4>:                         mkdir invocation.    (line  56)
17982* --context <5>:                         mkfifo invocation.   (line  28)
17983* --context <6>:                         mknod invocation.    (line  53)
17984* --context <7>:                         id invocation.       (line  51)
17985* --count:                               uniq invocation.     (line  55)
17986* --count <1>:                           who invocation.      (line  69)
17987* --count-links:                         du invocation.       (line 123)
17988* --crown-margin:                        fmt invocation.      (line  34)
17989* --csh:                                 dircolors invocation.
17990                                                              (line  40)
17991* --data:                                sync invocation.     (line  32)
17992* --date:                                touch invocation.    (line  56)
17993* --date <1>:                            Options for date.    (line  11)
17994* --dead:                                who invocation.      (line  43)
17995* --debug:                               Options for date.    (line  25)
17996* --debug <1>:                           env invocation.      (line 173)
17997* --debug <2>:                           numfmt invocation.   (line  29)
17998* --decode:                              base64 invocation.   (line  30)
17999* --delimiter:                           cut invocation.      (line  66)
18000* --delimiter <1>:                       numfmt invocation.   (line  34)
18001* --delimiters:                          paste invocation.    (line  61)
18002* --dereference:                         Which files are listed.
18003                                                              (line  83)
18004* --dereference <1>:                     cp invocation.       (line 149)
18005* --dereference <2>:                     chown invocation.    (line 106)
18006* --dereference <3>:                     chgrp invocation.    (line  34)
18007* --dereference <4>:                     du invocation.       (line 117)
18008* --dereference <5>:                     stat invocation.     (line  22)
18009* --dereference <6>:                     chcon invocation.    (line  21)
18010* --dereference-args:                    du invocation.       (line  67)
18011* --dereference-command-line:            Which files are listed.
18012                                                              (line  36)
18013* --dereference-command-line-symlink-to-dir: Which files are listed.
18014                                                              (line  41)
18015* --dictionary-order:                    sort invocation.     (line  87)
18016* --digits:                              csplit invocation.   (line  81)
18017* --dir:                                 rm invocation.       (line  35)
18018* --directory:                           Which files are listed.
18019                                                              (line  28)
18020* --directory <1>:                       install invocation.  (line  67)
18021* --directory <2>:                       ln invocation.       (line  88)
18022* --directory <3>:                       mktemp invocation.   (line  85)
18023* --dired:                               What information is listed.
18024                                                              (line  16)
18025* --double-space:                        pr invocation.       (line  74)
18026* --dry-run:                             mktemp invocation.   (line  97)
18027* --echo:                                shuf invocation.     (line  19)
18028* --elide-empty-files:                   split invocation.    (line 140)
18029* --elide-empty-files <1>:               csplit invocation.   (line  95)
18030* --endian:                              od invocation.       (line  51)
18031* --equal-width:                         seq invocation.      (line  49)
18032* --error:                               stdbuf invocation.   (line  34)
18033* --escape:                              Formatting the file names.
18034                                                              (line  11)
18035* --exact:                               shred invocation.    (line 164)
18036* --exclude-from=FILE:                   du invocation.       (line 252)
18037* --exclude-type:                        df invocation.       (line 223)
18038* --exclude=PATTERN:                     du invocation.       (line 257)
18039* --expand-tabs:                         pr invocation.       (line  98)
18040* --field:                               numfmt invocation.   (line  38)
18041* --field-separator:                     sort invocation.     (line 332)
18042* --fields:                              cut invocation.      (line  43)
18043* --file:                                stty invocation.     (line  31)
18044* --file <1>:                            Options for date.    (line  30)
18045* --file-system:                         stat invocation.     (line  28)
18046* --file-system <1>:                     sync invocation.     (line  37)
18047* --file-type:                           General output formatting.
18048                                                              (line  57)
18049* --files0-from=FILE:                    wc invocation.       (line  64)
18050* --files0-from=FILE <1>:                sort invocation.     (line 218)
18051* --files0-from=FILE <2>:                du invocation.       (line  79)
18052* --filter:                              split invocation.    (line  63)
18053* --first-line-number:                   pr invocation.       (line 174)
18054* --flag-truncation:                     Output formatting in ptx.
18055                                                              (line  71)
18056* --follow:                              tail invocation.     (line  56)
18057* --footer-numbering:                    nl invocation.       (line  70)
18058* --force:                               cp invocation.       (line 115)
18059* --force <1>:                           mv invocation.       (line  64)
18060* --force <2>:                           rm invocation.       (line  39)
18061* --force <3>:                           shred invocation.    (line 123)
18062* --force <4>:                           ln invocation.       (line  94)
18063* --foreground:                          timeout invocation.  (line  24)
18064* --form-feed:                           pr invocation.       (line 106)
18065* --format:                              od invocation.       (line  90)
18066* --format <1>:                          What information is listed.
18067                                                              (line 131)
18068* --format <2>:                          General output formatting.
18069                                                              (line  10)
18070* --format <3>:                          General output formatting.
18071                                                              (line  16)
18072* --format <4>:                          General output formatting.
18073                                                              (line 103)
18074* --format <5>:                          General output formatting.
18075                                                              (line 113)
18076* --format <6>:                          numfmt invocation.   (line  48)
18077* --format <7>:                          seq invocation.      (line  28)
18078* --format=FORMAT:                       stat invocation.     (line  49)
18079* --format=roff:                         Output formatting in ptx.
18080                                                              (line 100)
18081* --format=tex:                          Output formatting in ptx.
18082                                                              (line 118)
18083* --from:                                chown invocation.    (line  83)
18084* --from <1>:                            numfmt invocation.   (line  59)
18085* --from-unit:                           numfmt invocation.   (line  64)
18086* --full-time:                           What information is listed.
18087                                                              (line 100)
18088* --gap-size:                            Output formatting in ptx.
18089                                                              (line  26)
18090* --general-numeric-sort:                sort invocation.     (line 105)
18091* --goal:                                fmt invocation.      (line  64)
18092* --group:                               uniq invocation.     (line 100)
18093* --group <1>:                           install invocation.  (line  73)
18094* --group <2>:                           id invocation.       (line  29)
18095* --group-directories-first:             Which files are listed.
18096                                                              (line  50)
18097* --grouping:                            numfmt invocation.   (line  70)
18098* --groups:                              id invocation.       (line  33)
18099* --groups <1>:                          chroot invocation.   (line  24)
18100* --hardware-platform:                   uname invocation.    (line  35)
18101* --head-count:                          shuf invocation.     (line  31)
18102* --header:                              pr invocation.       (line 111)
18103* --header <1>:                          General options in join.
18104                                                              (line  25)
18105* --header <2>:                          numfmt invocation.   (line  76)
18106* --header-numbering:                    nl invocation.       (line  74)
18107* --header=N:                            numfmt invocation.   (line  76)
18108* --heading:                             who invocation.      (line  47)
18109* --help:                                Common options.      (line  36)
18110* --hex-suffixes:                        split invocation.    (line 131)
18111* --hide-control-chars:                  Formatting the file names.
18112                                                              (line  23)
18113* --hide=PATTERN:                        Which files are listed.
18114                                                              (line  57)
18115* --human-numeric-sort:                  sort invocation.     (line 126)
18116* --human-readable:                      Block size.          (line 121)
18117* --human-readable <1>:                  What information is listed.
18118                                                              (line 116)
18119* --human-readable <2>:                  df invocation.       (line  59)
18120* --human-readable <3>:                  du invocation.       (line  96)
18121* --hyperlink:                           General output formatting.
18122                                                              (line  61)
18123* --ignore:                              nproc invocation.    (line  26)
18124* --ignore-backups:                      Which files are listed.
18125                                                              (line  23)
18126* --ignore-case:                         sort invocation.     (line  94)
18127* --ignore-case <1>:                     uniq invocation.     (line  59)
18128* --ignore-case <2>:                     Charset selection in ptx.
18129                                                              (line  18)
18130* --ignore-case <3>:                     General options in join.
18131                                                              (line  35)
18132* --ignore-environment:                  env invocation.      (line 102)
18133* --ignore-fail-on-non-empty:            rmdir invocation.    (line  17)
18134* --ignore-file:                         Input processing in ptx.
18135                                                              (line  26)
18136* --ignore-garbage:                      base64 invocation.   (line  36)
18137* --ignore-interrupts:                   tee invocation.      (line  32)
18138* --ignore-leading-blanks:               sort invocation.     (line  79)
18139* --ignore-missing:                      md5sum invocation.   (line  76)
18140* --ignore-nonprinting:                  sort invocation.     (line 143)
18141* --ignore=PATTERN:                      Which files are listed.
18142                                                              (line  69)
18143* --indent:                              pr invocation.       (line 180)
18144* --indicator-style:                     General output formatting.
18145                                                              (line  46)
18146* --indicator-style <1>:                 General output formatting.
18147                                                              (line  57)
18148* --indicator-style <2>:                 General output formatting.
18149                                                              (line  70)
18150* --indicator-style <3>:                 General output formatting.
18151                                                              (line 108)
18152* --initial:                             expand invocation.   (line  46)
18153* --inode:                               What information is listed.
18154                                                              (line 123)
18155* --inodes:                              df invocation.       (line  69)
18156* --inodes <1>:                          du invocation.       (line 102)
18157* --input:                               stdbuf invocation.   (line  26)
18158* --input-range:                         shuf invocation.     (line  23)
18159* --interactive:                         cp invocation.       (line 139)
18160* --interactive <1>:                     mv invocation.       (line  70)
18161* --interactive <2>:                     rm invocation.       (line  54)
18162* --interactive <3>:                     ln invocation.       (line  98)
18163* --invalid:                             numfmt invocation.   (line  79)
18164* --io-blocks:                           truncate invocation. (line  26)
18165* --iso-8601[=TIMESPEC]:                 Options for date.    (line  38)
18166* --iterations=NUMBER:                   shred invocation.    (line 127)
18167* --join-blank-lines:                    nl invocation.       (line  82)
18168* --join-lines:                          pr invocation.       (line 124)
18169* --keep-files:                          csplit invocation.   (line  86)
18170* --kernel-name:                         uname invocation.    (line  66)
18171* --kernel-release:                      uname invocation.    (line  62)
18172* --kernel-version:                      uname invocation.    (line  77)
18173* --key:                                 sort invocation.     (line 231)
18174* --kibibytes:                           General output formatting.
18175                                                              (line  89)
18176* --kill-after:                          timeout invocation.  (line  41)
18177* --length:                              pr invocation.       (line 133)
18178* --length <1>:                          b2sum invocation.    (line  12)
18179* --line-bytes:                          split invocation.    (line  56)
18180* --line-increment:                      nl invocation.       (line  78)
18181* --lines:                               head invocation.     (line  40)
18182* --lines <1>:                           tail invocation.     (line 125)
18183* --lines <2>:                           split invocation.    (line  33)
18184* --lines <3>:                           wc invocation.       (line  55)
18185* --link:                                cp invocation.       (line 145)
18186* --literal:                             Formatting the file names.
18187                                                              (line  17)
18188* --local:                               df invocation.       (line  80)
18189* --logical:                             ln invocation.       (line 102)
18190* --logical <1>:                         realpath invocation. (line  35)
18191* --logical <2>:                         pwd invocation.      (line  15)
18192* --login:                               who invocation.      (line  51)
18193* --lookup:                              who invocation.      (line  56)
18194* --machine:                             uname invocation.    (line  42)
18195* --macro-name:                          Output formatting in ptx.
18196                                                              (line  94)
18197* --max-depth=DEPTH:                     du invocation.       (line  74)
18198* --max-line-length:                     wc invocation.       (line  59)
18199* --max-unchanged-stats:                 tail invocation.     (line 113)
18200* --merge:                               pr invocation.       (line 140)
18201* --merge <1>:                           sort invocation.     (line  53)
18202* --mesg:                                who invocation.      (line  94)
18203* --message:                             who invocation.      (line  94)
18204* --mode:                                install invocation.  (line  79)
18205* --mode <1>:                            mkdir invocation.    (line  19)
18206* --mode <2>:                            mkfifo invocation.   (line  21)
18207* --mode <3>:                            mknod invocation.    (line  47)
18208* --month-sort:                          sort invocation.     (line 150)
18209* --multiple:                            basename invocation. (line  32)
18210* --name:                                id invocation.       (line  37)
18211* --no-clobber:                          cp invocation.       (line 156)
18212* --no-clobber <1>:                      mv invocation.       (line  77)
18213* --no-create:                           touch invocation.    (line  52)
18214* --no-create <1>:                       truncate invocation. (line  22)
18215* --no-dereference:                      cp invocation.       (line 162)
18216* --no-dereference <1>:                  ln invocation.       (line 108)
18217* --no-dereference <2>:                  chown invocation.    (line 118)
18218* --no-dereference <3>:                  chgrp invocation.    (line  46)
18219* --no-dereference <4>:                  touch invocation.    (line  70)
18220* --no-dereference <5>:                  du invocation.       (line 133)
18221* --no-dereference <6>:                  chcon invocation.    (line  26)
18222* --no-file-warnings:                    pr invocation.       (line 187)
18223* --no-group:                            What information is listed.
18224                                                              (line 110)
18225* --no-newline:                          readlink invocation. (line  50)
18226* --no-preserve-root:                    rm invocation.       (line  88)
18227* --no-preserve-root <1>:                chown invocation.    (line 131)
18228* --no-preserve-root <2>:                chgrp invocation.    (line  59)
18229* --no-preserve-root <3>:                chmod invocation.    (line  58)
18230* --no-preserve-root <4>:                chcon invocation.    (line  43)
18231* --no-renumber:                         nl invocation.       (line 101)
18232* --no-symlinks:                         realpath invocation. (line  64)
18233* --no-sync:                             df invocation.       (line  84)
18234* --no-target-directory:                 Target directory.    (line  15)
18235* --no-target-directory <1>:             cp invocation.       (line 354)
18236* --no-target-directory <2>:             install invocation.  (line 130)
18237* --no-target-directory <3>:             mv invocation.       (line 112)
18238* --no-target-directory <4>:             ln invocation.       (line 175)
18239* --nodename:                            uname invocation.    (line  47)
18240* --null:                                du invocation.       (line  26)
18241* --null <1>:                            printenv invocation. (line  19)
18242* --null <2>:                            env invocation.      (line  90)
18243* --number:                              cat invocation.      (line  31)
18244* --number <1>:                          split invocation.    (line  79)
18245* --number-format:                       nl invocation.       (line  90)
18246* --number-lines:                        pr invocation.       (line 153)
18247* --number-nonblank:                     cat invocation.      (line  20)
18248* --number-separator:                    nl invocation.       (line 105)
18249* --number-width:                        nl invocation.       (line 115)
18250* --numeric-sort:                        sort invocation.     (line 160)
18251* --numeric-suffixes:                    split invocation.    (line 117)
18252* --numeric-uid-gid:                     What information is listed.
18253                                                              (line 225)
18254* --omit-header:                         pr invocation.       (line 210)
18255* --omit-pagination:                     pr invocation.       (line 220)
18256* --one-file-system:                     cp invocation.       (line 378)
18257* --one-file-system <1>:                 rm invocation.       (line  65)
18258* --one-file-system <2>:                 du invocation.       (line 263)
18259* --only-delimited:                      cut invocation.      (line  74)
18260* --only-file:                           Input processing in ptx.
18261                                                              (line  35)
18262* --operating-system:                    uname invocation.    (line  58)
18263* --output:                              sort invocation.     (line 288)
18264* --output <1>:                          shuf invocation.     (line  36)
18265* --output <2>:                          df invocation.       (line  91)
18266* --output <3>:                          stdbuf invocation.   (line  30)
18267* --output-delimiter:                    cut invocation.      (line  79)
18268* --output-duplicates:                   od invocation.       (line 150)
18269* --output-error:                        tee invocation.      (line  36)
18270* --output-tabs:                         pr invocation.       (line 117)
18271* --owner:                               install invocation.  (line  91)
18272* --padding:                             numfmt invocation.   (line  87)
18273* --pages=PAGE_RANGE:                    pr invocation.       (line  39)
18274* --page_width:                          pr invocation.       (line 239)
18275* --parallel:                            sort invocation.     (line 361)
18276* --parents:                             cp invocation.       (line 239)
18277* --parents <1>:                         mkdir invocation.    (line  34)
18278* --parents <2>:                         rmdir invocation.    (line  22)
18279* --physical:                            ln invocation.       (line 127)
18280* --physical <1>:                        realpath invocation. (line  40)
18281* --physical <2>:                        pwd invocation.      (line  22)
18282* --pid:                                 tail invocation.     (line 131)
18283* --portability:                         df invocation.       (line 148)
18284* --portability <1>:                     pathchk invocation.  (line  44)
18285* --prefix:                              csplit invocation.   (line  63)
18286* --preserve:                            cp invocation.       (line 169)
18287* --preserve-context:                    install invocation.  (line  96)
18288* --preserve-root:                       rm invocation.       (line  81)
18289* --preserve-root <1>:                   chown invocation.    (line 126)
18290* --preserve-root <2>:                   chgrp invocation.    (line  54)
18291* --preserve-root <3>:                   chmod invocation.    (line  53)
18292* --preserve-root <4>:                   chcon invocation.    (line  38)
18293* --preserve-status:                     timeout invocation.  (line  18)
18294* --preserve-timestamps:                 install invocation.  (line 103)
18295* --print-database:                      dircolors invocation.
18296                                                              (line  45)
18297* --print-type:                          df invocation.       (line 200)
18298* --printf=FORMAT:                       stat invocation.     (line  58)
18299* --process:                             who invocation.      (line  65)
18300* --processor:                           uname invocation.    (line  51)
18301* --quiet:                               head invocation.     (line  47)
18302* --quiet <1>:                           tail invocation.     (line 153)
18303* --quiet <2>:                           csplit invocation.   (line 106)
18304* --quiet <3>:                           md5sum invocation.   (line  82)
18305* --quiet <4>:                           readlink invocation. (line  57)
18306* --quiet <5>:                           chown invocation.    (line  79)
18307* --quiet <6>:                           chgrp invocation.    (line  30)
18308* --quiet <7>:                           chmod invocation.    (line  49)
18309* --quiet <8>:                           mktemp invocation.   (line  92)
18310* --quiet <9>:                           realpath invocation. (line  46)
18311* --quiet <10>:                          tty invocation.      (line  18)
18312* --quote-name:                          Formatting the file names.
18313                                                              (line  30)
18314* --quoting-style:                       Formatting the file names.
18315                                                              (line  11)
18316* --quoting-style <1>:                   Formatting the file names.
18317                                                              (line  17)
18318* --quoting-style <2>:                   Formatting the file names.
18319                                                              (line  30)
18320* --quoting-style <3>:                   Formatting the file names.
18321                                                              (line  34)
18322* --random-sort:                         sort invocation.     (line 189)
18323* --random-source:                       sort invocation.     (line 304)
18324* --random-source <1>:                   shuf invocation.     (line  42)
18325* --random-source <2>:                   shred invocation.    (line 133)
18326* --range:                               chcon invocation.    (line  77)
18327* --range <1>:                           runcon invocation.   (line  48)
18328* --read-bytes:                          od invocation.       (line  76)
18329* --real:                                id invocation.       (line  42)
18330* --recursive:                           Which files are listed.
18331                                                              (line  90)
18332* --recursive <1>:                       cp invocation.       (line 252)
18333* --recursive <2>:                       rm invocation.       (line  95)
18334* --recursive <3>:                       chown invocation.    (line 150)
18335* --recursive <4>:                       chgrp invocation.    (line  77)
18336* --recursive <5>:                       chmod invocation.    (line  73)
18337* --recursive <6>:                       chcon invocation.    (line  35)
18338* --reference:                           chown invocation.    (line 135)
18339* --reference <1>:                       chgrp invocation.    (line  63)
18340* --reference <2>:                       chmod invocation.    (line  66)
18341* --reference <3>:                       touch invocation.    (line  89)
18342* --reference <4>:                       truncate invocation. (line  30)
18343* --reference <5>:                       Options for date.    (line  65)
18344* --reference <6>:                       chcon invocation.    (line  30)
18345* --references:                          Input processing in ptx.
18346                                                              (line  48)
18347* --reflink[=WHEN]:                      cp invocation.       (line 265)
18348* --regex:                               tac invocation.      (line  26)
18349* --relative:                            ln invocation.       (line 136)
18350* --relative-base:                       realpath invocation. (line  54)
18351* --relative-base <1>:                   Realpath usage examples.
18352                                                              (line   6)
18353* --relative-to:                         realpath invocation. (line  49)
18354* --relative-to <1>:                     Realpath usage examples.
18355                                                              (line   6)
18356* --remove:                              shred invocation.    (line 144)
18357* --remove-destination:                  cp invocation.       (line 295)
18358* --remove=unlink:                       shred invocation.    (line 144)
18359* --remove=wipe:                         shred invocation.    (line 144)
18360* --remove=wipesync:                     shred invocation.    (line 144)
18361* --repeat:                              shuf invocation.     (line  47)
18362* --repeated:                            uniq invocation.     (line  63)
18363* --retry:                               tail invocation.     (line 156)
18364* --reverse:                             sort invocation.     (line 183)
18365* --reverse <1>:                         Sorting the output.  (line  27)
18366* --rfc-2822:                            Options for date.    (line  76)
18367* --rfc-3339=TIMESPEC:                   Options for date.    (line  85)
18368* --rfc-822:                             Options for date.    (line  76)
18369* --rfc-email:                           Options for date.    (line  70)
18370* --right-side-refs:                     Output formatting in ptx.
18371                                                              (line  56)
18372* --role:                                chcon invocation.    (line  69)
18373* --role <1>:                            runcon invocation.   (line  40)
18374* --round:                               numfmt invocation.   (line  94)
18375* --round=down:                          numfmt invocation.   (line  94)
18376* --round=from-zero:                     numfmt invocation.   (line  94)
18377* --round=nearest:                       numfmt invocation.   (line  94)
18378* --round=towards-zero:                  numfmt invocation.   (line  94)
18379* --round=up:                            numfmt invocation.   (line  94)
18380* --runlevel:                            who invocation.      (line  74)
18381* --save:                                stty invocation.     (line  41)
18382* --section-delimiter:                   nl invocation.       (line  63)
18383* --sentence-regexp:                     Input processing in ptx.
18384                                                              (line  65)
18385* --sep-string:                          pr invocation.       (line 201)
18386* --separate-dirs:                       du invocation.       (line 138)
18387* --separator:                           tac invocation.      (line  30)
18388* --separator <1>:                       pr invocation.       (line 192)
18389* --separator <2>:                       split invocation.    (line 148)
18390* --separator <3>:                       seq invocation.      (line  44)
18391* --serial:                              paste invocation.    (line  52)
18392* --set:                                 Options for date.    (line 113)
18393* --sh:                                  dircolors invocation.
18394                                                              (line  34)
18395* --show-all:                            cat invocation.      (line  16)
18396* --show-control-chars:                  pr invocation.       (line  68)
18397* --show-control-chars <1>:              Formatting the file names.
18398                                                              (line  78)
18399* --show-ends:                           cat invocation.      (line  27)
18400* --show-nonprinting:                    cat invocation.      (line  51)
18401* --show-nonprinting <1>:                pr invocation.       (line 225)
18402* --show-tabs:                           cat invocation.      (line  44)
18403* --si:                                  Block size.          (line 121)
18404* --si <1>:                              What information is listed.
18405                                                              (line 251)
18406* --si <2>:                              df invocation.       (line 167)
18407* --si <3>:                              du invocation.       (line 145)
18408* --signal:                              timeout invocation.  (line  48)
18409* --silent:                              head invocation.     (line  47)
18410* --silent <1>:                          tail invocation.     (line 153)
18411* --silent <2>:                          csplit invocation.   (line 106)
18412* --silent <3>:                          readlink invocation. (line  57)
18413* --silent <4>:                          chown invocation.    (line  79)
18414* --silent <5>:                          chgrp invocation.    (line  30)
18415* --silent <6>:                          chmod invocation.    (line  49)
18416* --silent <7>:                          tty invocation.      (line  18)
18417* --size:                                What information is listed.
18418                                                              (line 236)
18419* --size <1>:                            truncate invocation. (line  34)
18420* --size=BYTES:                          shred invocation.    (line 138)
18421* --skip-bytes:                          od invocation.       (line  59)
18422* --skip-chars:                          uniq invocation.     (line  41)
18423* --skip-chdir:                          chroot invocation.   (line  37)
18424* --skip-fields:                         uniq invocation.     (line  31)
18425* --sleep-interval:                      tail invocation.     (line 173)
18426* --sort:                                sort invocation.     (line 105)
18427* --sort <1>:                            sort invocation.     (line 126)
18428* --sort <2>:                            sort invocation.     (line 150)
18429* --sort <3>:                            sort invocation.     (line 160)
18430* --sort <4>:                            sort invocation.     (line 189)
18431* --sort <5>:                            Sorting the output.  (line  32)
18432* --sort <6>:                            Sorting the output.  (line  36)
18433* --sort <7>:                            Sorting the output.  (line  60)
18434* --sort <8>:                            Sorting the output.  (line  67)
18435* --sort <9>:                            Sorting the output.  (line  74)
18436* --spaces:                              fold invocation.     (line  29)
18437* --sparse=WHEN:                         cp invocation.       (line 299)
18438* --split-only:                          fmt invocation.      (line  47)
18439* --split-string:                        env invocation.      (line 188)
18440* --squeeze-blank:                       cat invocation.      (line  36)
18441* --stable:                              sort invocation.     (line 309)
18442* --starting-line-number:                nl invocation.       (line 110)
18443* --status:                              md5sum invocation.   (line  90)
18444* --strict:                              md5sum invocation.   (line 123)
18445* --strings:                             od invocation.       (line  81)
18446* --strip:                               install invocation.  (line 113)
18447* --strip <1>:                           realpath invocation. (line  64)
18448* --strip-program:                       install invocation.  (line 116)
18449* --strip-trailing-slashes:              cp invocation.       (line 332)
18450* --strip-trailing-slashes <1>:          mv invocation.       (line  98)
18451* --suffix:                              Backup options.      (line  49)
18452* --suffix <1>:                          cp invocation.       (line 345)
18453* --suffix <2>:                          install invocation.  (line 120)
18454* --suffix <3>:                          mv invocation.       (line 103)
18455* --suffix <4>:                          ln invocation.       (line 166)
18456* --suffix <5>:                          basename invocation. (line  38)
18457* --suffix <6>:                          mktemp invocation.   (line 113)
18458* --suffix <7>:                          numfmt invocation.   (line  99)
18459* --suffix-format:                       csplit invocation.   (line  67)
18460* --suffix-length:                       split invocation.    (line 109)
18461* --summarize:                           du invocation.       (line 153)
18462* --suppress-matched:                    csplit invocation.   (line  89)
18463* --symbolic:                            ln invocation.       (line 160)
18464* --symbolic-link:                       cp invocation.       (line 337)
18465* --sync:                                df invocation.       (line 174)
18466* --sysv:                                sum invocation.      (line  31)
18467* --tabs:                                expand invocation.   (line  22)
18468* --tabs <1>:                            unexpand invocation. (line  24)
18469* --tabsize:                             General output formatting.
18470                                                              (line 117)
18471* --tag:                                 md5sum invocation.   (line  99)
18472* --tagged-paragraph:                    fmt invocation.      (line  40)
18473* --target-directory:                    Target directory.    (line  31)
18474* --target-directory <1>:                cp invocation.       (line 350)
18475* --target-directory <2>:                install invocation.  (line 125)
18476* --target-directory <3>:                mv invocation.       (line 108)
18477* --target-directory <4>:                ln invocation.       (line 171)
18478* --temporary-directory:                 sort invocation.     (line 353)
18479* --terse:                               stat invocation.     (line  69)
18480* --text:                                md5sum invocation.   (line 109)
18481* --threshold:                           du invocation.       (line 157)
18482* --time:                                Sorting the output.  (line  13)
18483* --time <1>:                            Sorting the output.  (line  44)
18484* --time <2>:                            Sorting the output.  (line  52)
18485* --time <3>:                            touch invocation.    (line  48)
18486* --time <4>:                            touch invocation.    (line  85)
18487* --time <5>:                            du invocation.       (line 197)
18488* --time <6>:                            du invocation.       (line 204)
18489* --time <7>:                            du invocation.       (line 210)
18490* --time <8>:                            who invocation.      (line  82)
18491* --time-style:                          Formatting file timestamps.
18492                                                              (line  24)
18493* --time-style <1>:                      du invocation.       (line 214)
18494* --tmpdir:                              mktemp invocation.   (line 105)
18495* --to:                                  numfmt invocation.   (line 103)
18496* --to-unit:                             numfmt invocation.   (line 108)
18497* --total:                               df invocation.       (line 180)
18498* --total <1>:                           du invocation.       (line  61)
18499* --traditional:                         od invocation.       (line 200)
18500* --type:                                df invocation.       (line 194)
18501* --type <1>:                            chcon invocation.    (line  73)
18502* --type <2>:                            runcon invocation.   (line  44)
18503* --unbuffered:                          split invocation.    (line 155)
18504* --uniform-spacing:                     fmt invocation.      (line  53)
18505* --unique:                              sort invocation.     (line 369)
18506* --unique <1>:                          uniq invocation.     (line 127)
18507* --universal:                           Options for date.    (line 119)
18508* --unset:                               env invocation.      (line  96)
18509* --update:                              cp invocation.       (line 359)
18510* --update <1>:                          mv invocation.       (line  84)
18511* --user:                                id invocation.       (line  47)
18512* --user <1>:                            chcon invocation.    (line  65)
18513* --user <2>:                            runcon invocation.   (line  36)
18514* --userspec:                            chroot invocation.   (line  30)
18515* --utc:                                 Options for date.    (line 119)
18516* --verbose:                             head invocation.     (line  51)
18517* --verbose <1>:                         tail invocation.     (line 184)
18518* --verbose <2>:                         split invocation.    (line 159)
18519* --verbose <3>:                         cp invocation.       (line 374)
18520* --verbose <4>:                         install invocation.  (line 135)
18521* --verbose <5>:                         mv invocation.       (line  95)
18522* --verbose <6>:                         rm invocation.       (line  99)
18523* --verbose <7>:                         shred invocation.    (line 159)
18524* --verbose <8>:                         ln invocation.       (line 180)
18525* --verbose <9>:                         mkdir invocation.    (line  51)
18526* --verbose <10>:                        readlink invocation. (line  61)
18527* --verbose <11>:                        rmdir invocation.    (line  31)
18528* --verbose <12>:                        chown invocation.    (line 142)
18529* --verbose <13>:                        chgrp invocation.    (line  69)
18530* --verbose <14>:                        chmod invocation.    (line  63)
18531* --verbose <15>:                        chcon invocation.    (line  61)
18532* --verbose <16>:                        timeout invocation.  (line  54)
18533* --version:                             Common options.      (line  40)
18534* --version-sort:                        sort invocation.     (line 177)
18535* --warn:                                md5sum invocation.   (line 118)
18536* --width:                               od invocation.       (line 157)
18537* --width <1>:                           fmt invocation.      (line  59)
18538* --width <2>:                           pr invocation.       (line 229)
18539* --width <3>:                           fold invocation.     (line  35)
18540* --width <4>:                           Output formatting in ptx.
18541                                                              (line  32)
18542* --width <5>:                           General output formatting.
18543                                                              (line 128)
18544* --word-regexp:                         Input processing in ptx.
18545                                                              (line 105)
18546* --words:                               wc invocation.       (line  51)
18547* --wrap:                                base64 invocation.   (line  22)
18548* --writable:                            who invocation.      (line  94)
18549* --z85:                                 basenc invocation.   (line  63)
18550* --zero:                                md5sum invocation.   (line 128)
18551* --zero <1>:                            shred invocation.    (line 175)
18552* --zero <2>:                            readlink invocation. (line  65)
18553* --zero <3>:                            basename invocation. (line  42)
18554* --zero <4>:                            dirname invocation.  (line  31)
18555* --zero <5>:                            realpath invocation. (line  71)
18556* --zero <6>:                            id invocation.       (line  58)
18557* --zero-terminated:                     head invocation.     (line  55)
18558* --zero-terminated <1>:                 tail invocation.     (line 188)
18559* --zero-terminated <2>:                 sort invocation.     (line 384)
18560* --zero-terminated <3>:                 shuf invocation.     (line  55)
18561* --zero-terminated <4>:                 uniq invocation.     (line 139)
18562* --zero-terminated <5>:                 comm invocation.     (line  88)
18563* --zero-terminated <6>:                 cut invocation.      (line  94)
18564* --zero-terminated <7>:                 paste invocation.    (line  72)
18565* --zero-terminated <8>:                 General options in join.
18566                                                              (line  93)
18567* --zero-terminated <9>:                 numfmt invocation.   (line 115)
18568* -0:                                    du invocation.       (line  26)
18569* -0 <1>:                                printenv invocation. (line  19)
18570* -0 <2>:                                env invocation.      (line  90)
18571* -1:                                    comm invocation.     (line  23)
18572* -1 <1>:                                General options in join.
18573                                                              (line  40)
18574* -1 <2>:                                General output formatting.
18575                                                              (line  10)
18576* -2:                                    comm invocation.     (line  23)
18577* -2 <1>:                                General options in join.
18578                                                              (line  43)
18579* -3:                                    comm invocation.     (line  23)
18580* -A:                                    cat invocation.      (line  16)
18581* -A <1>:                                od invocation.       (line  36)
18582* -a:                                    od invocation.       (line 169)
18583* -a <1>:                                pr invocation.       (line  62)
18584* -a <2>:                                split invocation.    (line 109)
18585* -A <2>:                                Output formatting in ptx.
18586                                                              (line  45)
18587* -a <3>:                                General options in join.
18588                                                              (line  10)
18589* -a <4>:                                unexpand invocation. (line  51)
18590* -a <5>:                                Which files are listed.
18591                                                              (line  13)
18592* -A <3>:                                Which files are listed.
18593                                                              (line  17)
18594* -a <6>:                                cp invocation.       (line  63)
18595* -a <7>:                                touch invocation.    (line  48)
18596* -a <8>:                                df invocation.       (line  42)
18597* -a <9>:                                du invocation.       (line  32)
18598* -a <10>:                               Connectives for test.
18599                                                              (line  29)
18600* -a <11>:                               tee invocation.      (line  27)
18601* -a <12>:                               basename invocation. (line  32)
18602* -a <13>:                               stty invocation.     (line  26)
18603* -a <14>:                               who invocation.      (line  35)
18604* -a <15>:                               uname invocation.    (line  30)
18605* -b:                                    Backup options.      (line  13)
18606* -b <1>:                                cat invocation.      (line  20)
18607* -b <2>:                                tac invocation.      (line  21)
18608* -b <3>:                                nl invocation.       (line  45)
18609* -b <4>:                                od invocation.       (line 172)
18610* -b <5>:                                fold invocation.     (line  23)
18611* -b <6>:                                split invocation.    (line  41)
18612* -b <7>:                                csplit invocation.   (line  67)
18613* -b <8>:                                md5sum invocation.   (line  41)
18614* -b <9>:                                sort invocation.     (line  79)
18615* -b <10>:                               Input processing in ptx.
18616                                                              (line   8)
18617* -b <11>:                               cut invocation.      (line  26)
18618* -B:                                    Which files are listed.
18619                                                              (line  23)
18620* -b <12>:                               Formatting the file names.
18621                                                              (line  11)
18622* -b <13>:                               dircolors invocation.
18623                                                              (line  34)
18624* -b <14>:                               cp invocation.       (line  79)
18625* -b <15>:                               install invocation.  (line  41)
18626* -b <16>:                               mv invocation.       (line  59)
18627* -b <17>:                               ln invocation.       (line  82)
18628* -B <1>:                                df invocation.       (line  54)
18629* -B <2>:                                du invocation.       (line  52)
18630* -b <18>:                               du invocation.       (line  57)
18631* -b <19>:                               File type tests.     (line  10)
18632* -b <20>:                               who invocation.      (line  39)
18633* -c:                                    od invocation.       (line 175)
18634* -c <1>:                                fmt invocation.      (line  34)
18635* -c <2>:                                pr invocation.       (line  68)
18636* -c <3>:                                head invocation.     (line  24)
18637* -c <4>:                                tail invocation.     (line  39)
18638* -C:                                    split invocation.    (line  56)
18639* -c <5>:                                wc invocation.       (line  43)
18640* -c <6>:                                sort invocation.     (line  39)
18641* -c <7>:                                sort invocation.     (line  47)
18642* -c <8>:                                shuf invocation.     (line  19)
18643* -c <9>:                                uniq invocation.     (line  55)
18644* -c <10>:                               cut invocation.      (line  34)
18645* -c <11>:                               Sorting the output.  (line  13)
18646* -C <1>:                                General output formatting.
18647                                                              (line  16)
18648* -c <12>:                               dircolors invocation.
18649                                                              (line  40)
18650* -C <2>:                                install invocation.  (line  46)
18651* -c <13>:                               install invocation.  (line  57)
18652* -c <14>:                               chown invocation.    (line  73)
18653* -c <15>:                               chgrp invocation.    (line  24)
18654* -c <16>:                               chmod invocation.    (line  43)
18655* -c <17>:                               touch invocation.    (line  52)
18656* -c <18>:                               du invocation.       (line  61)
18657* -c <19>:                               stat invocation.     (line  49)
18658* -c <20>:                               truncate invocation. (line  22)
18659* -c <21>:                               File type tests.     (line  13)
18660* -c <22>:                               runcon invocation.   (line  32)
18661* -C <3>:                                env invocation.      (line 107)
18662* -COLUMN:                               pr invocation.       (line  49)
18663* -d:                                    nl invocation.       (line  63)
18664* -d <1>:                                od invocation.       (line 179)
18665* -d <2>:                                base64 invocation.   (line  30)
18666* -d <3>:                                pr invocation.       (line  74)
18667* -d <4>:                                split invocation.    (line 117)
18668* -d <5>:                                sort invocation.     (line  87)
18669* -d <6>:                                uniq invocation.     (line  63)
18670* -D:                                    uniq invocation.     (line  69)
18671* -d <7>:                                cut invocation.      (line  66)
18672* -d <8>:                                paste invocation.    (line  61)
18673* -d <9>:                                Which files are listed.
18674                                                              (line  28)
18675* -D <1>:                                What information is listed.
18676                                                              (line  16)
18677* -d <10>:                               cp invocation.       (line 109)
18678* -D <2>:                                install invocation.  (line  60)
18679* -d <11>:                               install invocation.  (line  67)
18680* -d <12>:                               rm invocation.       (line  35)
18681* -d <13>:                               ln invocation.       (line  88)
18682* -d <14>:                               touch invocation.    (line  56)
18683* -D <3>:                                du invocation.       (line  67)
18684* -d <15>:                               File type tests.     (line  16)
18685* -d <16>:                               mktemp invocation.   (line  85)
18686* -d <17>:                               who invocation.      (line  43)
18687* -d <18>:                               Options for date.    (line  11)
18688* -d <19>:                               numfmt invocation.   (line  34)
18689* -d DEPTH:                              du invocation.       (line  74)
18690* -e:                                    cat invocation.      (line  23)
18691* -E:                                    cat invocation.      (line  27)
18692* -e <1>:                                pr invocation.       (line  98)
18693* -e <2>:                                split invocation.    (line 140)
18694* -e <3>:                                General options in join.
18695                                                              (line  21)
18696* -e <4>:                                readlink invocation. (line  38)
18697* -e <5>:                                echo invocation.     (line  25)
18698* -E <1>:                                echo invocation.     (line  61)
18699* -e <6>:                                File characteristic tests.
18700                                                              (line   9)
18701* -e <7>:                                realpath invocation. (line  22)
18702* -e <8>:                                stdbuf invocation.   (line  34)
18703* -ef:                                   File characteristic tests.
18704                                                              (line  23)
18705* -eq:                                   Numeric tests.       (line  17)
18706* -f:                                    nl invocation.       (line  70)
18707* -f <1>:                                od invocation.       (line 182)
18708* -F:                                    pr invocation.       (line 106)
18709* -f <2>:                                pr invocation.       (line 106)
18710* -f <3>:                                tail invocation.     (line  56)
18711* -F <1>:                                tail invocation.     (line 108)
18712* -f <4>:                                csplit invocation.   (line  63)
18713* -f <5>:                                sort invocation.     (line  94)
18714* -f <6>:                                uniq invocation.     (line  31)
18715* -f <7>:                                Charset selection in ptx.
18716                                                              (line  18)
18717* -F <2>:                                Output formatting in ptx.
18718                                                              (line  71)
18719* -f <8>:                                cut invocation.      (line  43)
18720* -f <9>:                                Sorting the output.  (line  20)
18721* -F <3>:                                General output formatting.
18722                                                              (line  46)
18723* -f <10>:                               cp invocation.       (line 115)
18724* -f <11>:                               mv invocation.       (line  64)
18725* -f <12>:                               rm invocation.       (line  39)
18726* -f <13>:                               shred invocation.    (line 123)
18727* -F <4>:                                ln invocation.       (line  88)
18728* -f <14>:                               ln invocation.       (line  94)
18729* -f <15>:                               readlink invocation. (line  31)
18730* -f <16>:                               chown invocation.    (line  79)
18731* -f <17>:                               chgrp invocation.    (line  30)
18732* -f <18>:                               chmod invocation.    (line  49)
18733* -f <19>:                               touch invocation.    (line  66)
18734* -f <20>:                               stat invocation.     (line  28)
18735* -f <21>:                               File type tests.     (line  19)
18736* -F <5>:                                stty invocation.     (line  31)
18737* -f <22>:                               Options for date.    (line  30)
18738* -f <23>:                               seq invocation.      (line  28)
18739* -g:                                    fmt invocation.      (line  64)
18740* -g <1>:                                sort invocation.     (line 105)
18741* -g <2>:                                Output formatting in ptx.
18742                                                              (line  26)
18743* -g <3>:                                What information is listed.
18744                                                              (line 105)
18745* -G:                                    What information is listed.
18746                                                              (line 110)
18747* -g <4>:                                install invocation.  (line  73)
18748* -g <5>:                                Access permission tests.
18749                                                              (line   9)
18750* -G <1>:                                Access permission tests.
18751                                                              (line  31)
18752* -g <6>:                                stty invocation.     (line  41)
18753* -g <7>:                                id invocation.       (line  29)
18754* -G <2>:                                id invocation.       (line  33)
18755* -ge:                                   Numeric tests.       (line  17)
18756* -gt:                                   Numeric tests.       (line  17)
18757* -h:                                    Block size.          (line 121)
18758* -H:                                    Traversing symlinks. (line  18)
18759* -h <1>:                                nl invocation.       (line  74)
18760* -h <2>:                                pr invocation.       (line 111)
18761* -h <3>:                                sort invocation.     (line 126)
18762* -H <1>:                                Which files are listed.
18763                                                              (line  36)
18764* -h <4>:                                What information is listed.
18765                                                              (line 116)
18766* -H <2>:                                cp invocation.       (line 132)
18767* -h <5>:                                chown invocation.    (line 118)
18768* -H <3>:                                chown invocation.    (line 153)
18769* -h <6>:                                chgrp invocation.    (line  46)
18770* -H <4>:                                chgrp invocation.    (line  81)
18771* -h <7>:                                touch invocation.    (line  70)
18772* -h <8>:                                df invocation.       (line  59)
18773* -H <5>:                                df invocation.       (line  65)
18774* -H <6>:                                du invocation.       (line  92)
18775* -h <9>:                                du invocation.       (line  96)
18776* -h <10>:                               File type tests.     (line  23)
18777* -H <7>:                                who invocation.      (line  47)
18778* -h <11>:                               chcon invocation.    (line  26)
18779* -H <8>:                                chcon invocation.    (line  47)
18780* -i:                                    nl invocation.       (line  78)
18781* -i <1>:                                od invocation.       (line 185)
18782* -i <2>:                                base64 invocation.   (line  36)
18783* -i <3>:                                pr invocation.       (line 117)
18784* -i <4>:                                sort invocation.     (line 143)
18785* -i <5>:                                shuf invocation.     (line  23)
18786* -i <6>:                                uniq invocation.     (line  59)
18787* -i <7>:                                Input processing in ptx.
18788                                                              (line  26)
18789* -i <8>:                                General options in join.
18790                                                              (line  35)
18791* -i <9>:                                expand invocation.   (line  46)
18792* -I:                                    Which files are listed.
18793                                                              (line  69)
18794* -i <10>:                               What information is listed.
18795                                                              (line 123)
18796* -i <11>:                               cp invocation.       (line 139)
18797* -i <12>:                               mv invocation.       (line  70)
18798* -i <13>:                               rm invocation.       (line  43)
18799* -I <1>:                                rm invocation.       (line  48)
18800* -i <14>:                               ln invocation.       (line  98)
18801* -i <15>:                               df invocation.       (line  69)
18802* -i <16>:                               tee invocation.      (line  32)
18803* -i <17>:                               uname invocation.    (line  35)
18804* -i <18>:                               env invocation.      (line 102)
18805* -i <19>:                               stdbuf invocation.   (line  26)
18806* -I[TIMESPEC]:                          Options for date.    (line  38)
18807* -j:                                    od invocation.       (line  59)
18808* -J:                                    pr invocation.       (line 124)
18809* -k:                                    Block size.          (line 121)
18810* -k <1>:                                csplit invocation.   (line  86)
18811* -k <2>:                                sort invocation.     (line 231)
18812* -k <3>:                                General output formatting.
18813                                                              (line  89)
18814* -k <4>:                                df invocation.       (line  74)
18815* -k <5>:                                du invocation.       (line 111)
18816* -k <6>:                                Access permission tests.
18817                                                              (line  12)
18818* -k <7>:                                timeout invocation.  (line  41)
18819* -L:                                    Traversing symlinks. (line  22)
18820* -l:                                    nl invocation.       (line  82)
18821* -l <1>:                                od invocation.       (line 188)
18822* -l <2>:                                pr invocation.       (line 133)
18823* -l <3>:                                split invocation.    (line  33)
18824* -l <4>:                                wc invocation.       (line  55)
18825* -L <1>:                                wc invocation.       (line  59)
18826* -l <5>:                                b2sum invocation.    (line  12)
18827* -L <2>:                                Which files are listed.
18828                                                              (line  83)
18829* -l <6>:                                What information is listed.
18830                                                              (line 131)
18831* -l <7>:                                cp invocation.       (line 145)
18832* -L <3>:                                cp invocation.       (line 149)
18833* -L <4>:                                ln invocation.       (line 102)
18834* -L <5>:                                chown invocation.    (line 158)
18835* -L <6>:                                chgrp invocation.    (line  86)
18836* -l <8>:                                df invocation.       (line  80)
18837* -L <7>:                                du invocation.       (line 117)
18838* -l <9>:                                du invocation.       (line 123)
18839* -L <8>:                                stat invocation.     (line  22)
18840* -L <9>:                                File type tests.     (line  23)
18841* -L <10>:                               realpath invocation. (line  35)
18842* -L <11>:                               pwd invocation.      (line  15)
18843* -l <10>:                               who invocation.      (line  51)
18844* -L <12>:                               chcon invocation.    (line  52)
18845* -l <11>:                               chcon invocation.    (line  77)
18846* -l <12>:                               runcon invocation.   (line  48)
18847* -le:                                   Numeric tests.       (line  17)
18848* -lt:                                   Numeric tests.       (line  17)
18849* -m:                                    pr invocation.       (line 140)
18850* -m <1>:                                wc invocation.       (line  47)
18851* -m <2>:                                sort invocation.     (line  53)
18852* -M:                                    sort invocation.     (line 150)
18853* -M <1>:                                Output formatting in ptx.
18854                                                              (line  94)
18855* -m <3>:                                General output formatting.
18856                                                              (line 103)
18857* -m <4>:                                install invocation.  (line  79)
18858* -m <5>:                                mkdir invocation.    (line  19)
18859* -m <6>:                                mkfifo invocation.   (line  21)
18860* -m <7>:                                mknod invocation.    (line  47)
18861* -m <8>:                                readlink invocation. (line  45)
18862* -m <9>:                                touch invocation.    (line  85)
18863* -m <10>:                               du invocation.       (line 127)
18864* -m <11>:                               realpath invocation. (line  30)
18865* -m <12>:                               who invocation.      (line  61)
18866* -m <13>:                               uname invocation.    (line  42)
18867* -n:                                    cat invocation.      (line  31)
18868* -n <1>:                                nl invocation.       (line  90)
18869* -N:                                    od invocation.       (line  76)
18870* -n <2>:                                pr invocation.       (line 153)
18871* -N <1>:                                pr invocation.       (line 174)
18872* -n <3>:                                head invocation.     (line  40)
18873* -n <4>:                                tail invocation.     (line 125)
18874* -n <5>:                                split invocation.    (line  79)
18875* -n <6>:                                csplit invocation.   (line  81)
18876* -n <7>:                                sort invocation.     (line 160)
18877* -n <8>:                                shuf invocation.     (line  31)
18878* -n <9>:                                cut invocation.      (line  70)
18879* -n <10>:                               What information is listed.
18880                                                              (line 225)
18881* -N <2>:                                Formatting the file names.
18882                                                              (line  17)
18883* -n <11>:                               cp invocation.       (line 156)
18884* -n <12>:                               mv invocation.       (line  77)
18885* -n <13>:                               ln invocation.       (line 108)
18886* -n <14>:                               readlink invocation. (line  50)
18887* -n <15>:                               echo invocation.     (line  22)
18888* -N <3>:                                File characteristic tests.
18889                                                              (line  27)
18890* -n <16>:                               String tests.        (line  19)
18891* -n <17>:                               id invocation.       (line  37)
18892* -n <18>:                               uname invocation.    (line  47)
18893* -n <19>:                               nice invocation.     (line  51)
18894* -n NUMBER:                             shred invocation.    (line 127)
18895* -ne:                                   Numeric tests.       (line  17)
18896* -nt:                                   File characteristic tests.
18897                                                              (line  15)
18898* -o:                                    od invocation.       (line 191)
18899* -o <1>:                                pr invocation.       (line 180)
18900* -o <2>:                                sort invocation.     (line 288)
18901* -o <3>:                                shuf invocation.     (line  36)
18902* -o <4>:                                Input processing in ptx.
18903                                                              (line  35)
18904* -O:                                    Output formatting in ptx.
18905                                                              (line 100)
18906* -o <5>:                                What information is listed.
18907                                                              (line 230)
18908* -o <6>:                                install invocation.  (line  91)
18909* -o <7>:                                truncate invocation. (line  26)
18910* -O <1>:                                Access permission tests.
18911                                                              (line  28)
18912* -o <8>:                                Connectives for test.
18913                                                              (line  33)
18914* -o <9>:                                uname invocation.    (line  58)
18915* -o <10>:                               stdbuf invocation.   (line  30)
18916* -ot:                                   File characteristic tests.
18917                                                              (line  19)
18918* -P:                                    Traversing symlinks. (line  26)
18919* -p:                                    nl invocation.       (line 101)
18920* -p <1>:                                General output formatting.
18921                                                              (line 108)
18922* -p <2>:                                dircolors invocation.
18923                                                              (line  45)
18924* -P <1>:                                cp invocation.       (line 162)
18925* -p <3>:                                cp invocation.       (line 169)
18926* -p <4>:                                install invocation.  (line 103)
18927* -P <2>:                                ln invocation.       (line 127)
18928* -p <5>:                                mkdir invocation.    (line  34)
18929* -p <6>:                                rmdir invocation.    (line  22)
18930* -P <3>:                                chown invocation.    (line 171)
18931* -P <4>:                                chgrp invocation.    (line  99)
18932* -P <5>:                                df invocation.       (line 148)
18933* -P <6>:                                du invocation.       (line 133)
18934* -p <7>:                                File type tests.     (line  28)
18935* -p <8>:                                tee invocation.      (line  36)
18936* -p <9>:                                pathchk invocation.  (line  27)
18937* -P <7>:                                pathchk invocation.  (line  40)
18938* -p <10>:                               mktemp invocation.   (line 105)
18939* -P <8>:                                realpath invocation. (line  40)
18940* -P <9>:                                pwd invocation.      (line  22)
18941* -p <11>:                               who invocation.      (line  65)
18942* -p <12>:                               uname invocation.    (line  51)
18943* -P <10>:                               chcon invocation.    (line  56)
18944* -q:                                    head invocation.     (line  47)
18945* -q <1>:                                tail invocation.     (line 153)
18946* -q <2>:                                csplit invocation.   (line 106)
18947* -q <3>:                                Formatting the file names.
18948                                                              (line  23)
18949* -Q:                                    Formatting the file names.
18950                                                              (line  30)
18951* -q <4>:                                readlink invocation. (line  57)
18952* -q <5>:                                mktemp invocation.   (line  92)
18953* -q <6>:                                realpath invocation. (line  46)
18954* -q <7>:                                who invocation.      (line  69)
18955* -r:                                    tac invocation.      (line  26)
18956* -r <1>:                                pr invocation.       (line 187)
18957* -r <2>:                                sum invocation.      (line  25)
18958* -r <3>:                                sort invocation.     (line 183)
18959* -R:                                    sort invocation.     (line 189)
18960* -r <4>:                                shuf invocation.     (line  47)
18961* -r <5>:                                Input processing in ptx.
18962                                                              (line  48)
18963* -R <1>:                                Output formatting in ptx.
18964                                                              (line  56)
18965* -R <2>:                                Which files are listed.
18966                                                              (line  90)
18967* -r <6>:                                Sorting the output.  (line  27)
18968* -R <3>:                                cp invocation.       (line 252)
18969* -r <7>:                                cp invocation.       (line 252)
18970* -r <8>:                                rm invocation.       (line  95)
18971* -R <4>:                                rm invocation.       (line  95)
18972* -r <9>:                                ln invocation.       (line 136)
18973* -R <5>:                                chown invocation.    (line 150)
18974* -R <6>:                                chgrp invocation.    (line  77)
18975* -R <7>:                                chmod invocation.    (line  73)
18976* -r <10>:                               touch invocation.    (line  89)
18977* -r <11>:                               truncate invocation. (line  30)
18978* -r <12>:                               Access permission tests.
18979                                                              (line  15)
18980* -r <13>:                               id invocation.       (line  42)
18981* -r <14>:                               who invocation.      (line  74)
18982* -r <15>:                               Options for date.    (line  65)
18983* -R <8>:                                Options for date.    (line  70)
18984* -r <16>:                               uname invocation.    (line  62)
18985* -R <9>:                                chcon invocation.    (line  35)
18986* -r <17>:                               chcon invocation.    (line  69)
18987* -r <18>:                               runcon invocation.   (line  40)
18988* -S:                                    Backup options.      (line  49)
18989* -s:                                    cat invocation.      (line  36)
18990* -s <1>:                                tac invocation.      (line  30)
18991* -s <2>:                                nl invocation.       (line 105)
18992* -S <1>:                                od invocation.       (line  81)
18993* -s <3>:                                od invocation.       (line 194)
18994* -s <4>:                                fmt invocation.      (line  47)
18995* -s <5>:                                pr invocation.       (line 192)
18996* -S <2>:                                pr invocation.       (line 201)
18997* -s <6>:                                fold invocation.     (line  29)
18998* -s <7>:                                tail invocation.     (line 173)
18999* -s <8>:                                csplit invocation.   (line 106)
19000* -s <9>:                                sum invocation.      (line  31)
19001* -s <10>:                               sort invocation.     (line 309)
19002* -S <3>:                                sort invocation.     (line 316)
19003* -s <11>:                               uniq invocation.     (line  41)
19004* -S <4>:                                Input processing in ptx.
19005                                                              (line  65)
19006* -s <12>:                               cut invocation.      (line  74)
19007* -s <13>:                               paste invocation.    (line  52)
19008* -s <14>:                               What information is listed.
19009                                                              (line 236)
19010* -S <5>:                                Sorting the output.  (line  32)
19011* -s <15>:                               cp invocation.       (line 337)
19012* -S <6>:                                cp invocation.       (line 345)
19013* -s <16>:                               install invocation.  (line 113)
19014* -S <7>:                                install invocation.  (line 120)
19015* -S <8>:                                mv invocation.       (line 103)
19016* -s <17>:                               ln invocation.       (line 160)
19017* -S <9>:                                ln invocation.       (line 166)
19018* -s <18>:                               readlink invocation. (line  57)
19019* -S <10>:                               du invocation.       (line 138)
19020* -s <19>:                               du invocation.       (line 153)
19021* -s <20>:                               truncate invocation. (line  34)
19022* -S <11>:                               File type tests.     (line  31)
19023* -s <21>:                               File characteristic tests.
19024                                                              (line  12)
19025* -s <22>:                               basename invocation. (line  38)
19026* -s <23>:                               realpath invocation. (line  64)
19027* -s <24>:                               tty invocation.      (line  18)
19028* -s <25>:                               who invocation.      (line  78)
19029* -s <26>:                               Options for date.    (line 113)
19030* -s <27>:                               uname invocation.    (line  66)
19031* -S <12>:                               env invocation.      (line 188)
19032* -s <28>:                               timeout invocation.  (line  48)
19033* -s <29>:                               seq invocation.      (line  44)
19034* -s BYTES:                              shred invocation.    (line 138)
19035* -S, env and single quotes:             env invocation.      (line 264)
19036* -t:                                    cat invocation.      (line  40)
19037* -T:                                    cat invocation.      (line  44)
19038* -t <1>:                                od invocation.       (line  90)
19039* -t <2>:                                fmt invocation.      (line  40)
19040* -t <3>:                                pr invocation.       (line 210)
19041* -T <1>:                                pr invocation.       (line 220)
19042* -t <4>:                                split invocation.    (line 148)
19043* -t <5>:                                md5sum invocation.   (line 109)
19044* -t <6>:                                sort invocation.     (line 332)
19045* -T <2>:                                sort invocation.     (line 353)
19046* -T <3>:                                Output formatting in ptx.
19047                                                              (line 118)
19048* -t <7>:                                expand invocation.   (line  22)
19049* -t <8>:                                unexpand invocation. (line  24)
19050* -t <9>:                                Sorting the output.  (line  36)
19051* -T <4>:                                General output formatting.
19052                                                              (line 117)
19053* -t <10>:                               cp invocation.       (line 350)
19054* -T <5>:                                cp invocation.       (line 354)
19055* -t <11>:                               install invocation.  (line 125)
19056* -T <6>:                                install invocation.  (line 130)
19057* -t <12>:                               mv invocation.       (line 108)
19058* -T <7>:                                mv invocation.       (line 112)
19059* -t <13>:                               ln invocation.       (line 171)
19060* -T <8>:                                ln invocation.       (line 175)
19061* -t <14>:                               df invocation.       (line 194)
19062* -T <9>:                                df invocation.       (line 200)
19063* -t <15>:                               du invocation.       (line 157)
19064* -t <16>:                               stat invocation.     (line  69)
19065* -t <17>:                               File type tests.     (line  34)
19066* -t <18>:                               mktemp invocation.   (line 121)
19067* -t <19>:                               who invocation.      (line  82)
19068* -T <10>:                               who invocation.      (line  94)
19069* -t <20>:                               chcon invocation.    (line  73)
19070* -t <21>:                               runcon invocation.   (line  44)
19071* -u:                                    cat invocation.      (line  47)
19072* -u <1>:                                fmt invocation.      (line  53)
19073* -u <2>:                                split invocation.    (line 155)
19074* -u <3>:                                sort invocation.     (line 369)
19075* -u <4>:                                uniq invocation.     (line 127)
19076* -u <5>:                                Sorting the output.  (line  44)
19077* -U:                                    Sorting the output.  (line  60)
19078* -u <6>:                                cp invocation.       (line 359)
19079* -u <7>:                                mv invocation.       (line  84)
19080* -u <8>:                                shred invocation.    (line 144)
19081* -u <9>:                                Access permission tests.
19082                                                              (line  18)
19083* -u <10>:                               mktemp invocation.   (line  97)
19084* -u <11>:                               id invocation.       (line  47)
19085* -u <12>:                               who invocation.      (line  85)
19086* -u <13>:                               Options for date.    (line 119)
19087* -u <14>:                               chcon invocation.    (line  65)
19088* -u <15>:                               runcon invocation.   (line  36)
19089* -u <16>:                               env invocation.      (line  96)
19090* -v:                                    cat invocation.      (line  51)
19091* -v <1>:                                nl invocation.       (line 110)
19092* -v <2>:                                od invocation.       (line 150)
19093* -v <3>:                                pr invocation.       (line 225)
19094* -v <4>:                                head invocation.     (line  51)
19095* -v <5>:                                tail invocation.     (line 184)
19096* -V:                                    sort invocation.     (line 177)
19097* -v <6>:                                Sorting the output.  (line  67)
19098* -v <7>:                                cp invocation.       (line 374)
19099* -v <8>:                                install invocation.  (line 135)
19100* -v <9>:                                mv invocation.       (line  95)
19101* -v <10>:                               rm invocation.       (line  99)
19102* -v <11>:                               shred invocation.    (line 159)
19103* -v <12>:                               ln invocation.       (line 180)
19104* -v <13>:                               mkdir invocation.    (line  51)
19105* -v <14>:                               readlink invocation. (line  61)
19106* -v <15>:                               rmdir invocation.    (line  31)
19107* -v <16>:                               chown invocation.    (line 142)
19108* -v <17>:                               chgrp invocation.    (line  69)
19109* -v <18>:                               chmod invocation.    (line  63)
19110* -v <19>:                               uname invocation.    (line  77)
19111* -v <20>:                               chcon invocation.    (line  61)
19112* -v <21>:                               env invocation.      (line 173)
19113* -v <22>:                               timeout invocation.  (line  54)
19114* -w:                                    nl invocation.       (line 115)
19115* -w <1>:                                od invocation.       (line 157)
19116* -w <2>:                                base64 invocation.   (line  22)
19117* -w <3>:                                fmt invocation.      (line  59)
19118* -w <4>:                                pr invocation.       (line 229)
19119* -W:                                    pr invocation.       (line 239)
19120* -w <5>:                                fold invocation.     (line  35)
19121* -w <6>:                                wc invocation.       (line  51)
19122* -w <7>:                                md5sum invocation.   (line 118)
19123* -w <8>:                                uniq invocation.     (line 133)
19124* -W <1>:                                Input processing in ptx.
19125                                                              (line 105)
19126* -w <9>:                                Output formatting in ptx.
19127                                                              (line  32)
19128* -w <10>:                               General output formatting.
19129                                                              (line 128)
19130* -w <11>:                               Access permission tests.
19131                                                              (line  21)
19132* -w <12>:                               who invocation.      (line  94)
19133* -w <13>:                               seq invocation.      (line  49)
19134* -WIDTH:                                fmt invocation.      (line  59)
19135* -x:                                    od invocation.       (line 197)
19136* -x <1>:                                split invocation.    (line 131)
19137* -X:                                    Sorting the output.  (line  74)
19138* -x <2>:                                General output formatting.
19139                                                              (line 113)
19140* -x <3>:                                cp invocation.       (line 378)
19141* -x <4>:                                shred invocation.    (line 164)
19142* -x <5>:                                df invocation.       (line 223)
19143* -x <6>:                                du invocation.       (line 263)
19144* -x <7>:                                Access permission tests.
19145                                                              (line  24)
19146* -X FILE:                               du invocation.       (line 252)
19147* -z:                                    head invocation.     (line  55)
19148* -z <1>:                                tail invocation.     (line 188)
19149* -z <2>:                                csplit invocation.   (line  95)
19150* -z <3>:                                md5sum invocation.   (line 128)
19151* -z <4>:                                sort invocation.     (line 384)
19152* -z <5>:                                shuf invocation.     (line  55)
19153* -z <6>:                                uniq invocation.     (line 139)
19154* -z <7>:                                comm invocation.     (line  88)
19155* -z <8>:                                cut invocation.      (line  94)
19156* -z <9>:                                paste invocation.    (line  72)
19157* -z <10>:                               General options in join.
19158                                                              (line  93)
19159* -Z:                                    What information is listed.
19160                                                              (line 259)
19161* -Z <1>:                                cp invocation.       (line 384)
19162* -Z <2>:                                install invocation.  (line 139)
19163* -Z <3>:                                mv invocation.       (line 117)
19164* -z <11>:                               shred invocation.    (line 175)
19165* -Z <4>:                                mkdir invocation.    (line  56)
19166* -Z <5>:                                mkfifo invocation.   (line  28)
19167* -Z <6>:                                mknod invocation.    (line  53)
19168* -z <12>:                               readlink invocation. (line  65)
19169* -z <13>:                               String tests.        (line  15)
19170* -z <14>:                               basename invocation. (line  42)
19171* -z <15>:                               dirname invocation.  (line  31)
19172* -z <16>:                               realpath invocation. (line  71)
19173* -Z <7>:                                id invocation.       (line  51)
19174* -z <17>:                               id invocation.       (line  58)
19175* -z <18>:                               numfmt invocation.   (line 115)
19176* /:                                     Numeric expressions. (line  16)
19177* 128-bit checksum:                      md5sum invocation.   (line   6)
19178* 16-bit checksum:                       sum invocation.      (line   6)
19179* 160-bit checksum:                      sha1sum invocation.  (line   6)
19180* 224-bit checksum:                      sha2 utilities.      (line   6)
19181* 256-bit checksum:                      sha2 utilities.      (line   6)
19182* 384-bit checksum:                      sha2 utilities.      (line   6)
19183* 512-bit checksum:                      b2sum invocation.    (line   6)
19184* 512-bit checksum <1>:                  sha2 utilities.      (line   6)
19185* <:                                     Relations for expr.  (line  22)
19186* <=:                                    Relations for expr.  (line  22)
19187* =:                                     Relations for expr.  (line  22)
19188* = <1>:                                 String tests.        (line  22)
19189* ==:                                    Relations for expr.  (line  22)
19190* == <1>:                                String tests.        (line  25)
19191* >:                                     Relations for expr.  (line  22)
19192* >=:                                    Relations for expr.  (line  22)
19193* \( regexp operator:                    String expressions.  (line  24)
19194* \+ regexp operator:                    String expressions.  (line  28)
19195* \? regexp operator:                    String expressions.  (line  28)
19196* \c:                                    printf invocation.   (line  28)
19197* \OOO:                                  printf invocation.   (line  67)
19198* \uhhhh:                                printf invocation.   (line  74)
19199* \Uhhhhhhhh:                            printf invocation.   (line  74)
19200* \xHH:                                  printf invocation.   (line  67)
19201* \| regexp operator:                    String expressions.  (line  28)
19202* _POSIX2_VERSION:                       Standards conformance.
19203                                                              (line  20)
19204* _POSIX2_VERSION <1>:                   tail invocation.     (line 203)
19205* _POSIX2_VERSION <2>:                   sort invocation.     (line 416)
19206* _POSIX2_VERSION <3>:                   uniq invocation.     (line  46)
19207* _POSIX2_VERSION <4>:                   touch invocation.    (line 107)
19208* |:                                     Relations for expr.  (line  11)
19209* abbreviations for months:              Calendar date items. (line  38)
19210* access permission tests:               Access permission tests.
19211                                                              (line   6)
19212* access permissions, changing:          chmod invocation.    (line   6)
19213* access time, changing:                 touch invocation.    (line  48)
19214* access timestamp:                      dd invocation.       (line 278)
19215* access timestamp, printing or sorting files by: Sorting the output.
19216                                                              (line  44)
19217* access timestamp, show the most recent: du invocation.      (line 210)
19218* across columns:                        pr invocation.       (line  62)
19219* across, listing files:                 General output formatting.
19220                                                              (line 113)
19221* adding permissions:                    Setting Permissions. (line  35)
19222* addition:                              Numeric expressions. (line  12)
19223* ago in date strings:                   Relative items in date strings.
19224                                                              (line  23)
19225* all lines, grouping:                   uniq invocation.     (line 100)
19226* all repeated lines, outputting:        uniq invocation.     (line  69)
19227* alnum:                                 Character sets.      (line  88)
19228* alpha:                                 Character sets.      (line  90)
19229* alternate ebcdic, converting to:       dd invocation.       (line 117)
19230* always color option:                   General output formatting.
19231                                                              (line  26)
19232* always hyperlink option:               General output formatting.
19233                                                              (line  65)
19234* always interactive option:             rm invocation.       (line  59)
19235* am i:                                  who invocation.      (line  21)
19236* am in date strings:                    Time of day items.   (line  21)
19237* and operator:                          Connectives for test.
19238                                                              (line  29)
19239* and operator <1>:                      Relations for expr.  (line  17)
19240* append:                                dd invocation.       (line 207)
19241* appending to the output file:          dd invocation.       (line 207)
19242* appropriate privileges:                install invocation.  (line  91)
19243* appropriate privileges <1>:            Setting the time.    (line   6)
19244* appropriate privileges <2>:            hostname invocation. (line   6)
19245* appropriate privileges <3>:            nice invocation.     (line   6)
19246* arbitrary date strings, debugging:     Options for date.    (line  25)
19247* arbitrary date strings, parsing:       Options for date.    (line  11)
19248* arbitrary text, displaying:            echo invocation.     (line   6)
19249* arch:                                  arch invocation.     (line   6)
19250* arithmetic tests:                      Numeric tests.       (line   6)
19251* ASCII dump of files:                   od invocation.       (line   6)
19252* ascii, converting to:                  dd invocation.       (line 106)
19253* atime:                                 File timestamps.     (line   6)
19254* atime, changing:                       touch invocation.    (line  48)
19255* atime, printing or sorting files by:   Sorting the output.  (line  44)
19256* atime, show the most recent:           du invocation.       (line 210)
19257* attribute caching:                     stat invocation.     (line  33)
19258* attributes, file:                      Changing file attributes.
19259                                                              (line   6)
19260* authors of parse_datetime:             Authors of parse_datetime.
19261                                                              (line   6)
19262* auto color option:                     General output formatting.
19263                                                              (line  25)
19264* auto hyperlink option:                 General output formatting.
19265                                                              (line  64)
19266* b for block special file:              mknod invocation.    (line  31)
19267* b2sum:                                 b2sum invocation.    (line   6)
19268* background jobs, stopping at terminal write: Local.         (line  41)
19269* backslash escapes:                     Character sets.      (line  14)
19270* backslash escapes <1>:                 echo invocation.     (line  25)
19271* backslash escapes <2>:                 echo invocation.     (line  61)
19272* backslash sequences for file names:    Formatting the file names.
19273                                                              (line  11)
19274* backup files, ignoring:                Which files are listed.
19275                                                              (line  23)
19276* backup options:                        Backup options.      (line   6)
19277* backup suffix:                         Backup options.      (line  49)
19278* backups, making:                       Backup options.      (line  13)
19279* backups, making <1>:                   cp invocation.       (line  79)
19280* backups, making <2>:                   install invocation.  (line  41)
19281* backups, making <3>:                   mv invocation.       (line  59)
19282* backups, making <4>:                   ln invocation.       (line  82)
19283* backups, making only:                  cp invocation.       (line  51)
19284* base32:                                base32 invocation.   (line   6)
19285* base32 encoding:                       base32 invocation.   (line   6)
19286* base32 encoding <1>:                   basenc invocation.   (line   6)
19287* base64:                                base64 invocation.   (line   6)
19288* Base64 decoding:                       base64 invocation.   (line  30)
19289* base64 encoding:                       base64 invocation.   (line   6)
19290* basename:                              basename invocation. (line   6)
19291* basenc:                                basenc invocation.   (line   6)
19292* baud rate, setting:                    Special.             (line  52)
19293* beeping at input buffer full:          Input.               (line  59)
19294* beginning of time:                     Time conversion specifiers.
19295                                                              (line  32)
19296* beginning of time, for POSIX:          Seconds since the Epoch.
19297                                                              (line  13)
19298* Bellovin, Steven M.:                   Authors of parse_datetime.
19299                                                              (line   6)
19300* Berets, Jim:                           Authors of parse_datetime.
19301                                                              (line   6)
19302* Berry, K.:                             Introduction.        (line  29)
19303* Berry, K. <1>:                         Authors of parse_datetime.
19304                                                              (line  19)
19305* binary:                                dd invocation.       (line 295)
19306* binary I/O:                            dd invocation.       (line 295)
19307* binary input files:                    md5sum invocation.   (line  41)
19308* bind mount:                            rm invocation.       (line  67)
19309* bind mount <1>:                        stat invocation.     (line 191)
19310* birth time, printing or sorting files by: Sorting the output.
19311                                                              (line  52)
19312* birthtime:                             File timestamps.     (line   6)
19313* BLAKE2:                                b2sum invocation.    (line   6)
19314* BLAKE2 hash length:                    b2sum invocation.    (line  12)
19315* blank:                                 Character sets.      (line  92)
19316* blank lines, numbering:                nl invocation.       (line  82)
19317* blanks, ignoring leading:              sort invocation.     (line  79)
19318* block (space-padding):                 dd invocation.       (line 127)
19319* block size:                            Block size.          (line   6)
19320* block size <1>:                        dd invocation.       (line  34)
19321* block size of conversion:              dd invocation.       (line  41)
19322* block size of input:                   dd invocation.       (line  26)
19323* block size of output:                  dd invocation.       (line  30)
19324* block special check:                   File type tests.     (line  10)
19325* block special files:                   mknod invocation.    (line  11)
19326* block special files, creating:         mknod invocation.    (line   6)
19327* BLOCKSIZE:                             Block size.          (line  12)
19328* BLOCK_SIZE:                            Block size.          (line  12)
19329* body, numbering:                       nl invocation.       (line  17)
19330* Bourne shell syntax for color setup:   dircolors invocation.
19331                                                              (line  34)
19332* breaks, cause interrupts:              Input.               (line  12)
19333* breaks, ignoring:                      Input.               (line   9)
19334* brkint:                                Input.               (line  12)
19335* bs:                                    dd invocation.       (line  34)
19336* BSD output:                            md5sum invocation.   (line  99)
19337* BSD sum:                               sum invocation.      (line  25)
19338* BSD tail:                              tail invocation.     (line  26)
19339* BSD touch compatibility:               touch invocation.    (line  66)
19340* bsN:                                   Output.              (line  55)
19341* btrfs file system type:                df invocation.       (line 211)
19342* bugs, reporting:                       Introduction.        (line  12)
19343* built-in shell commands, conflicts with: mknod invocation.  (line  20)
19344* built-in shell commands, conflicts with <1>: stat invocation.
19345                                                              (line  15)
19346* built-in shell commands, conflicts with <2>: echo invocation.
19347                                                              (line  11)
19348* built-in shell commands, conflicts with <3>: printf invocation.
19349                                                              (line  16)
19350* built-in shell commands, conflicts with <4>: test invocation.
19351                                                              (line  28)
19352* built-in shell commands, conflicts with <5>: pwd invocation.
19353                                                              (line  30)
19354* built-in shell commands, conflicts with <6>: nice invocation.
19355                                                              (line  38)
19356* built-in shell commands, conflicts with <7>: kill invocation.
19357                                                              (line  13)
19358* built-in shell commands, conflicts with <8>: sleep invocation.
19359                                                              (line  36)
19360* byte count:                            wc invocation.       (line   6)
19361* byte-swapping:                         od invocation.       (line  51)
19362* byte-swapping <1>:                     dd invocation.       (line 159)
19363* c for character special file:          mknod invocation.    (line  34)
19364* C shell syntax for color setup:        dircolors invocation.
19365                                                              (line  40)
19366* C-s/C-q flow control:                  Input.               (line  40)
19367* calendar date item:                    Calendar date items. (line   6)
19368* calling combined multi-call program:   Multi-call invocation.
19369                                                              (line   6)
19370* canonical file name:                   readlink invocation. (line   6)
19371* canonical file name <1>:               realpath invocation. (line   6)
19372* canonicalize a file name:              readlink invocation. (line   6)
19373* canonicalize a file name <1>:          realpath invocation. (line   6)
19374* case folding:                          sort invocation.     (line  94)
19375* case translation:                      Local.               (line  36)
19376* case, ignored in dates:                General date syntax. (line  60)
19377* cat:                                   cat invocation.      (line   6)
19378* cbreak:                                Combination.         (line  52)
19379* cbs:                                   dd invocation.       (line  41)
19380* CD-ROM file system type:               df invocation.       (line 215)
19381* cdfs file system type:                 df invocation.       (line 215)
19382* cdtrdsr:                               Control.             (line  44)
19383* change or print terminal settings:     stty invocation.     (line   6)
19384* change SELinux context:                chcon invocation.    (line   6)
19385* changed files, verbosely describing:   chgrp invocation.    (line  24)
19386* changed owners, verbosely describing:  chown invocation.    (line  73)
19387* changing access permissions:           chmod invocation.    (line   6)
19388* changing file attributes:              Changing file attributes.
19389                                                              (line   6)
19390* changing file ownership:               chown invocation.    (line   6)
19391* changing file timestamps:              touch invocation.    (line   6)
19392* changing group ownership:              chown invocation.    (line   6)
19393* changing group ownership <1>:          chgrp invocation.    (line   6)
19394* changing security context:             chcon invocation.    (line   6)
19395* changing special mode bits:            Changing Special Mode Bits.
19396                                                              (line   6)
19397* character classes:                     Character sets.      (line  74)
19398* character count:                       wc invocation.       (line   6)
19399* character size:                        Control.             (line  24)
19400* character special check:               File type tests.     (line  13)
19401* character special files:               mknod invocation.    (line  11)
19402* character special files, creating:     mknod invocation.    (line   6)
19403* characters, special:                   Characters.          (line   6)
19404* chcon:                                 chcon invocation.    (line   6)
19405* check file types:                      test invocation.     (line   6)
19406* checking for sortedness:               sort invocation.     (line  39)
19407* checking for sortedness <1>:           sort invocation.     (line  47)
19408* checksum, 128-bit:                     md5sum invocation.   (line   6)
19409* checksum, 16-bit:                      sum invocation.      (line   6)
19410* checksum, 160-bit:                     sha1sum invocation.  (line   6)
19411* checksum, 224-bit:                     sha2 utilities.      (line   6)
19412* checksum, 256-bit:                     sha2 utilities.      (line   6)
19413* checksum, 384-bit:                     sha2 utilities.      (line   6)
19414* checksum, 512-bit:                     b2sum invocation.    (line   6)
19415* checksum, 512-bit <1>:                 sha2 utilities.      (line   6)
19416* chgrp:                                 chgrp invocation.    (line   6)
19417* chmod:                                 chmod invocation.    (line   6)
19418* chown:                                 chown invocation.    (line   6)
19419* chroot:                                chroot invocation.   (line   6)
19420* cio:                                   dd invocation.       (line 215)
19421* cksum:                                 cksum invocation.    (line   6)
19422* clocal:                                Control.             (line  38)
19423* clock skew:                            Formatting file timestamps.
19424                                                              (line  11)
19425* clock skew <1>:                        File timestamps.     (line  39)
19426* clone:                                 cp invocation.       (line 265)
19427* cmspar:                                Control.             (line  16)
19428* cntrl:                                 Character sets.      (line  94)
19429* color database, printing:              dircolors invocation.
19430                                                              (line  45)
19431* color setup:                           dircolors invocation.
19432                                                              (line   6)
19433* color, distinguishing file types with: General output formatting.
19434                                                              (line  22)
19435* cols:                                  Special.             (line  27)
19436* column to wrap data after:             base64 invocation.   (line  22)
19437* COLUMNS:                               General output formatting.
19438                                                              (line 128)
19439* COLUMNS <1>:                           Special.             (line  39)
19440* columns:                               Special.             (line  27)
19441* combination settings:                  Combination.         (line   6)
19442* combined:                              Multi-call invocation.
19443                                                              (line   6)
19444* combined date and time of day item:    Combined date and time of day items.
19445                                                              (line   6)
19446* comm:                                  comm invocation.     (line   6)
19447* command-line operands to shuffle:      shuf invocation.     (line  19)
19448* commands for controlling processes:    Process control.     (line   6)
19449* commands for delaying:                 Delaying.            (line   6)
19450* commands for exit status:              Conditions.          (line   6)
19451* commands for file name manipulation:   File name manipulation.
19452                                                              (line   6)
19453* commands for invoking other commands:  Modified command invocation.
19454                                                              (line   6)
19455* commands for printing text:            Printing text.       (line   6)
19456* commands for printing the working context: Working context. (line   6)
19457* commands for printing user information: User information.   (line   6)
19458* commands for redirection:              Redirection.         (line   6)
19459* commands for SELinux context:          SELinux context.     (line   6)
19460* commands for system context:           System context.      (line   6)
19461* commas, outputting between files:      General output formatting.
19462                                                              (line 103)
19463* comments, in dates:                    General date syntax. (line  60)
19464* common field, joining on:              join invocation.     (line   6)
19465* common lines:                          comm invocation.     (line  18)
19466* common options:                        Common options.      (line   6)
19467* compare values:                        test invocation.     (line   6)
19468* comparing sorted files:                comm invocation.     (line   6)
19469* comparison operators:                  Relations for expr.  (line  22)
19470* concatenate and write files:           cat invocation.      (line   6)
19471* concurrent I/O:                        dd invocation.       (line 215)
19472* conditional executability:             Conditional Executability.
19473                                                              (line   6)
19474* conditions:                            Conditions.          (line   6)
19475* conflicts with shell built-ins:        mknod invocation.    (line  20)
19476* conflicts with shell built-ins <1>:    stat invocation.     (line  15)
19477* conflicts with shell built-ins <2>:    echo invocation.     (line  11)
19478* conflicts with shell built-ins <3>:    printf invocation.   (line  16)
19479* conflicts with shell built-ins <4>:    test invocation.     (line  28)
19480* conflicts with shell built-ins <5>:    pwd invocation.      (line  30)
19481* conflicts with shell built-ins <6>:    nice invocation.     (line  38)
19482* conflicts with shell built-ins <7>:    kill invocation.     (line  13)
19483* conflicts with shell built-ins <8>:    sleep invocation.    (line  36)
19484* connectives, logical:                  Connectives for test.
19485                                                              (line   6)
19486* connectives, logical <1>:              Relations for expr.  (line   6)
19487* constant parity:                       Control.             (line  16)
19488* context splitting:                     csplit invocation.   (line   6)
19489* context, system:                       System context.      (line   6)
19490* control characters, using ^C:          Local.               (line  51)
19491* control settings:                      Control.             (line   6)
19492* controlling terminal:                  dd invocation.       (line 284)
19493* conv:                                  dd invocation.       (line 100)
19494* conversion block size:                 dd invocation.       (line  41)
19495* conversion specifiers, date:           Date conversion specifiers.
19496                                                              (line   6)
19497* conversion specifiers, literal:        Literal conversion specifiers.
19498                                                              (line   6)
19499* conversion specifiers, time:           Time conversion specifiers.
19500                                                              (line   6)
19501* converting tabs to spaces:             expand invocation.   (line   6)
19502* converting while copying a file:       dd invocation.       (line   6)
19503* cooked:                                Combination.         (line  37)
19504* Coordinated Universal Time:            Options for date.    (line 119)
19505* copy on write:                         cp invocation.       (line 265)
19506* copying directories recursively:       cp invocation.       (line  96)
19507* copying directories recursively <1>:   cp invocation.       (line 252)
19508* copying existing permissions:          Copying Permissions. (line   6)
19509* copying files:                         cat invocation.      (line   6)
19510* copying files and directories:         cp invocation.       (line   6)
19511* copying files and setting attributes:  install invocation.  (line   6)
19512* core utilities:                        Top.                 (line  18)
19513* count:                                 dd invocation.       (line  56)
19514* count_bytes:                           dd invocation.       (line 313)
19515* COW:                                   cp invocation.       (line 265)
19516* cp:                                    cp invocation.       (line   6)
19517* crashes and corruption:                sync invocation.     (line  17)
19518* CRC checksum:                          cksum invocation.    (line   6)
19519* cread:                                 Control.             (line  35)
19520* creating directories:                  mkdir invocation.    (line   6)
19521* creating FIFOs (named pipes):          mkfifo invocation.   (line   6)
19522* creating links (hard only):            link invocation.     (line   6)
19523* creating links (hard or soft):         ln invocation.       (line   6)
19524* creating output file, avoiding:        dd invocation.       (line 176)
19525* creating output file, requiring:       dd invocation.       (line 172)
19526* creation timestamp, printing or sorting files by: Sorting the output.
19527                                                              (line  52)
19528* crN:                                   Output.              (line  45)
19529* crown margin:                          fmt invocation.      (line  34)
19530* crt:                                   Combination.         (line  75)
19531* crterase:                              Local.               (line  22)
19532* crtkill:                               Local.               (line  56)
19533* crtscts:                               Control.             (line  41)
19534* csh syntax for color setup:            dircolors invocation.
19535                                                              (line  40)
19536* csN:                                   Control.             (line  24)
19537* csplit:                                csplit invocation.   (line   6)
19538* cstopb:                                Control.             (line  32)
19539* ctime:                                 File timestamps.     (line   6)
19540* ctime, printing or sorting by:         Sorting the output.  (line  13)
19541* ctime, show the most recent:           du invocation.       (line 204)
19542* ctlecho:                               Local.               (line  51)
19543* current working directory, printing:   pwd invocation.      (line   6)
19544* cut:                                   cut invocation.      (line   6)
19545* cyclic redundancy check:               cksum invocation.    (line   6)
19546* data, erasing:                         shred invocation.    (line   6)
19547* database for color setup, printing:    dircolors invocation.
19548                                                              (line  45)
19549* date:                                  date invocation.     (line   6)
19550* date and time of day format, ISO 8601: Combined date and time of day items.
19551                                                              (line   6)
19552* date conversion specifiers:            Date conversion specifiers.
19553                                                              (line   6)
19554* date format, ISO 8601:                 Calendar date items. (line  30)
19555* date input formats:                    Date input formats.  (line   6)
19556* date options:                          Options for date.    (line   6)
19557* date strings, debugging:               Options for date.    (line  25)
19558* date strings, parsing:                 Options for date.    (line  11)
19559* day in date strings:                   Relative items in date strings.
19560                                                              (line  15)
19561* day in date strings <1>:               Relative items in date strings.
19562                                                              (line  29)
19563* day of week item:                      Day of week items.   (line   6)
19564* dd:                                    dd invocation.       (line   6)
19565* ddrescue:                              dd invocation.       (line 362)
19566* debugging date strings:                Options for date.    (line  25)
19567* debugging, env -S:                     env invocation.      (line 273)
19568* dec:                                   Combination.         (line  78)
19569* decctlq:                               Combination.         (line  63)
19570* Decode base64 data:                    base64 invocation.   (line  30)
19571* delay for a specified time:            sleep invocation.    (line   6)
19572* delaying commands:                     Delaying.            (line   6)
19573* deleting characters:                   Squeezing and deleting.
19574                                                              (line   6)
19575* dereferencing symbolic links:          ln invocation.       (line  42)
19576* descriptor follow option:              tail invocation.     (line  56)
19577* destination directory:                 Target directory.    (line  15)
19578* destination directory <1>:             Target directory.    (line  31)
19579* destination directory <2>:             cp invocation.       (line 350)
19580* destination directory <3>:             cp invocation.       (line 354)
19581* destination directory <4>:             install invocation.  (line 125)
19582* destination directory <5>:             install invocation.  (line 130)
19583* destination directory <6>:             mv invocation.       (line 108)
19584* destination directory <7>:             mv invocation.       (line 112)
19585* destination directory <8>:             ln invocation.       (line 171)
19586* destination directory <9>:             ln invocation.       (line 175)
19587* destinations, multiple output:         tee invocation.      (line   6)
19588* device file, disk:                     df invocation.       (line  30)
19589* df:                                    df invocation.       (line   6)
19590* DF_BLOCK_SIZE:                         Block size.          (line  12)
19591* diagnostic:                            chcon invocation.    (line  61)
19592* dictionary order:                      sort invocation.     (line  87)
19593* differing lines:                       comm invocation.     (line  18)
19594* digit:                                 Character sets.      (line  96)
19595* dir:                                   dir invocation.      (line   6)
19596* dircolors:                             dircolors invocation.
19597                                                              (line   6)
19598* direct:                                dd invocation.       (line 221)
19599* direct I/O:                            dd invocation.       (line 221)
19600* directories, copying:                  cp invocation.       (line   6)
19601* directories, copying recursively:      cp invocation.       (line  96)
19602* directories, copying recursively <1>:  cp invocation.       (line 252)
19603* directories, creating:                 mkdir invocation.    (line   6)
19604* directories, creating with given attributes: install invocation.
19605                                                              (line  67)
19606* directories, removing:                 rm invocation.       (line  35)
19607* directories, removing (recursively):   rm invocation.       (line  95)
19608* directories, removing empty:           rmdir invocation.    (line   6)
19609* directory:                             dd invocation.       (line 229)
19610* directory check:                       File type tests.     (line  16)
19611* directory components, printing:        dirname invocation.  (line   6)
19612* directory deletion, ignoring failures: rmdir invocation.    (line  17)
19613* directory deletion, reporting:         rmdir invocation.    (line  31)
19614* directory I/O:                         dd invocation.       (line 229)
19615* directory listing:                     ls invocation.       (line   6)
19616* directory listing, brief:              dir invocation.      (line   6)
19617* directory listing, recursive:          Which files are listed.
19618                                                              (line  90)
19619* directory listing, verbose:            vdir invocation.     (line   6)
19620* directory order, listing by:           Sorting the output.  (line  20)
19621* directory, creating temporary:         mktemp invocation.   (line   6)
19622* directory, stripping from file names:  basename invocation. (line   6)
19623* dired Emacs mode support:              What information is listed.
19624                                                              (line  16)
19625* dirname:                               dirname invocation.  (line   6)
19626* disabling special characters:          Characters.          (line  12)
19627* disambiguating group names and IDs:    Disambiguating names and IDs.
19628                                                              (line   6)
19629* discard:                               Characters.          (line  39)
19630* discarding file cache:                 dd invocation.       (line 246)
19631* disk allocation:                       What information is listed.
19632                                                              (line 236)
19633* disk device file:                      df invocation.       (line  30)
19634* disk usage:                            Disk usage.          (line   6)
19635* disk usage by file system:             df invocation.       (line   6)
19636* disk usage for files:                  du invocation.       (line   6)
19637* disks, failing:                        dd invocation.       (line 362)
19638* displacement of dates:                 Relative items in date strings.
19639                                                              (line   6)
19640* displaying text:                       echo invocation.     (line   6)
19641* displaying value of a symbolic link:   readlink invocation. (line   6)
19642* division:                              Numeric expressions. (line  16)
19643* do nothing, successfully:              true invocation.     (line   6)
19644* do nothing, unsuccessfully:            false invocation.    (line   6)
19645* DOS file system:                       df invocation.       (line 219)
19646* double spacing:                        pr invocation.       (line  74)
19647* down columns:                          pr invocation.       (line  49)
19648* drain:                                 Special.             (line  30)
19649* dsusp:                                 Characters.          (line  57)
19650* dsync:                                 dd invocation.       (line 235)
19651* DTR/DSR flow control:                  Control.             (line  44)
19652* du:                                    du invocation.       (line   6)
19653* DU_BLOCK_SIZE:                         Block size.          (line  12)
19654* DVD file system type:                  df invocation.       (line 215)
19655* ebcdic, converting to:                 dd invocation.       (line 112)
19656* echo:                                  echo invocation.     (line   6)
19657* echo <1>:                              Local.               (line  18)
19658* echoctl:                               Local.               (line  51)
19659* echoe:                                 Local.               (line  22)
19660* echok:                                 Local.               (line  26)
19661* echoke:                                Local.               (line  56)
19662* echonl:                                Local.               (line  29)
19663* echoprt:                               Local.               (line  46)
19664* effective user and group IDs, printing: id invocation.      (line   6)
19665* effective user ID, printing:           whoami invocation.   (line   6)
19666* Eggert, Paul:                          Authors of parse_datetime.
19667                                                              (line   6)
19668* eight-bit characters:                  Control.             (line  24)
19669* eight-bit characters <1>:              Combination.         (line  55)
19670* eight-bit input:                       Input.               (line  25)
19671* ek:                                    Combination.         (line  22)
19672* empty files, creating:                 touch invocation.    (line  11)
19673* empty lines, numbering:                nl invocation.       (line  82)
19674* endianness:                            od invocation.       (line  51)
19675* entire files, output of:               Output of entire files.
19676                                                              (line   6)
19677* env:                                   env invocation.      (line   6)
19678* env -S, and single quotes:             env invocation.      (line 264)
19679* env -S, debugging:                     env invocation.      (line 273)
19680* env in scripts:                        env invocation.      (line 188)
19681* environment variables, printing:       printenv invocation. (line   6)
19682* environment, printing:                 env invocation.      (line  50)
19683* environment, running a program in a modified: env invocation.
19684                                                              (line   6)
19685* eof:                                   Characters.          (line  30)
19686* eol:                                   Characters.          (line  33)
19687* eol2:                                  Characters.          (line  36)
19688* epoch, for POSIX:                      Seconds since the Epoch.
19689                                                              (line  13)
19690* epoch, seconds since:                  Time conversion specifiers.
19691                                                              (line  32)
19692* equal string check:                    String tests.        (line  22)
19693* equal string check <1>:                String tests.        (line  25)
19694* equivalence classes:                   Character sets.      (line 113)
19695* erase:                                 Characters.          (line  24)
19696* erasing data:                          shred invocation.    (line   6)
19697* error messages, omitting:              chown invocation.    (line  79)
19698* error messages, omitting <1>:          chgrp invocation.    (line  30)
19699* error messages, omitting <2>:          chmod invocation.    (line  49)
19700* evaluation of expressions:             expr invocation.     (line   6)
19701* even parity:                           Control.             (line  13)
19702* evenp:                                 Combination.         (line   9)
19703* exabyte, definition of:                Block size.          (line 106)
19704* examples of date:                      Examples of date.    (line   6)
19705* examples of expr:                      Examples of expr.    (line   6)
19706* exbibyte, definition of:               Block size.          (line 109)
19707* excl:                                  dd invocation.       (line 172)
19708* excluding files from du:               du invocation.       (line 252)
19709* excluding files from du <1>:           du invocation.       (line 257)
19710* executable file check:                 Access permission tests.
19711                                                              (line  24)
19712* executables and file type, marking:    General output formatting.
19713                                                              (line  46)
19714* execute/search permission:             Mode Structure.      (line  16)
19715* execute/search permission, symbolic:   Setting Permissions. (line  56)
19716* existence-of-file check:               File characteristic tests.
19717                                                              (line   9)
19718* existing backup method:                Backup options.      (line  39)
19719* exit status commands:                  Conditions.          (line   6)
19720* exit status of chroot:                 chroot invocation.   (line  78)
19721* exit status of env:                    env invocation.      (line 193)
19722* exit status of expr:                   expr invocation.     (line  43)
19723* exit status of false:                  false invocation.    (line   6)
19724* exit status of ls:                     ls invocation.       (line  29)
19725* exit status of mktemp:                 mktemp invocation.   (line 128)
19726* exit status of nice:                   nice invocation.     (line  63)
19727* exit status of nohup:                  nohup invocation.    (line  48)
19728* exit status of pathchk:                pathchk invocation.  (line  47)
19729* exit status of printenv:               printenv invocation. (line  23)
19730* exit status of realpath:               realpath invocation. (line  75)
19731* exit status of runcon:                 runcon invocation.   (line  50)
19732* exit status of sort:                   sort invocation.     (line  58)
19733* exit status of stdbuf:                 stdbuf invocation.   (line  70)
19734* exit status of test:                   test invocation.     (line  41)
19735* exit status of timeout:                timeout invocation.  (line  66)
19736* exit status of true:                   true invocation.     (line   6)
19737* exit status of tty:                    tty invocation.      (line  20)
19738* expand:                                expand invocation.   (line   6)
19739* expr:                                  expr invocation.     (line   6)
19740* expression evaluation:                 test invocation.     (line   6)
19741* expression evaluation <1>:             expr invocation.     (line   6)
19742* expressions, numeric:                  Numeric expressions. (line   6)
19743* expressions, string:                   String expressions.  (line   6)
19744* ext2 file system type:                 df invocation.       (line 211)
19745* ext3 file system type:                 df invocation.       (line 211)
19746* ext4 file system type:                 df invocation.       (line 211)
19747* extended attributes, xattr:            install invocation.  (line  34)
19748* extended attributes, xattr <1>:        mv invocation.       (line  33)
19749* extension, sorting files by:           Sorting the output.  (line  74)
19750* extproc:                               Local.               (line  61)
19751* factor:                                factor invocation.   (line   6)
19752* failure exit status:                   false invocation.    (line   6)
19753* false:                                 false invocation.    (line   6)
19754* fat file system file:                  df invocation.       (line 219)
19755* fdatasync:                             dd invocation.       (line 188)
19756* ffN:                                   Output.              (line  63)
19757* field separator character:             sort invocation.     (line 332)
19758* fields, padding numeric:               Padding and other flags.
19759                                                              (line   6)
19760* FIFOs, creating:                       mkfifo invocation.   (line   6)
19761* file attributes, changing:             Changing file attributes.
19762                                                              (line   6)
19763* file characteristic tests:             File characteristic tests.
19764                                                              (line   6)
19765* file contents, dumping unambiguously:  od invocation.       (line   6)
19766* file information, preserving:          cp invocation.       (line 235)
19767* file information, preserving, extended attributes, xattr: cp invocation.
19768                                                              (line 169)
19769* file mode bits, numeric:               Numeric Modes.       (line   6)
19770* file name manipulation:                File name manipulation.
19771                                                              (line   6)
19772* file names, canonicalization:          realpath invocation. (line   6)
19773* file names, checking validity and portability: pathchk invocation.
19774                                                              (line   6)
19775* file names, creating temporary:        mktemp invocation.   (line   6)
19776* file names, stripping directory and suffix: basename invocation.
19777                                                              (line   6)
19778* file offset radix:                     od invocation.       (line  36)
19779* file ownership, changing:              chown invocation.    (line   6)
19780* file sizes:                            du invocation.       (line  52)
19781* file space usage:                      du invocation.       (line   6)
19782* file status:                           stat invocation.     (line   6)
19783* file system disk usage:                df invocation.       (line   6)
19784* file system sizes:                     df invocation.       (line  54)
19785* file system space, retrieving current data more slowly: df invocation.
19786                                                              (line 174)
19787* file system space, retrieving old data more quickly: df invocation.
19788                                                              (line  84)
19789* file system status:                    stat invocation.     (line   6)
19790* file system types, limiting output to certain: df invocation.
19791                                                              (line  80)
19792* file system types, limiting output to certain <1>: df invocation.
19793                                                              (line 194)
19794* file system types, printing:           df invocation.       (line 200)
19795* file systems:                          stat invocation.     (line  28)
19796* file systems and hard links:           ln invocation.       (line   6)
19797* file systems, omitting copying to different: cp invocation. (line 378)
19798* file timestamp resolution:             File timestamps.     (line  45)
19799* file timestamps, changing:             touch invocation.    (line   6)
19800* file type and executables, marking:    General output formatting.
19801                                                              (line  46)
19802* file type tests:                       File type tests.     (line   6)
19803* file type, marking:                    General output formatting.
19804                                                              (line  57)
19805* file type, marking <1>:                General output formatting.
19806                                                              (line 108)
19807* file types:                            Special file types.  (line   9)
19808* file types, special:                   Special file types.  (line   6)
19809* file utilities:                        Top.                 (line  18)
19810* files beginning with -, removing:      rm invocation.       (line 101)
19811* files, copying:                        cp invocation.       (line   6)
19812* files, creating:                       truncate invocation. (line  11)
19813* fingerprint, 128-bit:                  md5sum invocation.   (line   6)
19814* fingerprint, 160-bit:                  sha1sum invocation.  (line   6)
19815* fingerprint, 224-bit:                  sha2 utilities.      (line   6)
19816* fingerprint, 256-bit:                  sha2 utilities.      (line   6)
19817* fingerprint, 384-bit:                  sha2 utilities.      (line   6)
19818* fingerprint, 512-bit:                  b2sum invocation.    (line   6)
19819* fingerprint, 512-bit <1>:              sha2 utilities.      (line   6)
19820* first in date strings:                 General date syntax. (line  22)
19821* first part of files, outputting:       head invocation.     (line   6)
19822* fixed-length records, converting to variable-length: dd invocation.
19823                                                              (line  41)
19824* floating point:                        Floating point.      (line   6)
19825* flow control, hardware:                Control.             (line  41)
19826* flow control, hardware <1>:            Control.             (line  44)
19827* flow control, software:                Input.               (line  45)
19828* flush:                                 Characters.          (line  39)
19829* flushing, disabling:                   Local.               (line  32)
19830* flusho:                                Local.               (line  67)
19831* fmt:                                   fmt invocation.      (line   6)
19832* fold:                                  fold invocation.     (line   6)
19833* folding long input lines:              fold invocation.     (line   6)
19834* footers, numbering:                    nl invocation.       (line  17)
19835* force deletion:                        shred invocation.    (line 123)
19836* formatting file contents:              Formatting file contents.
19837                                                              (line   6)
19838* formatting of numbers in seq:          seq invocation.      (line  28)
19839* formatting times:                      pr invocation.       (line  78)
19840* formatting times <1>:                  date invocation.     (line  20)
19841* fortnight in date strings:             Relative items in date strings.
19842                                                              (line  15)
19843* fsync:                                 dd invocation.       (line 192)
19844* fullblock:                             dd invocation.       (line 303)
19845* general date syntax:                   General date syntax. (line   6)
19846* general numeric sort:                  sort invocation.     (line 105)
19847* gibibyte, definition of:               Block size.          (line  94)
19848* gigabyte, definition of:               Block size.          (line  91)
19849* giving away permissions:               Umask and Protection.
19850                                                              (line  12)
19851* GMT:                                   Options for date.    (line 119)
19852* grand total of disk size, usage and available space: df invocation.
19853                                                              (line 180)
19854* grand total of disk space:             du invocation.       (line  61)
19855* graph:                                 Character sets.      (line  98)
19856* Greenwich Mean Time:                   Options for date.    (line 119)
19857* group IDs, disambiguating:             Disambiguating names and IDs.
19858                                                              (line   6)
19859* group names, disambiguating:           Disambiguating names and IDs.
19860                                                              (line   6)
19861* group owner, default:                  Mode Structure.      (line  27)
19862* group ownership of installed files, setting: install invocation.
19863                                                              (line  73)
19864* group ownership, changing:             chown invocation.    (line   6)
19865* group ownership, changing <1>:         chgrp invocation.    (line   6)
19866* group, permissions for:                Setting Permissions. (line  25)
19867* groups:                                groups invocation.   (line   6)
19868* growing files:                         tail invocation.     (line  56)
19869* hangups, immunity to:                  nohup invocation.    (line   6)
19870* hard link check:                       File characteristic tests.
19871                                                              (line  23)
19872* hard link, defined:                    ln invocation.       (line  32)
19873* hard links:                            dd invocation.       (line 292)
19874* hard links to directories:             ln invocation.       (line  88)
19875* hard links to symbolic links:          ln invocation.       (line 182)
19876* hard links, counting in du:            du invocation.       (line 123)
19877* hard links, creating:                  link invocation.     (line   6)
19878* hard links, creating <1>:              ln invocation.       (line   6)
19879* hard links, preserving:                cp invocation.       (line 109)
19880* hardware class:                        uname invocation.    (line  42)
19881* hardware flow control:                 Control.             (line  41)
19882* hardware flow control <1>:             Control.             (line  44)
19883* hardware platform:                     uname invocation.    (line  35)
19884* hardware type:                         uname invocation.    (line  42)
19885* hat notation for control characters:   Local.               (line  51)
19886* head:                                  head invocation.     (line   6)
19887* head of output:                        shuf invocation.     (line  31)
19888* headers, numbering:                    nl invocation.       (line  17)
19889* help, online:                          Common options.      (line  36)
19890* hex dump of files:                     od invocation.       (line   6)
19891* holes, copying files with:             cp invocation.       (line 299)
19892* holes, creating files with:            truncate invocation. (line  13)
19893* horizontal, listing files:             General output formatting.
19894                                                              (line 113)
19895* host processor type:                   uname invocation.    (line  51)
19896* hostid:                                hostid invocation.   (line   6)
19897* hostname:                              hostname invocation. (line   6)
19898* hostname <1>:                          uname invocation.    (line  47)
19899* hour in date strings:                  Relative items in date strings.
19900                                                              (line  15)
19901* human numeric sort:                    sort invocation.     (line 126)
19902* human-readable output:                 Block size.          (line  42)
19903* human-readable output <1>:             What information is listed.
19904                                                              (line 116)
19905* human-readable output <2>:             df invocation.       (line  59)
19906* human-readable output <3>:             du invocation.       (line  96)
19907* hup[cl]:                               Control.             (line  28)
19908* hurd, author, printing:                What information is listed.
19909                                                              (line  10)
19910* hyperlink, linking to files:           General output formatting.
19911                                                              (line  61)
19912* ibs:                                   dd invocation.       (line  26)
19913* icanon:                                Local.               (line  11)
19914* icrnl:                                 Input.               (line  34)
19915* id:                                    id invocation.       (line   6)
19916* idle time:                             who invocation.      (line  85)
19917* IEEE floating point:                   Floating point.      (line   6)
19918* iexten:                                Local.               (line  15)
19919* if:                                    dd invocation.       (line  18)
19920* iflag:                                 dd invocation.       (line 196)
19921* ignbrk:                                Input.               (line   9)
19922* igncr:                                 Input.               (line  31)
19923* ignore file systems:                   df invocation.       (line  42)
19924* Ignore garbage in base64 stream:       base64 invocation.   (line  36)
19925* ignoring case:                         sort invocation.     (line  94)
19926* ignpar:                                Input.               (line  15)
19927* imaxbel:                               Input.               (line  59)
19928* immunity to hangups:                   nohup invocation.    (line   6)
19929* implementation, hardware:              uname invocation.    (line  35)
19930* indenting lines:                       pr invocation.       (line 180)
19931* index:                                 String expressions.  (line  45)
19932* information, about current users:      who invocation.      (line   6)
19933* initial part of files, outputting:     head invocation.     (line   6)
19934* initial tabs, converting:              expand invocation.   (line  46)
19935* inlcr:                                 Input.               (line  28)
19936* inode number, printing:                What information is listed.
19937                                                              (line 123)
19938* inode usage:                           df invocation.       (line  69)
19939* inode usage, dereferencing in du:      du invocation.       (line 102)
19940* inode, and hard links:                 ln invocation.       (line  32)
19941* inodes, written buffered:              sync invocation.     (line  11)
19942* inpck:                                 Input.               (line  22)
19943* input block size:                      dd invocation.       (line  26)
19944* input encoding, UTF-8:                 Input.               (line  37)
19945* input range to shuffle:                shuf invocation.     (line  23)
19946* input settings:                        Input.               (line   6)
19947* input tabs:                            pr invocation.       (line  98)
19948* install:                               install invocation.  (line   6)
19949* intr:                                  Characters.          (line  18)
19950* invocation of commands, modified:      Modified command invocation.
19951                                                              (line   6)
19952* isig:                                  Local.               (line   7)
19953* ISO 8601 date and time of day format:  Combined date and time of day items.
19954                                                              (line   6)
19955* ISO 8601 date format:                  Calendar date items. (line  30)
19956* ISO/IEC 10646:                         printf invocation.   (line  74)
19957* ISO9660 file system type:              df invocation.       (line 215)
19958* iso9660 file system type:              df invocation.       (line 215)
19959* ispeed:                                Special.             (line  16)
19960* istrip:                                Input.               (line  25)
19961* items in date strings:                 General date syntax. (line   6)
19962* iterations, selecting the number of:   shred invocation.    (line 127)
19963* iuclc:                                 Input.               (line  50)
19964* iutf8:                                 Input.               (line  37)
19965* ixany:                                 Input.               (line  55)
19966* ixoff:                                 Input.               (line  45)
19967* ixon:                                  Input.               (line  40)
19968* join:                                  join invocation.     (line   6)
19969* kernel name:                           uname invocation.    (line  66)
19970* kernel release:                        uname invocation.    (line  62)
19971* kernel version:                        uname invocation.    (line  77)
19972* kibibyte, definition of:               Block size.          (line  82)
19973* kibibytes for file sizes:              du invocation.       (line 111)
19974* kibibytes for file system sizes:       df invocation.       (line  74)
19975* kill:                                  kill invocation.     (line   6)
19976* kill <1>:                              Characters.          (line  27)
19977* kilobyte, definition of:               Block size.          (line  78)
19978* Knuth, Donald E.:                      fmt invocation.      (line  19)
19979* language, in dates:                    General date syntax. (line  36)
19980* language, in dates <1>:                General date syntax. (line  40)
19981* last DAY:                              Day of week items.   (line  15)
19982* last DAY <1>:                          Options for date.    (line  11)
19983* last in date strings:                  General date syntax. (line  22)
19984* last modified dates, displaying in du: du invocation.       (line 197)
19985* last part of files, outputting:        tail invocation.     (line   6)
19986* lcase:                                 Combination.         (line  71)
19987* LCASE:                                 Combination.         (line  71)
19988* lcase, converting to:                  dd invocation.       (line 138)
19989* lchown:                                chown invocation.    (line 106)
19990* lchown <1>:                            chown invocation.    (line 118)
19991* lchown <2>:                            chgrp invocation.    (line  34)
19992* lchown <3>:                            chgrp invocation.    (line  46)
19993* LC_ALL:                                sort invocation.     (line  23)
19994* LC_ALL <1>:                            ls invocation.       (line  17)
19995* LC_COLLATE:                            sort invocation.     (line  23)
19996* LC_COLLATE <1>:                        uniq invocation.     (line  21)
19997* LC_COLLATE <2>:                        comm invocation.     (line  12)
19998* LC_COLLATE <3>:                        Sorting files for join.
19999                                                              (line  16)
20000* LC_COLLATE <4>:                        Relations for expr.  (line  22)
20001* LC_CTYPE:                              sort invocation.     (line  79)
20002* LC_CTYPE <1>:                          sort invocation.     (line  87)
20003* LC_CTYPE <2>:                          sort invocation.     (line  94)
20004* LC_CTYPE <3>:                          sort invocation.     (line 143)
20005* LC_CTYPE <4>:                          printf invocation.   (line  74)
20006* LC_MESSAGES:                           pr invocation.       (line  13)
20007* LC_NUMERIC:                            Block size.          (line  57)
20008* LC_NUMERIC <1>:                        Floating point.      (line  29)
20009* LC_NUMERIC <2>:                        sort invocation.     (line 105)
20010* LC_NUMERIC <3>:                        sort invocation.     (line 126)
20011* LC_NUMERIC <4>:                        sort invocation.     (line 160)
20012* LC_NUMERIC <5>:                        printf invocation.   (line  61)
20013* LC_TIME:                               pr invocation.       (line  85)
20014* LC_TIME <1>:                           sort invocation.     (line 150)
20015* LC_TIME <2>:                           Formatting file timestamps.
20016                                                              (line  28)
20017* LC_TIME <3>:                           Formatting file timestamps.
20018                                                              (line  73)
20019* LC_TIME <4>:                           Formatting file timestamps.
20020                                                              (line  97)
20021* LC_TIME <5>:                           du invocation.       (line 219)
20022* LC_TIME <6>:                           date invocation.     (line  11)
20023* leading directories, creating missing: install invocation.  (line  67)
20024* leading directory components, stripping: basename invocation.
20025                                                              (line   6)
20026* leap seconds:                          touch invocation.    (line  99)
20027* leap seconds <1>:                      Time conversion specifiers.
20028                                                              (line  32)
20029* leap seconds <2>:                      Time conversion specifiers.
20030                                                              (line  36)
20031* leap seconds <3>:                      Options for date.    (line 119)
20032* leap seconds <4>:                      Examples of date.    (line 104)
20033* leap seconds <5>:                      General date syntax. (line  65)
20034* leap seconds <6>:                      Time of day items.   (line  14)
20035* leap seconds <7>:                      Seconds since the Epoch.
20036                                                              (line  26)
20037* left margin:                           pr invocation.       (line 180)
20038* length:                                String expressions.  (line  50)
20039* limiting output of du:                 du invocation.       (line  74)
20040* line:                                  Special.             (line  46)
20041* line buffered:                         stdbuf invocation.   (line   6)
20042* line count:                            wc invocation.       (line   6)
20043* line numbering:                        nl invocation.       (line   6)
20044* line separator character:              split invocation.    (line 148)
20045* line settings of terminal:             stty invocation.     (line   6)
20046* line-breaking:                         fmt invocation.      (line  19)
20047* line-by-line comparison:               comm invocation.     (line   6)
20048* LINES:                                 Special.             (line  39)
20049* link:                                  link invocation.     (line   6)
20050* links, creating:                       link invocation.     (line   6)
20051* links, creating <1>:                   ln invocation.       (line   6)
20052* Linux file system types:               df invocation.       (line 211)
20053* literal conversion specifiers:         Literal conversion specifiers.
20054                                                              (line   6)
20055* litout:                                Combination.         (line  59)
20056* ln:                                    ln invocation.       (line   6)
20057* ln format for nl:                      nl invocation.       (line  93)
20058* lnext:                                 Characters.          (line  66)
20059* local file system types:               df invocation.       (line 211)
20060* local settings:                        Local.               (line   6)
20061* logging out and continuing to run:     nohup invocation.    (line   6)
20062* logical and operator:                  Connectives for test.
20063                                                              (line  29)
20064* logical and operator <1>:              Relations for expr.  (line  17)
20065* logical connectives:                   Connectives for test.
20066                                                              (line   6)
20067* logical connectives <1>:               Relations for expr.  (line   6)
20068* logical or operator:                   Connectives for test.
20069                                                              (line  33)
20070* logical or operator <1>:               Relations for expr.  (line  11)
20071* logical pages, numbering on:           nl invocation.       (line  12)
20072* login name, printing:                  logname invocation.  (line   6)
20073* login sessions, printing users with:   users invocation.    (line   6)
20074* login time:                            who invocation.      (line  11)
20075* logname:                               logname invocation.  (line   6)
20076* long ls format:                        What information is listed.
20077                                                              (line 131)
20078* lower:                                 Character sets.      (line 100)
20079* lowercase, translating to output:      Output.              (line  12)
20080* ls:                                    ls invocation.       (line   6)
20081* LS_BLOCK_SIZE:                         Block size.          (line  12)
20082* LS_COLORS:                             General output formatting.
20083                                                              (line  31)
20084* LS_COLORS <1>:                         dircolors invocation.
20085                                                              (line  23)
20086* lutimes:                               touch invocation.    (line  70)
20087* machine type:                          uname invocation.    (line  42)
20088* machine-readable stty output:          stty invocation.     (line  41)
20089* MacKenzie, D.:                         Introduction.        (line  29)
20090* MacKenzie, David:                      Authors of parse_datetime.
20091                                                              (line   6)
20092* Makefiles, installing programs in:     install invocation.  (line  29)
20093* manipulating files:                    Basic operations.    (line   6)
20094* manipulation of file names:            File name manipulation.
20095                                                              (line   6)
20096* mark parity:                           Control.             (line  16)
20097* match:                                 String expressions.  (line  36)
20098* matching patterns:                     String expressions.  (line  11)
20099* MD5:                                   md5sum invocation.   (line   6)
20100* md5sum:                                md5sum invocation.   (line   6)
20101* mebibyte, definition of:               Block size.          (line  89)
20102* mebibytes for file sizes:              du invocation.       (line 127)
20103* megabyte, definition of:               Block size.          (line  86)
20104* merging files:                         paste invocation.    (line   6)
20105* merging files in parallel:             pr invocation.       (line   6)
20106* merging sorted files:                  sort invocation.     (line  53)
20107* message status:                        who invocation.      (line  94)
20108* message-digest, 128-bit:               md5sum invocation.   (line   6)
20109* message-digest, 160-bit:               sha1sum invocation.  (line   6)
20110* message-digest, 224-bit:               sha2 utilities.      (line   6)
20111* message-digest, 256-bit:               sha2 utilities.      (line   6)
20112* message-digest, 384-bit:               sha2 utilities.      (line   6)
20113* message-digest, 512-bit:               b2sum invocation.    (line   6)
20114* message-digest, 512-bit <1>:           sha2 utilities.      (line   6)
20115* Meyering, J.:                          Introduction.        (line  29)
20116* Meyering, Jim:                         Authors of parse_datetime.
20117                                                              (line   6)
20118* midnight in date strings:              Time of day items.   (line  21)
20119* min:                                   Special.             (line   7)
20120* minute in date strings:                Relative items in date strings.
20121                                                              (line  15)
20122* minutes, time zone correction by:      Time of day items.   (line  29)
20123* mkdir:                                 mkdir invocation.    (line   6)
20124* mkfifo:                                mkfifo invocation.   (line   6)
20125* mknod:                                 mknod invocation.    (line   6)
20126* mktemp:                                mktemp invocation.   (line   6)
20127* modem control:                         Control.             (line  38)
20128* modes and umask:                       Umask and Protection.
20129                                                              (line   6)
20130* modes of created directories, setting: mkdir invocation.    (line  19)
20131* modes of created FIFOs, setting:       mkfifo invocation.   (line  21)
20132* modification timestamp, sorting files by: Sorting the output.
20133                                                              (line  36)
20134* modified command invocation:           Modified command invocation.
20135                                                              (line   6)
20136* modified environment, running a program in a: env invocation.
20137                                                              (line   6)
20138* modify time, changing:                 touch invocation.    (line  85)
20139* month in date strings:                 Relative items in date strings.
20140                                                              (line  15)
20141* month names in date strings:           Calendar date items. (line  38)
20142* months, sorting by:                    sort invocation.     (line 150)
20143* months, written-out:                   General date syntax. (line  32)
20144* MS-DOS file system:                    df invocation.       (line 219)
20145* MS-Windows file system:                df invocation.       (line 219)
20146* mtime:                                 File timestamps.     (line   6)
20147* mtime, changing:                       touch invocation.    (line  85)
20148* mtime-greater-atime file check:        File characteristic tests.
20149                                                              (line  27)
20150* multicall:                             Multi-call invocation.
20151                                                              (line   6)
20152* multicolumn output, generating:        pr invocation.       (line   6)
20153* multiple changes to permissions:       Multiple Changes.    (line   6)
20154* multiplication:                        Numeric expressions. (line  16)
20155* multipliers after numbers:             dd invocation.       (line 337)
20156* multithreaded sort:                    sort invocation.     (line 361)
20157* mv:                                    mv invocation.       (line   6)
20158* name follow option:                    tail invocation.     (line  56)
20159* name of kernel:                        uname invocation.    (line  66)
20160* named pipe check:                      File type tests.     (line  28)
20161* named pipes, creating:                 mkfifo invocation.   (line   6)
20162* network node name:                     uname invocation.    (line  47)
20163* never interactive option:              rm invocation.       (line  56)
20164* newer files, copying only:             cp invocation.       (line 359)
20165* newer files, moving only:              mv invocation.       (line  84)
20166* newer-than file check:                 File characteristic tests.
20167                                                              (line  15)
20168* newline echoing after kill:            Local.               (line  26)
20169* newline, echoing:                      Local.               (line  29)
20170* newline, translating to crlf:          Output.              (line  19)
20171* newline, translating to return:        Input.               (line  28)
20172* next DAY:                              Day of week items.   (line  15)
20173* next DAY <1>:                          Options for date.    (line  11)
20174* next in date strings:                  General date syntax. (line  22)
20175* NFS file system type:                  df invocation.       (line 206)
20176* NFS mounts from BSD to HP-UX:          What information is listed.
20177                                                              (line 244)
20178* NFS mounts from BSD to HP-UX <1>:      du invocation.       (line 266)
20179* nice:                                  nice invocation.     (line   6)
20180* niceness:                              nice invocation.     (line   6)
20181* nl:                                    nl invocation.       (line   6)
20182* nl <1>:                                Combination.         (line  18)
20183* nlN:                                   Output.              (line  39)
20184* no dereference:                        chcon invocation.    (line  26)
20185* no-op:                                 true invocation.     (line   6)
20186* noatime:                               dd invocation.       (line 278)
20187* nocache:                               dd invocation.       (line 246)
20188* nocreat:                               dd invocation.       (line 176)
20189* noctty:                                dd invocation.       (line 284)
20190* node name:                             uname invocation.    (line  47)
20191* noerror:                               dd invocation.       (line 185)
20192* noflsh:                                Local.               (line  32)
20193* nofollow:                              dd invocation.       (line 289)
20194* nohup:                                 nohup invocation.    (line   6)
20195* nohup.out:                             nohup invocation.    (line   6)
20196* nohup.out <1>:                         nohup invocation.    (line  20)
20197* nolinks:                               dd invocation.       (line 292)
20198* non-directories, copying as special files: cp invocation.   (line  96)
20199* non-directories, copying as special files <1>: cp invocation.
20200                                                              (line 252)
20201* non-directory suffix, stripping:       dirname invocation.  (line   6)
20202* nonblock:                              dd invocation.       (line 275)
20203* nonblocking I/O:                       dd invocation.       (line 275)
20204* nonblocking stty setting:              Special.             (line  30)
20205* none backup method:                    Backup options.      (line  31)
20206* none color option:                     General output formatting.
20207                                                              (line  24)
20208* none dd status=:                       dd invocation.       (line  71)
20209* none hyperlink option:                 General output formatting.
20210                                                              (line  63)
20211* none, sorting option for ls:           Sorting the output.  (line  60)
20212* nonempty file check:                   File characteristic tests.
20213                                                              (line  12)
20214* nonprinting characters, ignoring:      sort invocation.     (line 143)
20215* nonzero-length string check:           String tests.        (line  19)
20216* noon in date strings:                  Time of day items.   (line  21)
20217* not-equal string check:                String tests.        (line  28)
20218* notrunc:                               dd invocation.       (line 182)
20219* now in date strings:                   Relative items in date strings.
20220                                                              (line  33)
20221* noxfer dd status=:                     dd invocation.       (line  75)
20222* NO_NEW_PRIVS:                          runcon invocation.   (line  22)
20223* nproc:                                 nproc invocation.    (line   6)
20224* NTFS file system:                      df invocation.       (line 219)
20225* ntfs file system file:                 df invocation.       (line 219)
20226* number of inputs to merge, nmerge:     sort invocation.     (line 262)
20227* numbered backup method:                Backup options.      (line  35)
20228* numbering lines:                       nl invocation.       (line   6)
20229* numbers, written-out:                  General date syntax. (line  22)
20230* numeric expressions:                   Numeric expressions. (line   6)
20231* numeric field padding:                 Padding and other flags.
20232                                                              (line   6)
20233* numeric modes:                         Numeric Modes.       (line   6)
20234* numeric operations:                    Numeric operations.  (line   6)
20235* numeric sequences:                     seq invocation.      (line   6)
20236* numeric sort:                          sort invocation.     (line 160)
20237* numeric tests:                         Numeric tests.       (line   6)
20238* numeric uid and gid:                   What information is listed.
20239                                                              (line 225)
20240* numeric user and group IDs:            What information is listed.
20241                                                              (line 225)
20242* numfmt:                                numfmt invocation.   (line   6)
20243* obs:                                   dd invocation.       (line  30)
20244* ocrnl:                                 Output.              (line  16)
20245* octal dump of files:                   od invocation.       (line   6)
20246* octal numbers for file modes:          Numeric Modes.       (line   6)
20247* od:                                    od invocation.       (line   6)
20248* odd parity:                            Control.             (line  13)
20249* oddp:                                  Combination.         (line  14)
20250* of:                                    dd invocation.       (line  21)
20251* ofdel:                                 Output.              (line  34)
20252* ofill:                                 Output.              (line  30)
20253* oflag:                                 dd invocation.       (line 200)
20254* olcuc:                                 Output.              (line  12)
20255* older-than file check:                 File characteristic tests.
20256                                                              (line  19)
20257* once interactive option:               rm invocation.       (line  57)
20258* one file system, restricting du to:    du invocation.       (line 263)
20259* one file system, restricting rm to:    rm invocation.       (line  65)
20260* one-line output format:                df invocation.       (line 148)
20261* onlcr:                                 Output.              (line  19)
20262* onlret:                                Output.              (line  27)
20263* onocr:                                 Output.              (line  23)
20264* operating on characters:               Operating on characters.
20265                                                              (line   6)
20266* operating on sorted files:             Operating on sorted files.
20267                                                              (line   6)
20268* operating system name:                 uname invocation.    (line  58)
20269* opost:                                 Output.              (line   9)
20270* option delimiter:                      Common options.      (line  43)
20271* options for date:                      Options for date.    (line   6)
20272* or operator:                           Connectives for test.
20273                                                              (line  33)
20274* or operator <1>:                       Relations for expr.  (line  11)
20275* ordinal numbers:                       General date syntax. (line  22)
20276* ospeed:                                Special.             (line  19)
20277* other permissions:                     Setting Permissions. (line  27)
20278* output block size:                     dd invocation.       (line  30)
20279* output file name prefix:               split invocation.    (line  15)
20280* output file name prefix <1>:           csplit invocation.   (line  63)
20281* output file name suffix:               csplit invocation.   (line  67)
20282* output format:                         stat invocation.     (line  49)
20283* output format <1>:                     stat invocation.     (line  58)
20284* output format, portable:               df invocation.       (line 148)
20285* output NUL-byte-terminated lines:      md5sum invocation.   (line 128)
20286* output NUL-byte-terminated lines <1>:  readlink invocation. (line  65)
20287* output NUL-byte-terminated lines <2>:  du invocation.       (line  26)
20288* output NUL-byte-terminated lines <3>:  basename invocation. (line  42)
20289* output NUL-byte-terminated lines <4>:  dirname invocation.  (line  31)
20290* output NUL-byte-terminated lines <5>:  realpath invocation. (line  71)
20291* output NUL-byte-terminated lines <6>:  printenv invocation. (line  19)
20292* output NUL-byte-terminated lines <7>:  env invocation.      (line  90)
20293* output of entire files:                Output of entire files.
20294                                                              (line   6)
20295* output of parts of files:              Output of parts of files.
20296                                                              (line   6)
20297* output settings:                       Output.              (line   6)
20298* output tabs:                           pr invocation.       (line 117)
20299* overwriting of input, allowed:         sort invocation.     (line 288)
20300* overwriting of input, allowed <1>:     shuf invocation.     (line  36)
20301* owned by effective group ID check:     Access permission tests.
20302                                                              (line  31)
20303* owned by effective user ID check:      Access permission tests.
20304                                                              (line  28)
20305* owner of file, permissions for:        Setting Permissions. (line  23)
20306* owner, default:                        Mode Structure.      (line  27)
20307* ownership of installed files, setting: install invocation.  (line  91)
20308* p for FIFO file:                       mknod invocation.    (line  28)
20309* pad character:                         Output.              (line  34)
20310* pad instead of timing for delaying:    Output.              (line  30)
20311* padding of numeric fields:             Padding and other flags.
20312                                                              (line   6)
20313* paragraphs, reformatting:              fmt invocation.      (line   6)
20314* parenb:                                Control.             (line   9)
20315* parent directories and cp:             cp invocation.       (line 239)
20316* parent directories, creating:          mkdir invocation.    (line  34)
20317* parent directories, creating missing:  install invocation.  (line  67)
20318* parent directories, removing:          rmdir invocation.    (line  22)
20319* parentheses for grouping:              expr invocation.     (line  31)
20320* parity:                                Combination.         (line  10)
20321* parity errors, marking:                Input.               (line  18)
20322* parity, ignoring:                      Input.               (line  15)
20323* parmrk:                                Input.               (line  18)
20324* parodd:                                Control.             (line  13)
20325* parse_datetime:                        Date input formats.  (line   6)
20326* parsing date strings:                  Options for date.    (line  11)
20327* parts of files, output of:             Output of parts of files.
20328                                                              (line   6)
20329* pass8:                                 Combination.         (line  55)
20330* paste:                                 paste invocation.    (line   6)
20331* Paterson, R.:                          Introduction.        (line  29)
20332* PATH:                                  env invocation.      (line  28)
20333* pathchk:                               pathchk invocation.  (line   6)
20334* pattern matching:                      String expressions.  (line  11)
20335* pebibyte, definition of:               Block size.          (line 104)
20336* permission tests:                      Access permission tests.
20337                                                              (line   6)
20338* permissions of installed files, setting: install invocation.
20339                                                              (line  79)
20340* permissions, changing access:          chmod invocation.    (line   6)
20341* permissions, copying existing:         Copying Permissions. (line   6)
20342* permissions, for changing file timestamps: touch invocation.
20343                                                              (line  21)
20344* permissions, output by ls:             What information is listed.
20345                                                              (line 182)
20346* petabyte, definition of:               Block size.          (line 101)
20347* phone directory order:                 sort invocation.     (line  87)
20348* pieces, splitting a file into:         split invocation.    (line   6)
20349* Pinard, F.:                            Introduction.        (line  29)
20350* Pinard, F. <1>:                        Authors of parse_datetime.
20351                                                              (line  19)
20352* pipe fitting:                          tee invocation.      (line   6)
20353* Plass, Michael F.:                     fmt invocation.      (line  19)
20354* platform, hardware:                    uname invocation.    (line  35)
20355* pm in date strings:                    Time of day items.   (line  21)
20356* portable file names, checking for:     pathchk invocation.  (line   6)
20357* portable output format:                df invocation.       (line 148)
20358* POSIX:                                 Introduction.        (line  11)
20359* POSIX output format:                   df invocation.       (line 148)
20360* POSIXLY_CORRECT:                       Common options.      (line  11)
20361* POSIXLY_CORRECT <1>:                   Standards conformance.
20362                                                              (line   6)
20363* POSIXLY_CORRECT <2>:                   pr invocation.       (line  85)
20364* POSIXLY_CORRECT <3>:                   sort invocation.     (line 299)
20365* POSIXLY_CORRECT <4>:                   sort invocation.     (line 416)
20366* POSIXLY_CORRECT <5>:                   dd invocation.       (line 406)
20367* POSIXLY_CORRECT <6>:                   echo invocation.     (line  65)
20368* POSIXLY_CORRECT <7>:                   printf invocation.   (line  53)
20369* POSIXLY_CORRECT <8>:                   id invocation.       (line  15)
20370* POSIXLY_CORRECT, and block size:       Block size.          (line  12)
20371* pr:                                    pr invocation.       (line   6)
20372* prime factors:                         factor invocation.   (line   6)
20373* print:                                 Character sets.      (line 102)
20374* print machine hardware name:           arch invocation.     (line   6)
20375* print name of current directory:       pwd invocation.      (line   6)
20376* print system information:              uname invocation.    (line   6)
20377* print terminal file name:              tty invocation.      (line   6)
20378* Print the number of processors:        nproc invocation.    (line   6)
20379* printenv:                              printenv invocation. (line   6)
20380* printf:                                printf invocation.   (line   6)
20381* printing all or some environment variables: printenv invocation.
20382                                                              (line   6)
20383* printing color database:               dircolors invocation.
20384                                                              (line  45)
20385* printing current user information:     who invocation.      (line   6)
20386* printing current usernames:            users invocation.    (line   6)
20387* printing groups a user is in:          groups invocation.   (line   6)
20388* printing real and effective user and group IDs: id invocation.
20389                                                              (line   6)
20390* printing text:                         echo invocation.     (line   6)
20391* printing text, commands for:           Printing text.       (line   6)
20392* printing the current time:             date invocation.     (line   6)
20393* printing the effective user ID:        whoami invocation.   (line   6)
20394* printing the host identifier:          hostid invocation.   (line   6)
20395* printing the hostname:                 hostname invocation. (line   6)
20396* printing the system uptime and load:   uptime invocation.   (line   6)
20397* printing user’s login name:            logname invocation.  (line   6)
20398* printing, preparing files for:         pr invocation.       (line   6)
20399* process zero-terminated items:         head invocation.     (line  55)
20400* process zero-terminated items <1>:     tail invocation.     (line 188)
20401* process zero-terminated items <2>:     sort invocation.     (line 384)
20402* process zero-terminated items <3>:     shuf invocation.     (line  55)
20403* process zero-terminated items <4>:     uniq invocation.     (line 139)
20404* process zero-terminated items <5>:     comm invocation.     (line  88)
20405* process zero-terminated items <6>:     cut invocation.      (line  94)
20406* process zero-terminated items <7>:     paste invocation.    (line  72)
20407* process zero-terminated items <8>:     General options in join.
20408                                                              (line  93)
20409* process zero-terminated items <9>:     numfmt invocation.   (line 115)
20410* processes, commands for controlling:   Process control.     (line   6)
20411* progress dd status=:                   dd invocation.       (line  79)
20412* prompting, and ln:                     ln invocation.       (line  98)
20413* prompting, and mv:                     mv invocation.       (line  37)
20414* prompting, and rm:                     rm invocation.       (line  11)
20415* prompts, forcing:                      mv invocation.       (line  70)
20416* prompts, omitting:                     mv invocation.       (line  64)
20417* prompts, omitting <1>:                 mv invocation.       (line  77)
20418* prterase:                              Local.               (line  46)
20419* ptx:                                   ptx invocation.      (line   6)
20420* punct:                                 Character sets.      (line 104)
20421* pure numbers in date strings:          Pure numbers in date strings.
20422                                                              (line   6)
20423* pwd:                                   pwd invocation.      (line   6)
20424* quit:                                  Characters.          (line  21)
20425* quoting style:                         Formatting the file names.
20426                                                              (line  34)
20427* radix for file offsets:                od invocation.       (line  36)
20428* random seed:                           Random sources.      (line  31)
20429* random sort:                           sort invocation.     (line 189)
20430* random source for shredding:           shred invocation.    (line 133)
20431* random source for shuffling:           shuf invocation.     (line  42)
20432* random source for sorting:             sort invocation.     (line 304)
20433* random sources:                        Random sources.      (line   6)
20434* ranges:                                Character sets.      (line  44)
20435* raw:                                   Combination.         (line  43)
20436* read errors, ignoring:                 dd invocation.       (line 185)
20437* read from stdin and write to stdout and files: tee invocation.
20438                                                              (line   6)
20439* read permission:                       Mode Structure.      (line  12)
20440* read permission, symbolic:             Setting Permissions. (line  52)
20441* read system call, and holes:           cp invocation.       (line 299)
20442* readable file check:                   Access permission tests.
20443                                                              (line  15)
20444* readlink:                              readlink invocation. (line   6)
20445* real user and group IDs, printing:     id invocation.       (line   6)
20446* realpath:                              realpath invocation. (line   6)
20447* realpath <1>:                          realpath invocation. (line   6)
20448* realpath <2>:                          realpath invocation. (line   6)
20449* realpath <3>:                          readlink invocation. (line   6)
20450* record separator character:            split invocation.    (line 148)
20451* recursive directory listing:           Which files are listed.
20452                                                              (line  90)
20453* recursively changing access permissions: chmod invocation.  (line  73)
20454* recursively changing file ownership:   chown invocation.    (line 150)
20455* recursively changing group ownership:  chgrp invocation.    (line  77)
20456* recursively copying directories:       cp invocation.       (line  96)
20457* recursively copying directories <1>:   cp invocation.       (line 252)
20458* redirection:                           Redirection.         (line   6)
20459* reference file:                        chcon invocation.    (line  30)
20460* reformatting paragraph text:           fmt invocation.      (line   6)
20461* regular expression matching:           String expressions.  (line  11)
20462* regular file check:                    File type tests.     (line  19)
20463* relations, numeric or string:          Relations for expr.  (line   6)
20464* relative items in date strings:        Relative items in date strings.
20465                                                              (line   6)
20466* release of kernel:                     uname invocation.    (line  62)
20467* relpath:                               realpath invocation. (line  49)
20468* remainder:                             Numeric expressions. (line  16)
20469* remote hostname:                       who invocation.      (line  11)
20470* removing characters:                   Squeezing and deleting.
20471                                                              (line   6)
20472* removing empty directories:            rmdir invocation.    (line   6)
20473* removing files after shredding:        shred invocation.    (line 144)
20474* removing files or directories:         rm invocation.       (line   6)
20475* removing files or directories (via the unlink syscall): unlink invocation.
20476                                                              (line   6)
20477* removing permissions:                  Setting Permissions. (line  38)
20478* repeat output values:                  shuf invocation.     (line  47)
20479* repeated characters:                   Character sets.      (line  66)
20480* repeated lines, outputting:            uniq invocation.     (line  63)
20481* repeated output of a string:           yes invocation.      (line   6)
20482* restricted deletion flag:              Mode Structure.      (line  52)
20483* restricted security context:           runcon invocation.   (line  22)
20484* return, ignoring:                      Input.               (line  31)
20485* return, translating to newline:        Input.               (line  34)
20486* return, translating to newline <1>:    Output.              (line  16)
20487* reverse sorting:                       sort invocation.     (line 183)
20488* reverse sorting <1>:                   Sorting the output.  (line  27)
20489* reversing files:                       tac invocation.      (line   6)
20490* rm:                                    rm invocation.       (line   6)
20491* rmdir:                                 rmdir invocation.    (line   6)
20492* rn format for nl:                      nl invocation.       (line  95)
20493* root as default owner:                 install invocation.  (line  91)
20494* root directory, allow recursive destruction: rm invocation. (line  88)
20495* root directory, allow recursive modification: chown invocation.
20496                                                              (line 131)
20497* root directory, allow recursive modification <1>: chgrp invocation.
20498                                                              (line  59)
20499* root directory, allow recursive modification <2>: chmod invocation.
20500                                                              (line  58)
20501* root directory, disallow recursive destruction: rm invocation.
20502                                                              (line  81)
20503* root directory, disallow recursive modification: chown invocation.
20504                                                              (line 126)
20505* root directory, disallow recursive modification <1>: chgrp invocation.
20506                                                              (line  54)
20507* root directory, disallow recursive modification <2>: chmod invocation.
20508                                                              (line  53)
20509* root directory, running a program in a specified: chroot invocation.
20510                                                              (line   6)
20511* rows:                                  Special.             (line  22)
20512* rprnt:                                 Characters.          (line  60)
20513* RTS/CTS flow control:                  Control.             (line  41)
20514* run commands with bounded time:        timeout invocation.  (line   6)
20515* run with security context:             runcon invocation.   (line   6)
20516* runcon:                                runcon invocation.   (line   6)
20517* running a program in a modified environment: env invocation.
20518                                                              (line   6)
20519* running a program in a specified root directory: chroot invocation.
20520                                                              (line   6)
20521* rz format for nl:                      nl invocation.       (line  97)
20522* Salz, Rich:                            Authors of parse_datetime.
20523                                                              (line   6)
20524* same file check:                       File characteristic tests.
20525                                                              (line  23)
20526* sane:                                  Combination.         (line  26)
20527* scheduling, affecting:                 nice invocation.     (line   6)
20528* screen columns:                        fold invocation.     (line  14)
20529* scripts arguments:                     env invocation.      (line 188)
20530* seconds since the epoch:               Time conversion specifiers.
20531                                                              (line  32)
20532* section delimiters of pages:           nl invocation.       (line  63)
20533* security context:                      What information is listed.
20534                                                              (line 259)
20535* security context <1>:                  cp invocation.       (line 384)
20536* security context <2>:                  install invocation.  (line  96)
20537* security context <3>:                  install invocation.  (line 139)
20538* security context <4>:                  mv invocation.       (line 117)
20539* security context <5>:                  mkdir invocation.    (line  56)
20540* security context <6>:                  mkfifo invocation.   (line  28)
20541* security context <7>:                  mknod invocation.    (line  53)
20542* security context <8>:                  id invocation.       (line  51)
20543* seek:                                  dd invocation.       (line  51)
20544* seek_bytes:                            dd invocation.       (line 325)
20545* self-backups:                          cp invocation.       (line  51)
20546* SELinux:                               What information is listed.
20547                                                              (line 259)
20548* SELinux <1>:                           install invocation.  (line  96)
20549* SELinux <2>:                           id invocation.       (line  51)
20550* SELinux context:                       SELinux context.     (line   6)
20551* SELinux, context:                      SELinux context.     (line   6)
20552* SELinux, restoring security context:   mv invocation.       (line 117)
20553* SELinux, setting/restoring security context: cp invocation. (line 384)
20554* SELinux, setting/restoring security context <1>: install invocation.
20555                                                              (line 139)
20556* SELinux, setting/restoring security context <2>: mkdir invocation.
20557                                                              (line  56)
20558* SELinux, setting/restoring security context <3>: mkfifo invocation.
20559                                                              (line  28)
20560* SELinux, setting/restoring security context <4>: mknod invocation.
20561                                                              (line  53)
20562* send a signal to processes:            kill invocation.     (line   6)
20563* sentences and line-breaking:           fmt invocation.      (line  19)
20564* separator for numbers in seq:          seq invocation.      (line  44)
20565* seq:                                   seq invocation.      (line   6)
20566* sequence of numbers:                   seq invocation.      (line   6)
20567* set-group-ID:                          Mode Structure.      (line  45)
20568* set-group-ID check:                    Access permission tests.
20569                                                              (line   9)
20570* set-user-ID:                           Mode Structure.      (line  39)
20571* set-user-ID check:                     Access permission tests.
20572                                                              (line  18)
20573* setgid:                                Mode Structure.      (line  45)
20574* setting permissions:                   Setting Permissions. (line  41)
20575* setting the hostname:                  hostname invocation. (line   6)
20576* setting the time:                      Setting the time.    (line   6)
20577* setuid:                                Mode Structure.      (line  39)
20578* setup for color:                       dircolors invocation.
20579                                                              (line   6)
20580* sh syntax for color setup:             dircolors invocation.
20581                                                              (line  34)
20582* SHA-1:                                 sha1sum invocation.  (line   6)
20583* SHA-2:                                 sha2 utilities.      (line   6)
20584* sha1sum:                               sha1sum invocation.  (line   6)
20585* sha224sum:                             sha2 utilities.      (line   6)
20586* sha256sum:                             sha2 utilities.      (line   6)
20587* sha384sum:                             sha2 utilities.      (line   6)
20588* sha512sum:                             sha2 utilities.      (line   6)
20589* shebang arguments:                     env invocation.      (line 188)
20590* SHELL environment variable, and color: General output formatting.
20591                                                              (line  31)
20592* SHELL environment variable, and color <1>: dircolors invocation.
20593                                                              (line  23)
20594* shell utilities:                       Top.                 (line  18)
20595* shred:                                 shred invocation.    (line   6)
20596* shuf:                                  shuf invocation.     (line   6)
20597* shuffling files:                       shuf invocation.     (line   6)
20598* SI output:                             Block size.          (line  42)
20599* SI output <1>:                         What information is listed.
20600                                                              (line 251)
20601* SI output <2>:                         df invocation.       (line 167)
20602* SI output <3>:                         du invocation.       (line 145)
20603* signals, specifying:                   Signal specifications.
20604                                                              (line   6)
20605* simple backup method:                  Backup options.      (line  44)
20606* SIMPLE_BACKUP_SUFFIX:                  Backup options.      (line  49)
20607* single quotes, and env -S:             env invocation.      (line 264)
20608* single-column output of files:         General output formatting.
20609                                                              (line  10)
20610* size:                                  Special.             (line  39)
20611* size for main memory sorting:          sort invocation.     (line 316)
20612* size of file to shred:                 shred invocation.    (line 138)
20613* size of files, reporting:              What information is listed.
20614                                                              (line 236)
20615* size of files, sorting files by:       Sorting the output.  (line  32)
20616* skip:                                  dd invocation.       (line  46)
20617* skip_bytes:                            dd invocation.       (line 319)
20618* sleep:                                 sleep invocation.    (line   6)
20619* socket check:                          File type tests.     (line  31)
20620* software flow control:                 Input.               (line  45)
20621* sort:                                  sort invocation.     (line   6)
20622* sort field:                            sort invocation.     (line 231)
20623* sort stability:                        sort invocation.     (line  12)
20624* sort stability <1>:                    sort invocation.     (line 309)
20625* sort’s last-resort comparison:         sort invocation.     (line  12)
20626* sort’s last-resort comparison <1>:     sort invocation.     (line 309)
20627* sorted files, operations on:           Operating on sorted files.
20628                                                              (line   6)
20629* sorting files:                         sort invocation.     (line   6)
20630* sorting ls output:                     Sorting the output.  (line   6)
20631* space:                                 Character sets.      (line 106)
20632* space parity:                          Control.             (line  16)
20633* sparse:                                dd invocation.       (line 146)
20634* sparse files, copying:                 cp invocation.       (line 299)
20635* sparse files, creating:                truncate invocation. (line  13)
20636* special characters:                    Characters.          (line   6)
20637* special file types:                    Special file types.  (line   6)
20638* special file types <1>:                Special file types.  (line   9)
20639* special files:                         mknod invocation.    (line  11)
20640* special settings:                      Special.             (line   6)
20641* specifying sets of characters:         Character sets.      (line   6)
20642* speed:                                 Special.             (line  49)
20643* split:                                 split invocation.    (line   6)
20644* splitting a file into pieces:          split invocation.    (line   6)
20645* splitting a file into pieces by context: csplit invocation. (line   6)
20646* squeezing blank lines:                 cat invocation.      (line  36)
20647* squeezing empty lines:                 cat invocation.      (line  36)
20648* squeezing repeat characters:           Squeezing and deleting.
20649                                                              (line   6)
20650* Stallman, R.:                          Introduction.        (line  29)
20651* standard input:                        Common options.      (line  47)
20652* standard output:                       Common options.      (line  47)
20653* standard streams, buffering:           stdbuf invocation.   (line   6)
20654* start:                                 Characters.          (line  48)
20655* stat:                                  stat invocation.     (line   6)
20656* status:                                dd invocation.       (line  66)
20657* status <1>:                            Characters.          (line  45)
20658* status time, printing or sorting by:   Sorting the output.  (line  13)
20659* status time, show the most recent:     du invocation.       (line 204)
20660* stdbuf:                                stdbuf invocation.   (line   6)
20661* stick parity:                          Control.             (line  16)
20662* sticky:                                Mode Structure.      (line  52)
20663* sticky bit check:                      Access permission tests.
20664                                                              (line  12)
20665* stop:                                  Characters.          (line  51)
20666* stop bits:                             Control.             (line  32)
20667* strftime and date:                     date invocation.     (line  20)
20668* string constants, outputting:          od invocation.       (line  81)
20669* string expressions:                    String expressions.  (line   6)
20670* string tests:                          String tests.        (line   6)
20671* strip directory and suffix from file names: basename invocation.
20672                                                              (line   6)
20673* stripping non-directory suffix:        dirname invocation.  (line   6)
20674* stripping symbol table information:    install invocation.  (line 113)
20675* stripping trailing slashes:            cp invocation.       (line 332)
20676* stripping trailing slashes <1>:        mv invocation.       (line  98)
20677* stty:                                  stty invocation.     (line   6)
20678* substr:                                String expressions.  (line  40)
20679* subtracting permissions:               Setting Permissions. (line  38)
20680* subtraction:                           Numeric expressions. (line  12)
20681* successful exit:                       true invocation.     (line   6)
20682* suffix, stripping from file names:     basename invocation. (line   6)
20683* sum:                                   sum invocation.      (line   6)
20684* summarizing files:                     Summarizing files.   (line   6)
20685* superblock, writing:                   sync invocation.     (line  11)
20686* supplementary groups, printing:        groups invocation.   (line   6)
20687* susp:                                  Characters.          (line  54)
20688* swab (byte-swapping):                  dd invocation.       (line 159)
20689* swap space, saving text image in:      Mode Structure.      (line  52)
20690* swtch:                                 Characters.          (line  42)
20691* symbol table information, stripping:   install invocation.  (line 113)
20692* symbol table information, stripping, program: install invocation.
20693                                                              (line 116)
20694* symbolic (soft) links, creating:       ln invocation.       (line   6)
20695* symbolic link check:                   File type tests.     (line  23)
20696* symbolic link to directory, controlling traversal of: Traversing symlinks.
20697                                                              (line   6)
20698* symbolic link to directory, never traverse: Traversing symlinks.
20699                                                              (line  26)
20700* symbolic link to directory, never traverse <1>: chown invocation.
20701                                                              (line 171)
20702* symbolic link to directory, never traverse <2>: chgrp invocation.
20703                                                              (line  99)
20704* symbolic link to directory, never traverse <3>: chcon invocation.
20705                                                              (line  56)
20706* symbolic link to directory, traverse each that is encountered: Traversing symlinks.
20707                                                              (line  22)
20708* symbolic link to directory, traverse each that is encountered <1>: chown invocation.
20709                                                              (line 158)
20710* symbolic link to directory, traverse each that is encountered <2>: chgrp invocation.
20711                                                              (line  86)
20712* symbolic link to directory, traverse each that is encountered <3>: chcon invocation.
20713                                                              (line  52)
20714* symbolic link to directory, traverse if on the command line: Traversing symlinks.
20715                                                              (line  18)
20716* symbolic link to directory, traverse if on the command line <1>: chown invocation.
20717                                                              (line 153)
20718* symbolic link to directory, traverse if on the command line <2>: chgrp invocation.
20719                                                              (line  81)
20720* symbolic link to directory, traverse if on the command line <3>: chcon invocation.
20721                                                              (line  47)
20722* symbolic link, defined:                ln invocation.       (line  42)
20723* symbolic links and ln:                 ln invocation.       (line 182)
20724* symbolic links and pwd:                pwd invocation.      (line  26)
20725* symbolic links, changing group:        chgrp invocation.    (line  46)
20726* symbolic links, changing owner:        chown invocation.    (line  83)
20727* symbolic links, changing owner <1>:    chown invocation.    (line 106)
20728* symbolic links, changing owner <2>:    chown invocation.    (line 118)
20729* symbolic links, changing owner <3>:    chgrp invocation.    (line  34)
20730* symbolic links, changing time:         touch invocation.    (line  70)
20731* symbolic links, copying:               cp invocation.       (line 109)
20732* symbolic links, copying <1>:           cp invocation.       (line 162)
20733* symbolic links, copying with:          cp invocation.       (line 337)
20734* symbolic links, dereferencing:         Which files are listed.
20735                                                              (line  36)
20736* symbolic links, dereferencing <1>:     Which files are listed.
20737                                                              (line  41)
20738* symbolic links, dereferencing <2>:     Which files are listed.
20739                                                              (line  83)
20740* symbolic links, dereferencing in du:   du invocation.       (line 117)
20741* symbolic links, dereferencing in du <1>: du invocation.     (line 133)
20742* symbolic links, dereferencing in stat: stat invocation.     (line  22)
20743* symbolic links, following:             dd invocation.       (line 289)
20744* symbolic links, permissions of:        chmod invocation.    (line  10)
20745* symbolic modes:                        Symbolic Modes.      (line   6)
20746* symlinks, resolution:                  realpath invocation. (line   6)
20747* sync:                                  sync invocation.     (line   6)
20748* sync <1>:                              dd invocation.       (line 243)
20749* sync (padding with ASCII NULs):        dd invocation.       (line 164)
20750* Synchronize cached writes to persistent storage: sync invocation.
20751                                                              (line   6)
20752* synchronize disk and memory:           sync invocation.     (line   6)
20753* synchronized data and metadata I/O:    dd invocation.       (line 243)
20754* synchronized data and metadata writes, before finishing: dd invocation.
20755                                                              (line 192)
20756* synchronized data reads:               dd invocation.       (line 235)
20757* synchronized data writes, before finishing: dd invocation.  (line 188)
20758* system context:                        System context.      (line   6)
20759* system information, printing:          arch invocation.     (line   6)
20760* system information, printing <1>:      nproc invocation.    (line   6)
20761* system information, printing <2>:      uname invocation.    (line   6)
20762* system name, printing:                 hostname invocation. (line   6)
20763* System V sum:                          sum invocation.      (line  31)
20764* tab stops, setting:                    expand invocation.   (line  22)
20765* tabN:                                  Output.              (line  51)
20766* tabs:                                  Combination.         (line  66)
20767* tabs to spaces, converting:            expand invocation.   (line   6)
20768* tac:                                   tac invocation.      (line   6)
20769* tagged paragraphs:                     fmt invocation.      (line  40)
20770* tail:                                  tail invocation.     (line   6)
20771* tandem:                                Input.               (line  45)
20772* target directory:                      Target directory.    (line   6)
20773* target directory <1>:                  Target directory.    (line  15)
20774* target directory <2>:                  Target directory.    (line  31)
20775* target directory <3>:                  cp invocation.       (line 350)
20776* target directory <4>:                  cp invocation.       (line 354)
20777* target directory <5>:                  install invocation.  (line 125)
20778* target directory <6>:                  install invocation.  (line 130)
20779* target directory <7>:                  mv invocation.       (line 108)
20780* target directory <8>:                  mv invocation.       (line 112)
20781* target directory <9>:                  ln invocation.       (line 171)
20782* target directory <10>:                 ln invocation.       (line 175)
20783* tebibyte, definition of:               Block size.          (line  99)
20784* tee:                                   tee invocation.      (line   6)
20785* telephone directory order:             sort invocation.     (line  87)
20786* temporary directory:                   sort invocation.     (line 353)
20787* temporary files and directories:       mktemp invocation.   (line   6)
20788* terabyte, definition of:               Block size.          (line  96)
20789* terminal check:                        File type tests.     (line  34)
20790* terminal file name, printing:          tty invocation.      (line   6)
20791* terminal lines, currently used:        who invocation.      (line  11)
20792* terminal settings:                     stty invocation.     (line   6)
20793* terminal, using color iff:             General output formatting.
20794                                                              (line  25)
20795* terminal, using hyperlink iff:         General output formatting.
20796                                                              (line  64)
20797* terse output:                          stat invocation.     (line  69)
20798* test:                                  test invocation.     (line   6)
20799* text:                                  dd invocation.       (line 299)
20800* text I/O:                              dd invocation.       (line 299)
20801* text image, saving in swap space:      Mode Structure.      (line  52)
20802* text input files:                      md5sum invocation.   (line 109)
20803* text utilities:                        Top.                 (line  18)
20804* text, displaying:                      echo invocation.     (line   6)
20805* text, reformatting:                    fmt invocation.      (line   6)
20806* this in date strings:                  Relative items in date strings.
20807                                                              (line  33)
20808* time:                                  touch invocation.    (line  56)
20809* time <1>:                              Special.             (line  11)
20810* time conversion specifiers:            Time conversion specifiers.
20811                                                              (line   6)
20812* time formats:                          pr invocation.       (line  78)
20813* time formats <1>:                      date invocation.     (line  20)
20814* time limit:                            timeout invocation.  (line   6)
20815* time of day item:                      Time of day items.   (line   6)
20816* time setting:                          Setting the time.    (line   6)
20817* time style:                            Formatting file timestamps.
20818                                                              (line  24)
20819* time style <1>:                        du invocation.       (line 214)
20820* time units:                            timeout invocation.  (line  56)
20821* time units <1>:                        sleep invocation.    (line  11)
20822* time zone correction:                  Time of day items.   (line  29)
20823* time zone item:                        General date syntax. (line  40)
20824* time zone item <1>:                    Time zone items.     (line   6)
20825* time, printing or setting:             date invocation.     (line   6)
20826* timeout:                               timeout invocation.  (line   6)
20827* timestamps of installed files, preserving: install invocation.
20828                                                              (line 103)
20829* timestamps, changing file:             touch invocation.    (line   6)
20830* TIME_STYLE:                            Formatting file timestamps.
20831                                                              (line 103)
20832* TIME_STYLE <1>:                        du invocation.       (line 242)
20833* TMPDIR:                                sort invocation.     (line  64)
20834* TMPDIR <1>:                            sort invocation.     (line 353)
20835* today in date strings:                 Relative items in date strings.
20836                                                              (line  33)
20837* tomorrow:                              Options for date.    (line  11)
20838* tomorrow in date strings:              Relative items in date strings.
20839                                                              (line  29)
20840* topological sort:                      tsort invocation.    (line   6)
20841* tostop:                                Local.               (line  41)
20842* total counts:                          wc invocation.       (line  12)
20843* touch:                                 touch invocation.    (line   6)
20844* tr:                                    tr invocation.       (line   6)
20845* trailing slashes:                      Trailing slashes.    (line   6)
20846* translating characters:                Translating.         (line   6)
20847* true:                                  true invocation.     (line   6)
20848* truncate:                              truncate invocation. (line   6)
20849* truncating output file, avoiding:      dd invocation.       (line 182)
20850* truncating, file sizes:                truncate invocation. (line   6)
20851* tsort:                                 tsort invocation.    (line   6)
20852* tty:                                   tty invocation.      (line   6)
20853* two-way parity:                        Control.             (line   9)
20854* type size:                             od invocation.       (line 122)
20855* TZ:                                    pr invocation.       (line  91)
20856* TZ <1>:                                Formatting file timestamps.
20857                                                              (line  17)
20858* TZ <2>:                                touch invocation.    (line  35)
20859* TZ <3>:                                stat invocation.     (line 212)
20860* TZ <4>:                                who invocation.      (line  26)
20861* TZ <5>:                                date invocation.     (line  16)
20862* TZ <6>:                                Options for date.    (line 119)
20863* TZ <7>:                                Specifying time zone rules.
20864                                                              (line   6)
20865* u, and disabling special characters:   Characters.          (line  12)
20866* ucase, converting to:                  dd invocation.       (line 141)
20867* umask and modes:                       Umask and Protection.
20868                                                              (line   6)
20869* uname:                                 uname invocation.    (line   6)
20870* unblock:                               dd invocation.       (line 132)
20871* unexpand:                              unexpand invocation. (line   6)
20872* Unicode:                               printf invocation.   (line  74)
20873* uniq:                                  uniq invocation.     (line   6)
20874* unique lines, outputting:              uniq invocation.     (line 127)
20875* uniquify files:                        uniq invocation.     (line   6)
20876* uniquifying output:                    sort invocation.     (line 369)
20877* Universal Time:                        Options for date.    (line 119)
20878* unlink:                                unlink invocation.   (line   6)
20879* unprintable characters, ignoring:      sort invocation.     (line 143)
20880* unsorted directory listing:            Sorting the output.  (line  20)
20881* upper:                                 Character sets.      (line 108)
20882* uppercase, translating to lowercase:   Input.               (line  50)
20883* uptime:                                uptime invocation.   (line   6)
20884* use time, changing:                    touch invocation.    (line  48)
20885* use time, printing or sorting files by: Sorting the output. (line  13)
20886* use time, printing or sorting files by <1>: Sorting the output.
20887                                                              (line  44)
20888* use time, show the most recent:        du invocation.       (line 204)
20889* user IDs, disambiguating:              Disambiguating names and IDs.
20890                                                              (line   6)
20891* user information, commands for:        User information.    (line   6)
20892* user name, printing:                   logname invocation.  (line   6)
20893* user names, disambiguating:            Disambiguating names and IDs.
20894                                                              (line   6)
20895* usernames, printing current:           users invocation.    (line   6)
20896* users:                                 users invocation.    (line   6)
20897* UTC:                                   Options for date.    (line 119)
20898* utmp:                                  logname invocation.  (line   6)
20899* utmp <1>:                              users invocation.    (line  14)
20900* utmp <2>:                              who invocation.      (line  15)
20901* valid file names, checking for:        pathchk invocation.  (line   6)
20902* variable-length records, converting to fixed-length: dd invocation.
20903                                                              (line  41)
20904* vdir:                                  vdir invocation.     (line   6)
20905* verbose ls format:                     What information is listed.
20906                                                              (line 131)
20907* verifying MD5 checksums:               md5sum invocation.   (line  76)
20908* verifying MD5 checksums <1>:           md5sum invocation.   (line  82)
20909* verifying MD5 checksums <2>:           md5sum invocation.   (line  90)
20910* verifying MD5 checksums <3>:           md5sum invocation.   (line 118)
20911* verifying MD5 checksums <4>:           md5sum invocation.   (line 123)
20912* version number sort:                   sort invocation.     (line 177)
20913* version number, finding:               Common options.      (line  40)
20914* version of kernel:                     uname invocation.    (line  77)
20915* version, sorting option for ls:        Sorting the output.  (line  67)
20916* version-control Emacs variable:        Backup options.      (line  24)
20917* VERSION_CONTROL:                       Backup options.      (line  13)
20918* VERSION_CONTROL <1>:                   cp invocation.       (line  79)
20919* VERSION_CONTROL <2>:                   install invocation.  (line  41)
20920* VERSION_CONTROL <3>:                   mv invocation.       (line  59)
20921* VERSION_CONTROL <4>:                   ln invocation.       (line  82)
20922* vertical sorted files in columns:      General output formatting.
20923                                                              (line  16)
20924* vtN:                                   Output.              (line  59)
20925* wc:                                    wc invocation.       (line   6)
20926* week in date strings:                  Relative items in date strings.
20927                                                              (line  15)
20928* werase:                                Characters.          (line  63)
20929* who:                                   who invocation.      (line   6)
20930* who am i:                              who invocation.      (line  21)
20931* whoami:                                whoami invocation.   (line   6)
20932* word count:                            wc invocation.       (line   6)
20933* working context:                       Working context.     (line   6)
20934* working directory, printing:           pwd invocation.      (line   6)
20935* wrap data:                             base64 invocation.   (line  22)
20936* wrapping long input lines:             fold invocation.     (line   6)
20937* writable file check:                   Access permission tests.
20938                                                              (line  21)
20939* write permission:                      Mode Structure.      (line  14)
20940* write permission, symbolic:            Setting Permissions. (line  54)
20941* write, allowed:                        who invocation.      (line  94)
20942* wtmp:                                  users invocation.    (line  14)
20943* wtmp <1>:                              who invocation.      (line  15)
20944* xcase:                                 Local.               (line  36)
20945* xdigit:                                Character sets.      (line 110)
20946* xfs file system type:                  df invocation.       (line 211)
20947* XON/XOFF flow control:                 Input.               (line  40)
20948* year in date strings:                  Relative items in date strings.
20949                                                              (line  15)
20950* yes:                                   yes invocation.      (line   6)
20951* yesterday:                             Options for date.    (line  11)
20952* yesterday in date strings:             Relative items in date strings.
20953                                                              (line  29)
20954* yottabyte, definition of:              Block size.          (line 116)
20955* Youmans, B.:                           Introduction.        (line  29)
20956* zero-length string check:              String tests.        (line  15)
20957* zettabyte, definition of:              Block size.          (line 111)
20958
20959
20960
20961Tag Table:
20962Node: Top8619
20963Node: Introduction23195
20964Node: Common options25080
20965Node: Exit status28517
20966Node: Backup options29337
20967Node: Block size31383
20968Node: Floating point36720
20969Node: Signal specifications38579
20970Node: Disambiguating names and IDs40749
20971Ref: Disambiguating names and IDs-Footnote-142366
20972Node: Random sources42436
20973Node: Target directory44445
20974Node: Trailing slashes48095
20975Node: Traversing symlinks49134
20976Node: Treating / specially50266
20977Node: Special built-in utilities51900
20978Node: Standards conformance53099
20979Node: Multi-call invocation54845
20980Node: Output of entire files55407
20981Node: cat invocation56144
20982Node: tac invocation58086
20983Node: nl invocation59519
20984Node: od invocation63586
20985Node: base32 invocation71408
20986Node: base64 invocation71935
20987Node: basenc invocation73434
20988Node: Formatting file contents77101
20989Node: fmt invocation77552
20990Node: pr invocation80546
20991Node: fold invocation92822
20992Node: Output of parts of files94337
20993Node: head invocation94834
20994Node: tail invocation97762
20995Node: split invocation108802
20996Node: csplit invocation117034
20997Node: Summarizing files122472
20998Node: wc invocation123183
20999Node: sum invocation126510
21000Node: cksum invocation127976
21001Node: b2sum invocation129155
21002Node: md5sum invocation129856
21003Node: sha1sum invocation136665
21004Node: sha2 utilities137730
21005Node: Operating on sorted files138261
21006Node: sort invocation138848
21007Ref: sort invocation-Footnote-1164709
21008Node: shuf invocation165319
21009Node: uniq invocation168520
21010Node: comm invocation174581
21011Node: ptx invocation178609
21012Node: General options in ptx181443
21013Node: Charset selection in ptx182043
21014Node: Input processing in ptx182956
21015Node: Output formatting in ptx188501
21016Node: Compatibility in ptx195337
21017Node: tsort invocation198720
21018Node: tsort background201924
21019Node: Operating on fields203632
21020Node: cut invocation203994
21021Node: paste invocation208774
21022Node: join invocation210937
21023Node: General options in join212401
21024Node: Sorting files for join217593
21025Node: Working with fields219303
21026Ref: Working with fields-Footnote-1220886
21027Node: Paired and unpaired lines220983
21028Node: Header lines223921
21029Node: Set operations224832
21030Node: Operating on characters226352
21031Node: tr invocation226775
21032Node: Character sets228531
21033Node: Translating233279
21034Node: Squeezing and deleting235450
21035Node: expand invocation238720
21036Node: unexpand invocation240888
21037Node: Directory listing243409
21038Node: ls invocation243907
21039Ref: ls invocation-Footnote-1246011
21040Node: Which files are listed246255
21041Node: What information is listed250265
21042Node: Sorting the output260146
21043Node: General output formatting263055
21044Node: Formatting file timestamps269118
21045Node: Formatting the file names274724
21046Node: dir invocation278083
21047Node: vdir invocation278510
21048Node: dircolors invocation278935
21049Node: Basic operations280741
21050Node: cp invocation281361
21051Node: dd invocation299714
21052Node: install invocation317254
21053Node: mv invocation323602
21054Node: rm invocation328884
21055Node: shred invocation333770
21056Node: Special file types344128
21057Node: link invocation345657
21058Node: ln invocation346914
21059Node: mkdir invocation355949
21060Node: mkfifo invocation358723
21061Node: mknod invocation360198
21062Node: readlink invocation362740
21063Node: rmdir invocation365299
21064Node: unlink invocation366616
21065Node: Changing file attributes367610
21066Node: chown invocation368430
21067Node: chgrp invocation375824
21068Node: chmod invocation380066
21069Node: touch invocation383584
21070Node: Disk usage389299
21071Node: df invocation389980
21072Node: du invocation399817
21073Node: stat invocation411007
21074Node: sync invocation420219
21075Node: truncate invocation422390
21076Node: Printing text424424
21077Node: echo invocation424798
21078Node: printf invocation427566
21079Node: yes invocation433608
21080Node: Conditions434260
21081Node: false invocation434855
21082Node: true invocation435944
21083Node: test invocation437277
21084Node: File type tests439414
21085Node: Access permission tests440333
21086Node: File characteristic tests441253
21087Node: String tests442144
21088Node: Numeric tests442914
21089Node: Connectives for test443749
21090Node: expr invocation445003
21091Node: String expressions447515
21092Node: Numeric expressions450220
21093Node: Relations for expr450928
21094Node: Examples of expr452157
21095Node: Redirection452906
21096Node: tee invocation453371
21097Node: File name manipulation459955
21098Node: basename invocation460530
21099Node: dirname invocation462749
21100Node: pathchk invocation464566
21101Node: mktemp invocation466377
21102Node: realpath invocation472195
21103Node: Realpath usage examples475258
21104Node: Working context477073
21105Node: pwd invocation477717
21106Node: stty invocation479136
21107Node: Control482121
21108Node: Input483197
21109Node: Output484951
21110Node: Local486369
21111Node: Combination488456
21112Node: Characters490868
21113Node: Special492695
21114Node: printenv invocation494944
21115Node: tty invocation495955
21116Node: User information496689
21117Node: id invocation497324
21118Node: logname invocation500037
21119Node: whoami invocation500694
21120Node: groups invocation501201
21121Node: users invocation502436
21122Node: who invocation503616
21123Node: System context506951
21124Node: date invocation507616
21125Node: Time conversion specifiers509390
21126Node: Date conversion specifiers512129
21127Node: Literal conversion specifiers515594
21128Node: Padding and other flags515966
21129Node: Setting the time519029
21130Node: Options for date520180
21131Node: Examples of date525089
21132Ref: %s-examples526591
21133Node: arch invocation529812
21134Node: nproc invocation530371
21135Node: uname invocation531591
21136Node: hostname invocation534304
21137Node: hostid invocation535134
21138Node: uptime invocation536007
21139Node: SELinux context537487
21140Node: chcon invocation537862
21141Node: runcon invocation540267
21142Node: Modified command invocation542042
21143Node: chroot invocation542734
21144Ref: chroot invocation-Footnote-1546628
21145Node: env invocation547145
21146Node: nice invocation563675
21147Node: nohup invocation567808
21148Node: stdbuf invocation570310
21149Node: timeout invocation573244
21150Node: Process control576188
21151Node: kill invocation576411
21152Node: Delaying579605
21153Node: sleep invocation579802
21154Node: Numeric operations581158
21155Node: factor invocation581543
21156Node: numfmt invocation583347
21157Node: seq invocation595100
21158Node: File permissions599375
21159Node: Mode Structure600068
21160Node: Symbolic Modes603747
21161Node: Setting Permissions604865
21162Node: Copying Permissions607531
21163Node: Changing Special Mode Bits608401
21164Node: Conditional Executability610283
21165Node: Multiple Changes610835
21166Node: Umask and Protection612508
21167Node: Numeric Modes613653
21168Node: Operator Numeric Modes615999
21169Node: Directory Setuid and Setgid617059
21170Node: File timestamps619914
21171Node: Date input formats623237
21172Node: General date syntax625671
21173Node: Calendar date items628802
21174Node: Time of day items630879
21175Node: Time zone items633183
21176Node: Combined date and time of day items634587
21177Node: Day of week items635458
21178Node: Relative items in date strings636542
21179Node: Pure numbers in date strings639452
21180Node: Seconds since the Epoch640441
21181Node: Specifying time zone rules642104
21182Node: Authors of parse_datetime644576
21183Ref: Authors of get_date644767
21184Node: Version sort ordering645766
21185Node: Version sort overview646079
21186Node: Using version sort in GNU coreutils647204
21187Node: Origin of version sort and differences from natural sort648646
21188Node: Correct/Incorrect ordering and Expected/Unexpected results649636
21189Node: Implementation Details650547
21190Node: Version-sort ordering rules651407
21191Node: Version sort is not the same as numeric sort654137
21192Node: Punctuation Characters656202
21193Node: Punctuation Characters vs letters657986
21194Node: Tilde ~ character658958
21195Node: Version sort ignores locale660398
21196Node: Differences from the official Debian Algorithm661642
21197Node: Minus/Hyphen and Colon characters662229
21198Node: Additional hard-coded priorities in GNU coreutils' version sort663851
21199Node: Special handling of file extensions665185
21200Node: Advanced Topics669842
21201Node: Comparing two strings using Debian's algorithm670188
21202Node: Reporting bugs or incorrect results672090
21203Node: Other version/natural sort implementations673370
21204Node: Related Source code675517
21205Node: Opening the software toolbox676270
21206Node: Toolbox introduction677068
21207Node: I/O redirection679812
21208Node: The who command682697
21209Node: The cut command683622
21210Node: The sort command684724
21211Node: The uniq command685442
21212Node: Putting the tools together686157
21213Ref: Putting the tools together-Footnote-1698294
21214Node: GNU Free Documentation License698368
21215Node: Concept index723747
21216
21217End Tag Table
21218
21219
21220Local Variables:
21221coding: utf-8
21222End:
21223