Short Contents ************** GNU Coreutils 1 Introduction 2 Common options 3 Output of entire files 4 Formatting file contents 5 Output of parts of files 6 Summarizing files 7 Operating on sorted files 8 Operating on fields 9 Operating on characters 10 Directory listing 11 Basic operations 12 Special file types 13 Changing file attributes 14 Disk usage 15 Printing text 16 Conditions 17 Redirection 18 File name manipulation 19 Working context 20 User information 21 System context 22 SELinux context 23 Modified command invocation 24 Process control 25 Delaying 26 Numeric operations 27 File permissions 28 Date input formats 29 Opening the Software Toolbox Appendix A GNU Free Documentation License Index Table of Contents ***************** GNU Coreutils 1 Introduction 2 Common options 2.1 Exit status 2.2 Backup options 2.3 Block size 2.4 Floating point numbers 2.5 Signal specifications 2.6 chown and chgrp: Disambiguating user names and IDs 2.7 Sources of random data 2.8 Target directory 2.9 Trailing slashes 2.10 Traversing symlinks 2.11 Treating `/' specially 2.12 Special built-in utilities 2.13 Standards conformance 3 Output of entire files 3.1 `cat': Concatenate and write files 3.2 `tac': Concatenate and write files in reverse 3.3 `nl': Number lines and write files 3.4 `od': Write files in octal or other formats 3.5 `base64': Transform data into printable data 4 Formatting file contents 4.1 `fmt': Reformat paragraph text 4.2 `numfmt': Reformat numbers 4.2.1 General options 4.2.2 Possible UNITs: 4.2.3 Examples of using `numfmt' 4.3 `pr': Paginate or columnate files for printing 4.4 `fold': Wrap input lines to fit in specified width 5 Output of parts of files 5.1 `head': Output the first part of files 5.2 `tail': Output the last part of files 5.3 `split': Split a file into pieces. 5.4 `csplit': Split a file into context-determined pieces 6 Summarizing files 6.1 `wc': Print newline, word, and byte counts 6.2 `sum': Print checksum and block counts 6.3 `cksum': Print CRC checksum and byte counts 6.4 `md5sum': Print or check MD5 digests 6.5 `sha1sum': Print or check SHA-1 digests 6.6 sha2 utilities: Print or check SHA-2 digests 7 Operating on sorted files 7.1 `sort': Sort text files 7.2 `shuf': Shuffling text 7.3 `uniq': Uniquify files 7.4 `comm': Compare two sorted files line by line 7.5 `ptx': Produce permuted indexes 7.5.1 General options 7.5.2 Charset selection 7.5.3 Word selection and input processing 7.5.4 Output formatting 7.5.5 The GNU extensions to `ptx' 7.6 `tsort': Topological sort 7.6.1 `tsort': Background 8 Operating on fields 8.1 `cut': Print selected parts of lines 8.2 `paste': Merge lines of files 8.3 `join': Join lines on a common field 9 Operating on characters 9.1 `tr': Translate, squeeze, and/or delete characters 9.1.1 Specifying sets of characters 9.1.2 Translating 9.1.3 Squeezing repeats and deleting 9.2 `expand': Convert tabs to spaces 9.3 `unexpand': Convert spaces to tabs 10 Directory listing 10.1 `ls': List directory contents 10.1.1 Which files are listed 10.1.2 What information is listed 10.1.3 Sorting the output 10.1.4 Details about version sort 10.1.5 General output formatting 10.1.6 Formatting file timestamps 10.1.7 Formatting the file names 10.2 `dir': Briefly list directory contents 10.3 `vdir': Verbosely list directory contents 10.4 `dircolors': Color setup for `ls' 11 Basic operations 11.1 `cp': Copy files and directories 11.2 `dd': Convert and copy a file 11.3 `install': Copy files and set attributes 11.4 `mv': Move (rename) files 11.5 `rm': Remove files or directories 11.6 `shred': Remove files more securely 12 Special file types 12.1 `link': Make a hard link via the link syscall 12.2 `ln': Make links between files 12.3 `mkdir': Make directories 12.4 `mkfifo': Make FIFOs (named pipes) 12.5 `mknod': Make block or character special files 12.6 `readlink': Print value of a symlink or canonical file name 12.7 `rmdir': Remove empty directories 12.8 `unlink': Remove files via the unlink syscall 13 Changing file attributes 13.1 `chown': Change file owner and group 13.2 `chgrp': Change group ownership 13.3 `chmod': Change access permissions 13.4 `touch': Change file timestamps 14 Disk usage 14.1 `df': Report file system disk space usage 14.2 `du': Estimate file space usage 14.3 `stat': Report file or file system status 14.4 `sync': Synchronize data on disk with memory 14.5 `truncate': Shrink or extend the size of a file 15 Printing text 15.1 `echo': Print a line of text 15.2 `printf': Format and print data 15.3 `yes': Print a string until interrupted 16 Conditions 16.1 `false': Do nothing, unsuccessfully 16.2 `true': Do nothing, successfully 16.3 `test': Check file types and compare values 16.3.1 File type tests 16.3.2 Access permission tests 16.3.3 File characteristic tests 16.3.4 String tests 16.3.5 Numeric tests 16.3.6 Connectives for `test' 16.4 `expr': Evaluate expressions 16.4.1 String expressions 16.4.2 Numeric expressions 16.4.3 Relations for `expr' 16.4.4 Examples of using `expr' 17 Redirection 17.1 `tee': Redirect output to multiple files or processes 18 File name manipulation 18.1 `basename': Strip directory and suffix from a file name 18.2 `dirname': Strip last file name component 18.3 `pathchk': Check file name validity and portability 18.4 `mktemp': Create temporary file or directory 18.5 `realpath': Print the resolved file name. 19 Working context 19.1 `pwd': Print working directory 19.2 `stty': Print or change terminal characteristics 19.2.1 Control settings 19.2.2 Input settings 19.2.3 Output settings 19.2.4 Local settings 19.2.5 Combination settings 19.2.6 Special characters 19.2.7 Special settings 19.3 `printenv': Print all or some environment variables 19.4 `tty': Print file name of terminal on standard input 20 User information 20.1 `id': Print user identity 20.2 `logname': Print current login name 20.3 `whoami': Print effective user ID 20.4 `groups': Print group names a user is in 20.5 `users': Print login names of users currently logged in 20.6 `who': Print who is currently logged in 21 System context 21.1 `date': Print or set system date and time 21.1.1 Time conversion specifiers 21.1.2 Date conversion specifiers 21.1.3 Literal conversion specifiers 21.1.4 Padding and other flags 21.1.5 Setting the time 21.1.6 Options for `date' 21.1.7 Examples of `date' 21.2 `arch': Print machine hardware name 21.3 `nproc': Print the number of available processors 21.4 `uname': Print system information 21.5 `hostname': Print or set system name 21.6 `hostid': Print numeric host identifier 21.7 `uptime': Print system uptime and load 22 SELinux context 22.1 `chcon': Change SELinux context of file 22.2 `runcon': Run a command in specified SELinux context 23 Modified command invocation 23.1 `chroot': Run a command with a different root directory 23.2 `env': Run a command in a modified environment 23.3 `nice': Run a command with modified niceness 23.4 `nohup': Run a command immune to hangups 23.5 `stdbuf': Run a command with modified I/O stream buffering 23.6 `timeout': Run a command with a time limit 24 Process control 24.1 `kill': Send a signal to processes 25 Delaying 25.1 `sleep': Delay for a specified time 26 Numeric operations 26.1 `factor': Print prime factors 26.2 `seq': Print numeric sequences 27 File permissions 27.1 Structure of File Mode Bits 27.2 Symbolic Modes 27.2.1 Setting Permissions 27.2.2 Copying Existing Permissions 27.2.3 Changing Special Mode Bits 27.2.4 Conditional Executability 27.2.5 Making Multiple Changes 27.2.6 The Umask and Protection 27.3 Numeric Modes 27.4 Operator Numeric Modes 27.5 Directories and the Set-User-ID and Set-Group-ID Bits 28 Date input formats 28.1 General date syntax 28.2 Calendar date items 28.3 Time of day items 28.4 Time zone items 28.5 Combined date and time of day items 28.6 Day of week items 28.7 Relative items in date strings 28.8 Pure numbers in date strings 28.9 Seconds since the Epoch 28.10 Specifying time zone rules 28.11 Authors of `parse_datetime' 29 Opening the Software Toolbox Toolbox Introduction I/O Redirection The `who' Command The `cut' Command The `sort' Command The `uniq' Command Putting the Tools Together Appendix A GNU Free Documentation License Index GNU Coreutils ************* This manual documents version 8.21 of the GNU core utilities, including the standard programs for text and file manipulation. Copyright (C) 1994-2013 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". 1 Introduction ************** This manual is a work in progress: many sections make no attempt to explain basic concepts in a way suitable for novices. Thus, if you are interested, please get involved in improving this manual. The entire GNU community will benefit. The GNU utilities documented here are mostly compatible with the POSIX standard. Please report bugs to . Remember to include the version number, machine architecture, input files, and any other information needed to reproduce the bug: your input, what you expected, what you got, and why it is wrong. Diffs are welcome, but please include a description of the problem as well, since this is sometimes difficult to infer. *Note Bugs: (gcc)Bugs. This manual was originally derived from the Unix man pages in the distributions, which were written by David MacKenzie and updated by Jim Meyering. What you are reading now is the authoritative documentation for these utilities; the man pages are no longer being maintained. The original `fmt' man page was written by Ross Paterson. Franc,ois Pinard did the initial conversion to Texinfo format. Karl Berry did the indexing, some reorganization, and editing of the results. Brian Youmans of the Free Software Foundation office staff combined the manuals for textutils, fileutils, and sh-utils to produce the present omnibus manual. Richard Stallman contributed his usual invaluable insights to the overall process. 2 Common options **************** Certain options are available in all of these programs. Rather than writing identical descriptions for each of the programs, they are described here. (In fact, every GNU program accepts (or should accept) these options.) Normally options and operands can appear in any order, and programs act as if all the options appear before any operands. For example, `sort -r passwd -t :' acts like `sort -r -t : passwd', since `:' is an option-argument of `-t'. However, if the `POSIXLY_CORRECT' environment variable is set, options must appear before operands, unless otherwise specified for a particular command. A few programs can usefully have trailing operands with leading `-'. With such a program, options must precede operands even if `POSIXLY_CORRECT' is not set, and this fact is noted in the program description. For example, the `env' command's options must appear before its operands, since in some cases the operands specify a command that itself contains options. Most programs that accept long options recognize unambiguous abbreviations of those options. For example, `rmdir --ignore-fail-on-non-empty' can be invoked as `rmdir --ignore-fail' or even `rmdir --i'. Ambiguous options, such as `ls --h', are identified as such. Some of these programs recognize the `--help' and `--version' options only when one of them is the sole command line argument. For these programs, abbreviations of the long options are not always recognized. `--help' Print a usage message listing all available options, then exit successfully. `--version' Print the version number, then exit successfully. `--' Delimit the option list. Later arguments, if any, are treated as operands even if they begin with `-'. For example, `sort -- -r' reads from the file named `-r'. A single `-' operand is not really an option, though it looks like one. It stands for standard input, or for standard output if that is clear from the context. For example, `sort -' reads from standard input, and is equivalent to plain `sort', and `tee -' writes an extra copy of its input to standard output. Unless otherwise specified, `-' can appear as any operand that requires a file name. 2.1 Exit status =============== Nearly every command invocation yields an integral "exit status" that can be used to change how other commands work. For the vast majority of commands, an exit status of zero indicates success. Failure is indicated by a nonzero value--typically `1', though it may differ on unusual platforms as POSIX requires only that it be nonzero. However, some of the programs documented here do produce other exit status values and a few associate different meanings with the values `0' and `1'. Here are some of the exceptions: `chroot', `env', `expr', `nice', `nohup', `numfmt', `printenv', `sort', `stdbuf', `test', `timeout', `tty'. 2.2 Backup options ================== Some GNU programs (at least `cp', `install', `ln', and `mv') optionally make backups of files before writing new versions. These options control the details of these backups. The options are also briefly mentioned in the descriptions of the particular programs. `-b' `--backup[=METHOD]' Make a backup of each file that would otherwise be overwritten or removed. Without this option, the original versions are destroyed. Use METHOD to determine the type of backups to make. When this option is used but METHOD is not specified, then the value of the `VERSION_CONTROL' environment variable is used. And if `VERSION_CONTROL' is not set, the default backup type is `existing'. Note that the short form of this option, `-b' does not accept any argument. Using `-b' is equivalent to using `--backup=existing'. This option corresponds to the Emacs variable `version-control'; the values for METHOD are the same as those used in Emacs. This option also accepts more descriptive names. The valid METHODs are (unique abbreviations are accepted): `none' `off' Never make backups. `numbered' `t' Always make numbered backups. `existing' `nil' Make numbered backups of files that already have them, simple backups of the others. `simple' `never' Always make simple backups. Please note `never' is not to be confused with `none'. `-S SUFFIX' `--suffix=SUFFIX' Append SUFFIX to each backup file made with `-b'. If this option is not specified, the value of the `SIMPLE_BACKUP_SUFFIX' environment variable is used. And if `SIMPLE_BACKUP_SUFFIX' is not set, the default is `~', just as in Emacs. 2.3 Block size ============== Some GNU programs (at least `df', `du', and `ls') display sizes in "blocks". You can adjust the block size and method of display to make sizes easier to read. The block size used for display is independent of any file system block size. Fractional block counts are rounded up to the nearest integer. The default block size is chosen by examining the following environment variables in turn; the first one that is set determines the block size. `DF_BLOCK_SIZE' This specifies the default block size for the `df' command. Similarly, `DU_BLOCK_SIZE' specifies the default for `du' and `LS_BLOCK_SIZE' for `ls'. `BLOCK_SIZE' This specifies the default block size for all three commands, if the above command-specific environment variables are not set. `BLOCKSIZE' This specifies the default block size for all values that are normally printed as blocks, if neither `BLOCK_SIZE' nor the above command-specific environment variables are set. Unlike the other environment variables, `BLOCKSIZE' does not affect values that are normally printed as byte counts, e.g., the file sizes contained in `ls -l' output. `POSIXLY_CORRECT' If neither `COMMAND_BLOCK_SIZE', nor `BLOCK_SIZE', nor `BLOCKSIZE' is set, but this variable is set, the block size defaults to 512. If none of the above environment variables are set, the block size currently defaults to 1024 bytes in most contexts, but this number may change in the future. For `ls' file sizes, the block size defaults to 1 byte. A block size specification can be a positive integer specifying the number of bytes per block, or it can be `human-readable' or `si' to select a human-readable format. Integers may be followed by suffixes that are upward compatible with the SI prefixes (http://www.bipm.org/en/si/si_brochure/chapter3/prefixes.html) for decimal multiples and with the ISO/IEC 80000-13 (formerly IEC 60027-2) prefixes (http://physics.nist.gov/cuu/Units/binary.html) for binary multiples. With human-readable formats, output sizes are followed by a size letter such as `M' for megabytes. `BLOCK_SIZE=human-readable' uses powers of 1024; `M' stands for 1,048,576 bytes. `BLOCK_SIZE=si' is similar, but uses powers of 1000 and appends `B'; `MB' stands for 1,000,000 bytes. A block size specification preceded by `'' causes output sizes to be displayed with thousands separators. The `LC_NUMERIC' locale specifies the thousands separator and grouping. For example, in an American English locale, `--block-size="'1kB"' would cause a size of 1234000 bytes to be displayed as `1,234'. In the default C locale, there is no thousands separator so a leading `'' has no effect. An integer block size can be followed by a suffix to specify a multiple of that size. A bare size letter, or one followed by `iB', specifies a multiple using powers of 1024. A size letter followed by `B' specifies powers of 1000 instead. For example, `1M' and `1MiB' are equivalent to `1048576', whereas `1MB' is equivalent to `1000000'. A plain suffix without a preceding integer acts as if `1' were prepended, except that it causes a size indication to be appended to the output. For example, `--block-size="kB"' displays 3000 as `3kB'. The following suffixes are defined. Large sizes like `1Y' may be rejected by your computer due to limitations of its arithmetic. `kB' kilobyte: 10^3 = 1000. `k' `K' `KiB' kibibyte: 2^10 = 1024. `K' is special: the SI prefix is `k' and the ISO/IEC 80000-13 prefix is `Ki', but tradition and POSIX use `k' to mean `KiB'. `MB' megabyte: 10^6 = 1,000,000. `M' `MiB' mebibyte: 2^20 = 1,048,576. `GB' gigabyte: 10^9 = 1,000,000,000. `G' `GiB' gibibyte: 2^30 = 1,073,741,824. `TB' terabyte: 10^12 = 1,000,000,000,000. `T' `TiB' tebibyte: 2^40 = 1,099,511,627,776. `PB' petabyte: 10^15 = 1,000,000,000,000,000. `P' `PiB' pebibyte: 2^50 = 1,125,899,906,842,624. `EB' exabyte: 10^18 = 1,000,000,000,000,000,000. `E' `EiB' exbibyte: 2^60 = 1,152,921,504,606,846,976. `ZB' zettabyte: 10^21 = 1,000,000,000,000,000,000,000 `Z' `ZiB' 2^70 = 1,180,591,620,717,411,303,424. `YB' yottabyte: 10^24 = 1,000,000,000,000,000,000,000,000. `Y' `YiB' 2^80 = 1,208,925,819,614,629,174,706,176. Block size defaults can be overridden by an explicit `--block-size=SIZE' option. The `-k' option is equivalent to `--block-size=1K', which is the default unless the `POSIXLY_CORRECT' environment variable is set. The `-h' or `--human-readable' option is equivalent to `--block-size=human-readable'. The `--si' option is equivalent to `--block-size=si'. 2.4 Floating point numbers ========================== Commands that accept or produce floating point numbers employ the floating point representation of the underlying system, and suffer from rounding error, overflow, and similar floating-point issues. Almost all modern systems use IEEE-754 floating point, and it is typically portable to assume IEEE-754 behavior these days. IEEE-754 has positive and negative infinity, distinguishes positive from negative zero, and uses special values called NaNs to represent invalid computations such as dividing zero by itself. For more information, please see David Goldberg's paper What Every Computer Scientist Should Know About Floating-Point Arithmetic (http://www.validlab.com/goldberg/paper.pdf). Commands that accept floating point numbers as options, operands or input use the standard C functions `strtod' and `strtold' to convert from text to floating point numbers. These floating point numbers therefore can use scientific notation like `1.0e-34' and `-10e100'. Modern C implementations also accept hexadecimal floating point numbers such as `-0x.ep-3', which stands for -14/16 times 2^-3, which equals -0.109375. The `LC_NUMERIC' locale determines the decimal-point character. *Note Parsing of Floats: (libc)Parsing of Floats. 2.5 Signal specifications ========================= A SIGNAL may be a signal name like `HUP', or a signal number like `1', or an exit status of a process terminated by the signal. A signal name can be given in canonical form or prefixed by `SIG'. The case of the letters is ignored. The following signal names and numbers are supported on all POSIX compliant systems: `HUP' 1. Hangup. `INT' 2. Terminal interrupt. `QUIT' 3. Terminal quit. `ABRT' 6. Process abort. `KILL' 9. Kill (cannot be caught or ignored). `ALRM' 14. Alarm Clock. `TERM' 15. Termination. Other supported signal names have system-dependent corresponding numbers. All systems conforming to POSIX 1003.1-2001 also support the following signals: `BUS' Access to an undefined portion of a memory object. `CHLD' Child process terminated, stopped, or continued. `CONT' Continue executing, if stopped. `FPE' Erroneous arithmetic operation. `ILL' Illegal Instruction. `PIPE' Write on a pipe with no one to read it. `SEGV' Invalid memory reference. `STOP' Stop executing (cannot be caught or ignored). `TSTP' Terminal stop. `TTIN' Background process attempting read. `TTOU' Background process attempting write. `URG' High bandwidth data is available at a socket. `USR1' User-defined signal 1. `USR2' User-defined signal 2. POSIX 1003.1-2001 systems that support the XSI extension also support the following signals: `POLL' Pollable event. `PROF' Profiling timer expired. `SYS' Bad system call. `TRAP' Trace/breakpoint trap. `VTALRM' Virtual timer expired. `XCPU' CPU time limit exceeded. `XFSZ' File size limit exceeded. POSIX 1003.1-2001 systems that support the XRT extension also support at least eight real-time signals called `RTMIN', `RTMIN+1', ..., `RTMAX-1', `RTMAX'. 2.6 chown and chgrp: Disambiguating user names and IDs ====================================================== Since the OWNER and GROUP arguments to `chown' and `chgrp' may be specified as names or numeric IDs, there is an apparent ambiguity. What if a user or group _name_ is a string of digits? (1) Should the command interpret it as a user name or as an ID? POSIX requires that `chown' and `chgrp' first attempt to resolve the specified string as a name, and only once that fails, then try to interpret it as an ID. This is troublesome when you want to specify a numeric ID, say 42, and it must work even in a pathological situation where `42' is a user name that maps to some other user ID, say 1000. Simply invoking `chown 42 F', will set `F's owner ID to 1000--not what you intended. GNU `chown' and `chgrp' provide a way to work around this, that at the same time may result in a significant performance improvement by eliminating a database look-up. Simply precede each numeric user ID and/or group ID with a `+', in order to force its interpretation as an integer: chown +42 F chgrp +$numeric_group_id another-file chown +0:+0 / GNU `chown' and `chgrp' skip the name look-up process for each `+'-prefixed string, because a string containing `+' is never a valid user or group name. This syntax is accepted on most common Unix systems, but not on Solaris 10. ---------- Footnotes ---------- (1) Using a number as a user name is common in some environments. 2.7 Sources of random data ========================== The `shuf', `shred', and `sort' commands sometimes need random data to do their work. For example, `sort -R' must choose a hash function at random, and it needs random data to make this selection. By default these commands use an internal pseudorandom generator initialized by a small amount of entropy, but can be directed to use an external source with the `--random-source=FILE' option. An error is reported if FILE does not contain enough bytes. For example, the device file `/dev/urandom' could be used as the source of random data. Typically, this device gathers environmental noise from device drivers and other sources into an entropy pool, and uses the pool to generate random bits. If the pool is short of data, the device reuses the internal pool to produce more bits, using a cryptographically secure pseudorandom number generator. But be aware that this device is not designed for bulk random data generation and is relatively slow. `/dev/urandom' suffices for most practical uses, but applications requiring high-value or long-term protection of private data may require an alternate data source like `/dev/random' or `/dev/arandom'. The set of available sources depends on your operating system. To reproduce the results of an earlier invocation of a command, you can save some random data into a file and then use that file as the random source in earlier and later invocations of the command. 2.8 Target directory ==================== The `cp', `install', `ln', and `mv' commands normally treat the last operand specially when it is a directory or a symbolic link to a directory. For example, `cp source dest' is equivalent to `cp source dest/source' if `dest' is a directory. Sometimes this behavior is not exactly what is wanted, so these commands support the following options to allow more fine-grained control: `-T' `--no-target-directory' Do not treat the last operand specially when it is a directory or a symbolic link to a directory. This can help avoid race conditions in programs that operate in a shared area. For example, when the command `mv /tmp/source /tmp/dest' succeeds, there is no guarantee that `/tmp/source' was renamed to `/tmp/dest': it could have been renamed to `/tmp/dest/source' instead, if some other process created `/tmp/dest' as a directory. However, if `mv -T /tmp/source /tmp/dest' succeeds, there is no question that `/tmp/source' was renamed to `/tmp/dest'. In the opposite situation, where you want the last operand to be treated as a directory and want a diagnostic otherwise, you can use the `--target-directory' (`-t') option. `-t DIRECTORY' `--target-directory=DIRECTORY' Use DIRECTORY as the directory component of each destination file name. The interface for most programs is that after processing options and a finite (possibly zero) number of fixed-position arguments, the remaining argument list is either expected to be empty, or is a list of items (usually files) that will all be handled identically. The `xargs' program is designed to work well with this convention. The commands in the `mv'-family are unusual in that they take a variable number of arguments with a special case at the _end_ (namely, the target directory). This makes it nontrivial to perform some operations, e.g., "move all files from here to ../d/", because `mv * ../d/' might exhaust the argument space, and `ls | xargs ...' doesn't have a clean way to specify an extra final argument for each invocation of the subject command. (It can be done by going through a shell command, but that requires more human labor and brain power than it should.) The `--target-directory' (`-t') option allows the `cp', `install', `ln', and `mv' programs to be used conveniently with `xargs'. For example, you can move the files from the current directory to a sibling directory, `d' like this: ls | xargs mv -t ../d -- However, this doesn't move files whose names begin with `.'. If you use the GNU `find' program, you can move those files too, with this command: find . -mindepth 1 -maxdepth 1 \ | xargs mv -t ../d But both of the above approaches fail if there are no files in the current directory, or if any file has a name containing a blank or some other special characters. The following example removes those limitations and requires both GNU `find' and GNU `xargs': find . -mindepth 1 -maxdepth 1 -print0 \ | xargs --null --no-run-if-empty \ mv -t ../d The `--target-directory' (`-t') and `--no-target-directory' (`-T') options cannot be combined. 2.9 Trailing slashes ==================== Some GNU programs (at least `cp' and `mv') allow you to remove any trailing slashes from each SOURCE argument before operating on it. The `--strip-trailing-slashes' option enables this behavior. This is useful when a SOURCE argument may have a trailing slash and specify a symbolic link to a directory. This scenario is in fact rather common because some shells can automatically append a trailing slash when performing file name completion on such symbolic links. Without this option, `mv', for example, (via the system's rename function) must interpret a trailing slash as a request to dereference the symbolic link and so must rename the indirectly referenced _directory_ and not the symbolic link. Although it may seem surprising that such behavior be the default, it is required by POSIX and is consistent with other parts of that standard. 2.10 Traversing symlinks ======================== The following options modify how `chown' and `chgrp' traverse a hierarchy when the `--recursive' (`-R') option is also specified. If more than one of the following options is specified, only the final one takes effect. These options specify whether processing a symbolic link to a directory entails operating on just the symbolic link or on all files in the hierarchy rooted at that directory. These options are independent of `--dereference' and `--no-dereference' (`-h'), which control whether to modify a symlink or its referent. `-H' If `--recursive' (`-R') is specified and a command line argument is a symbolic link to a directory, traverse it. `-L' In a recursive traversal, traverse every symbolic link to a directory that is encountered. `-P' Do not traverse any symbolic links. This is the default if none of `-H', `-L', or `-P' is specified. 2.11 Treating `/' specially =========================== Certain commands can operate destructively on entire hierarchies. For example, if a user with appropriate privileges mistakenly runs `rm -rf / tmp/junk', that may remove all files on the entire system. Since there are so few legitimate uses for such a command, GNU `rm' normally declines to operate on any directory that resolves to `/'. If you really want to try to remove all the files on your system, you can use the `--no-preserve-root' option, but the default behavior, specified by the `--preserve-root' option, is safer for most purposes. The commands `chgrp', `chmod' and `chown' can also operate destructively on entire hierarchies, so they too support these options. Although, unlike `rm', they don't actually unlink files, these commands are arguably more dangerous when operating recursively on `/', since they often work much more quickly, and hence damage more files before an alert user can interrupt them. Tradition and POSIX require these commands to operate recursively on `/', so they default to `--no-preserve-root', but using the `--preserve-root' option makes them safer for most purposes. For convenience you can specify `--preserve-root' in an alias or in a shell function. Note that the `--preserve-root' option also ensures that `chgrp' and `chown' do not modify `/' even when dereferencing a symlink pointing to `/'. 2.12 Special built-in utilities =============================== Some programs like `nice' can invoke other programs; for example, the command `nice cat file' invokes the program `cat' by executing the command `cat file'. However, "special built-in utilities" like `exit' cannot be invoked this way. For example, the command `nice exit' does not have a well-defined behavior: it may generate an error message instead of exiting. Here is a list of the special built-in utilities that are standardized by POSIX 1003.1-2004. . : break continue eval exec exit export readonly return set shift times trap unset For example, because `.', `:', and `exec' are special, the commands `nice . foo.sh', `nice :', and `nice exec pwd' do not work as you might expect. Many shells extend this list. For example, Bash has several extra special built-in utilities like `history', and `suspend', and with Bash the command `nice suspend' generates an error message instead of suspending. 2.13 Standards conformance ========================== In a few cases, the GNU utilities' default behavior is incompatible with the POSIX standard. To suppress these incompatibilities, define the `POSIXLY_CORRECT' environment variable. Unless you are checking for POSIX conformance, you probably do not need to define `POSIXLY_CORRECT'. Newer versions of POSIX are occasionally incompatible with older versions. For example, older versions of POSIX required the command `sort +1' to sort based on the second and succeeding fields in each input line, but starting with POSIX 1003.1-2001 the same command is required to sort the file named `+1', and you must instead use the command `sort -k 2' to get the field-based sort. The GNU utilities normally conform to the version of POSIX that is standard for your system. To cause them to conform to a different version of POSIX, define the `_POSIX2_VERSION' environment variable to a value of the form YYYYMM specifying the year and month the standard was adopted. Three values are currently supported for `_POSIX2_VERSION': `199209' stands for POSIX 1003.2-1992, `200112' stands for POSIX 1003.1-2001, and `200809' stands for POSIX 1003.1-2008. For example, if you have a newer system but are running software that assumes an older version of POSIX and uses `sort +1' or `tail +10', you can work around any compatibility problems by setting `_POSIX2_VERSION=199209' in your environment. 3 Output of entire files ************************ These commands read and write entire files, possibly transforming them in some way. 3.1 `cat': Concatenate and write files ====================================== `cat' copies each FILE (`-' means standard input), or standard input if none are given, to standard output. Synopsis: cat [OPTION] [FILE]... The program accepts the following options. Also see *note Common options::. `-A' `--show-all' Equivalent to `-vET'. `-b' `--number-nonblank' Number all nonempty output lines, starting with 1. `-e' Equivalent to `-vE'. `-E' `--show-ends' Display a `$' after the end of each line. `-n' `--number' Number all output lines, starting with 1. This option is ignored if `-b' is in effect. `-s' `--squeeze-blank' Suppress repeated adjacent empty lines; output just one empty line instead of several. `-t' Equivalent to `-vT'. `-T' `--show-tabs' Display TAB characters as `^I'. `-u' Ignored; for POSIX compatibility. `-v' `--show-nonprinting' Display control characters except for LFD and TAB using `^' notation and precede characters that have the high bit set with `M-'. On systems like MS-DOS that distinguish between text and binary files, `cat' normally reads and writes in binary mode. However, `cat' reads in text mode if one of the options `-bensAE' is used or if `cat' is reading from standard input and standard input is a terminal. Similarly, `cat' writes in text mode if one of the options `-bensAE' is used or if standard output is a terminal. An exit status of zero indicates success, and a nonzero value indicates failure. Examples: # Output f's contents, then standard input, then g's contents. cat f - g # Copy standard input to standard output. cat 3.2 `tac': Concatenate and write files in reverse ================================================= `tac' copies each FILE (`-' means standard input), or standard input if none are given, to standard output, reversing the records (lines by default) in each separately. Synopsis: tac [OPTION]... [FILE]... "Records" are separated by instances of a string (newline by default). By default, this separator string is attached to the end of the record that it follows in the file. The program accepts the following options. Also see *note Common options::. `-b' `--before' The separator is attached to the beginning of the record that it precedes in the file. `-r' `--regex' Treat the separator string as a regular expression. `-s SEPARATOR' `--separator=SEPARATOR' Use SEPARATOR as the record separator, instead of newline. On systems like MS-DOS that distinguish between text and binary files, `tac' reads and writes in binary mode. An exit status of zero indicates success, and a nonzero value indicates failure. Example: # Reverse a file character by character. tac -r -s 'x\|[^x]' 3.3 `nl': Number lines and write files ====================================== `nl' writes each FILE (`-' means standard input), or standard input if none are given, to standard output, with line numbers added to some or all of the lines. Synopsis: nl [OPTION]... [FILE]... `nl' decomposes its input into (logical) pages; by default, the line number is reset to 1 at the top of each logical page. `nl' treats all of the input files as a single document; it does not reset line numbers or logical pages between files. A logical page consists of three sections: header, body, and footer. Any of the sections can be empty. Each can be numbered in a different style from the others. The beginnings of the sections of logical pages are indicated in the input file by a line containing exactly one of these delimiter strings: `\:\:\:' start of header; `\:\:' start of body; `\:' start of footer. The two characters from which these strings are made can be changed from `\' and `:' via options (see below), but the pattern and length of each string cannot be changed. A section delimiter is replaced by an empty line on output. Any text that comes before the first section delimiter string in the input file is considered to be part of a body section, so `nl' treats a file that contains no section delimiters as a single body section. The program accepts the following options. Also see *note Common options::. `-b STYLE' `--body-numbering=STYLE' Select the numbering style for lines in the body section of each logical page. When a line is not numbered, the current line number is not incremented, but the line number separator character is still prepended to the line. The styles are: `a' number all lines, `t' number only nonempty lines (default for body), `n' do not number lines (default for header and footer), `pBRE' number only lines that contain a match for the basic regular expression BRE. *Note Regular Expressions: (grep)Regular Expressions. `-d CD' `--section-delimiter=CD' Set the section delimiter characters to CD; default is `\:'. If only C is given, the second remains `:'. (Remember to protect `\' or other metacharacters from shell expansion with quotes or extra backslashes.) `-f STYLE' `--footer-numbering=STYLE' Analogous to `--body-numbering'. `-h STYLE' `--header-numbering=STYLE' Analogous to `--body-numbering'. `-i NUMBER' `--line-increment=NUMBER' Increment line numbers by NUMBER (default 1). `-l NUMBER' `--join-blank-lines=NUMBER' Consider NUMBER (default 1) consecutive empty lines to be one logical line for numbering, and only number the last one. Where fewer than NUMBER consecutive empty lines occur, do not number them. An empty line is one that contains no characters, not even spaces or tabs. `-n FORMAT' `--number-format=FORMAT' Select the line numbering format (default is `rn'): `ln' left justified, no leading zeros; `rn' right justified, no leading zeros; `rz' right justified, leading zeros. `-p' `--no-renumber' Do not reset the line number at the start of a logical page. `-s STRING' `--number-separator=STRING' Separate the line number from the text line in the output with STRING (default is the TAB character). `-v NUMBER' `--starting-line-number=NUMBER' Set the initial line number on each logical page to NUMBER (default 1). `-w NUMBER' `--number-width=NUMBER' Use NUMBER characters for line numbers (default 6). An exit status of zero indicates success, and a nonzero value indicates failure. 3.4 `od': Write files in octal or other formats =============================================== `od' writes an unambiguous representation of each FILE (`-' means standard input), or standard input if none are given. Synopses: od [OPTION]... [FILE]... od [-abcdfilosx]... [FILE] [[+]OFFSET[.][b]] od [OPTION]... --traditional [FILE] [[+]OFFSET[.][b] [[+]LABEL[.][b]]] Each line of output consists of the offset in the input, followed by groups of data from the file. By default, `od' prints the offset in octal, and each group of file data is a C `short int''s worth of input printed as a single octal number. If OFFSET is given, it specifies how many input bytes to skip before formatting and writing. By default, it is interpreted as an octal number, but the optional trailing decimal point causes it to be interpreted as decimal. If no decimal is specified and the offset begins with `0x' or `0X' it is interpreted as a hexadecimal number. If there is a trailing `b', the number of bytes skipped will be OFFSET multiplied by 512. If a command is of both the first and second forms, the second form is assumed if the last operand begins with `+' or (if there are two operands) a digit. For example, in `od foo 10' and `od +10' the `10' is an offset, whereas in `od 10' the `10' is a file name. The program accepts the following options. Also see *note Common options::. `-A RADIX' `--address-radix=RADIX' Select the base in which file offsets are printed. RADIX can be one of the following: `d' decimal; `o' octal; `x' hexadecimal; `n' none (do not print offsets). The default is octal. `-j BYTES' `--skip-bytes=BYTES' Skip BYTES input bytes before formatting and writing. If BYTES begins with `0x' or `0X', it is interpreted in hexadecimal; otherwise, if it begins with `0', in octal; otherwise, in decimal. BYTES may be, or may be an integer optionally followed by, one of the following multiplicative suffixes: `b' => 512 ("blocks") `KB' => 1000 (KiloBytes) `K' => 1024 (KibiBytes) `MB' => 1000*1000 (MegaBytes) `M' => 1024*1024 (MebiBytes) `GB' => 1000*1000*1000 (GigaBytes) `G' => 1024*1024*1024 (GibiBytes) and so on for `T', `P', `E', `Z', and `Y'. `-N BYTES' `--read-bytes=BYTES' Output at most BYTES bytes of the input. Prefixes and suffixes on `bytes' are interpreted as for the `-j' option. `-S BYTES' `--strings[=BYTES]' Instead of the normal output, output only "string constants": at least BYTES consecutive ASCII graphic characters, followed by a zero byte (ASCII NUL). Prefixes and suffixes on BYTES are interpreted as for the `-j' option. If BYTES is omitted with `--strings', the default is 3. `-t TYPE' `--format=TYPE' Select the format in which to output the file data. TYPE is a string of one or more of the below type indicator characters. If you include more than one type indicator character in a single TYPE string, or use this option more than once, `od' writes one copy of each output line using each of the data types that you specified, in the order that you specified. Adding a trailing "z" to any type specification appends a display of the ASCII character representation of the printable characters to the output line generated by the type specification. `a' named character, ignoring high-order bit `c' ASCII character or backslash escape, `d' signed decimal `f' floating point (*note Floating point::) `o' octal `u' unsigned decimal `x' hexadecimal The type `a' outputs things like `sp' for space, `nl' for newline, and `nul' for a zero byte. Only the least significant seven bits of each byte is used; the high-order bit is ignored. Type `c' outputs ` ', `\n', and `\0', respectively. Except for types `a' and `c', you can specify the number of bytes to use in interpreting each number in the given data type by following the type indicator character with a decimal integer. Alternately, you can specify the size of one of the C compiler's built-in data types by following the type indicator character with one of the following characters. For integers (`d', `o', `u', `x'): `C' char `S' short `I' int `L' long For floating point (`f'): F float D double L long double `-v' `--output-duplicates' Output consecutive lines that are identical. By default, when two or more consecutive output lines would be identical, `od' outputs only the first line, and puts just an asterisk on the following line to indicate the elision. `-w[N]' `--width[=N]' Dump `n' input bytes per output line. This must be a multiple of the least common multiple of the sizes associated with the specified output types. If this option is not given at all, the default is 16. If N is omitted, the default is 32. The next several options are shorthands for format specifications. GNU `od' accepts any combination of shorthands and format specification options. These options accumulate. `-a' Output as named characters. Equivalent to `-t a'. `-b' Output as octal bytes. Equivalent to `-t o1'. `-c' Output as ASCII characters or backslash escapes. Equivalent to `-t c'. `-d' Output as unsigned decimal two-byte units. Equivalent to `-t u2'. `-f' Output as floats. Equivalent to `-t fF'. `-i' Output as decimal ints. Equivalent to `-t dI'. `-l' Output as decimal long ints. Equivalent to `-t dL'. `-o' Output as octal two-byte units. Equivalent to `-t o2'. `-s' Output as decimal two-byte units. Equivalent to `-t d2'. `-x' Output as hexadecimal two-byte units. Equivalent to `-t x2'. `--traditional' Recognize the non-option label argument that traditional `od' accepted. The following syntax: od --traditional [FILE] [[+]OFFSET[.][b] [[+]LABEL[.][b]]] can be used to specify at most one file and optional arguments specifying an offset and a pseudo-start address, LABEL. The LABEL argument is interpreted just like OFFSET, but it specifies an initial pseudo-address. The pseudo-addresses are displayed in parentheses following any normal address. An exit status of zero indicates success, and a nonzero value indicates failure. 3.5 `base64': Transform data into printable data ================================================ `base64' transforms data read from a file, or standard input, into (or from) base64 encoded form. The base64 encoded form uses printable ASCII characters to represent binary data. Synopses: base64 [OPTION]... [FILE] base64 --decode [OPTION]... [FILE] The base64 encoding expands data to roughly 133% of the original. The format conforms to RFC 4648 (ftp://ftp.rfc-editor.org/in-notes/rfc4648.txt). The program accepts the following options. Also see *note Common options::. `-w COLS' `--wrap=COLS' During encoding, wrap lines after COLS characters. This must be a positive number. The default is to wrap after 76 characters. Use the value 0 to disable line wrapping altogether. `-d' `--decode' Change the mode of operation, from the default of encoding data, to decoding data. Input is expected to be base64 encoded data, and the output will be the original data. `-i' `--ignore-garbage' When decoding, newlines are always accepted. During decoding, ignore unrecognized bytes, to permit distorted data to be decoded. An exit status of zero indicates success, and a nonzero value indicates failure. 4 Formatting file contents ************************** These commands reformat the contents of files. 4.1 `fmt': Reformat paragraph text ================================== `fmt' fills and joins lines to produce output lines of (at most) a given number of characters (75 by default). Synopsis: fmt [OPTION]... [FILE]... `fmt' reads from the specified FILE arguments (or standard input if none are given), and writes to standard output. By default, blank lines, spaces between words, and indentation are preserved in the output; successive input lines with different indentation are not joined; tabs are expanded on input and introduced on output. `fmt' prefers breaking lines at the end of a sentence, and tries to avoid line breaks after the first word of a sentence or before the last word of a sentence. A "sentence break" is defined as either the end of a paragraph or a word ending in any of `.?!', followed by two spaces or end of line, ignoring any intervening parentheses or quotes. Like TeX, `fmt' reads entire "paragraphs" before choosing line breaks; the algorithm is a variant of that given by Donald E. Knuth and Michael F. Plass in "Breaking Paragraphs Into Lines", `Software--Practice & Experience' 11, 11 (November 1981), 1119-1184. The program accepts the following options. Also see *note Common options::. `-c' `--crown-margin' "Crown margin" mode: preserve the indentation of the first two lines within a paragraph, and align the left margin of each subsequent line with that of the second line. `-t' `--tagged-paragraph' "Tagged paragraph" mode: like crown margin mode, except that if indentation of the first line of a paragraph is the same as the indentation of the second, the first line is treated as a one-line paragraph. `-s' `--split-only' Split lines only. Do not join short lines to form longer ones. This prevents sample lines of code, and other such "formatted" text from being unduly combined. `-u' `--uniform-spacing' Uniform spacing. Reduce spacing between words to one space, and spacing between sentences to two spaces. `-WIDTH' `-w WIDTH' `--width=WIDTH' Fill output lines up to WIDTH characters (default 75 or GOAL plus 10, if GOAL is provided). `-g GOAL' `--goal=GOAL' `fmt' initially tries to make lines GOAL characters wide. By default, this is 7% shorter than WIDTH. `-p PREFIX' `--prefix=PREFIX' Only lines beginning with PREFIX (possibly preceded by whitespace) are subject to formatting. The prefix and any preceding whitespace are stripped for the formatting and then re-attached to each formatted output line. One use is to format certain kinds of program comments, while leaving the code unchanged. An exit status of zero indicates success, and a nonzero value indicates failure. 4.2 `numfmt': Reformat numbers ============================== `numfmt' reads numbers in various representations and reformats them as requested. The most common usage is converting numbers to/from _human_ representation (e.g. `4G' ==> `4,000,000,000'). numfmt [OPTION]... [NUMBER] `numfmt' converts each NUMBER on the command-line according to the specified options (see below). If no NUMBERs are given, it reads numbers from standard input. `numfmt' can optionally extract numbers from specific columns, maintaining proper line padding and alignment. An exit status of zero indicates success, and a nonzero value indicates failure. See `--invalid' for additional information regarding exit status. 4.2.1 General options --------------------- The program accepts the following options. Also see *note Common options::. `--debug' Print (to standard error) warning messages about possible erroneous usage. `-d D' `--delimiter=D' Use the character D as input field separator (default: whitespace). _Note_: Using non-default delimiter turns off automatic padding. `--field=N' Convert the number in input field N (default: 1). `--format=FORMAT' Use printf-style floating FORMAT string. The FORMAT string must contain one `%f' directive, optionally with `'', `-', or width modifiers. The `'' modifier will enable `--grouping', the `-' modifier will enable left-aligned `--padding' and the width modifier will enable right-aligned `--padding'. `--from=UNIT' Auto-scales input numbers according to UNIT. See UNITS below. The default is no scaling, meaning suffixes (e.g. `M', `G') will trigger an error. `--from-unit=N' Specify the input unit size (instead of the default 1). Use this option when the input numbers represent other units (e.g. if the input number `10' represents 10 units of 512 bytes, use `--from=unit=512'). `--grouping' Group digits in output numbers according to the current locale's grouping rules (e.g _Thousands Separator_ character, commonly `.' (dot) or `,' comma). This option has no effect in `POSIX/C' locale. `--header[=N]' Print the first N (default: 1) lines without any conversion. `--invalid=MODE' The default action on input errors is to exit immediately with status code 2. `--invalid=`abort'' explicitly specifies this default mode. With a MODE of `fail', print a warning for _each_ conversion error, and exit with status 2. With a MODE of `warn', exit with status 0, even in the presence of conversion errors, and with a MODE of `ignore' do not even print diagnostics. `--padding=N' Pad the output numbers to N characters, by adding spaces. If N is a positive number, numbers will be right-aligned. If N is a negative number, numbers will be left-aligned. By default, numbers are automatically aligned based on the input line's width (only with the default delimiter). `--round=METHOD' When converting number representations, round the number according to METHOD, which can be `up', `down', `from-zero' (the default), `towards-zero', `nearest'. `--suffix=SUFFIX' Add `SUFFIX' to the output numbers, and accept optional `SUFFIX' in input numbers. `--to=UNIT' Auto-scales output numbers according to UNIT. See _Units_ below. The default is no scaling, meaning all the digits of the number are printed. `--to-unit=N' Specify the output unit size (instead of the default 1). Use this option when the output numbers represent other units (e.g. to represent `4,000,000' bytes in blocks of 1KB, use `--to=si --to=units=1000'). 4.2.2 Possible UNITs: --------------------- The following are the possible UNIT options with `--from=UNITS' and `--to=UNITS': NONE No scaling is performed. For input numbers, no suffixes are accepted, and any trailing characters following the number will trigger an error. For output numbers, all digits of the numbers will be printed. SI Auto-scale numbers according to the _International System of Units (SI)_ standard. For input numbers, accept one of the following suffixes. For output numbers, values larger than 1000 will be rounded, and printed with one of the following suffixes: `K' => 1000^1 = 10^3 (Kilo) `M' => 1000^2 = 10^6 (Mega) `G' => 1000^3 = 10^9 (Giga) `T' => 1000^4 = 10^12 (Tera) `P' => 1000^5 = 10^15 (Peta) `E' => 1000^6 = 10^18 (Exa) `Z' => 1000^7 = 10^21 (Zetta) `Y' => 1000^8 = 10^24 (Yotta) IEC Auto-scale numbers according to the _International Electronical Commission (IEC)_ standard. For input numbers, accept one of the following suffixes. For output numbers, values larger than 1024 will be rounded, and printed with one of the following suffixes: `K' => 1024^1 = 2^10 (Kibi) `M' => 1024^2 = 2^20 (Mebi) `G' => 1024^3 = 2^30 (Gibi) `T' => 1024^4 = 2^40 (Tebi) `P' => 1024^5 = 2^50 (Pebi) `E' => 1024^6 = 2^60 (Exbi) `Z' => 1024^7 = 2^70 (Zebi) `Y' => 1024^8 = 2^80 (Yobi) The `iec' option uses a single letter suffix (e.g. `G'), which is not fully standard, as the _iec_ standard recommends a two-letter symbol (e.g `Gi') - but in practice, this method common. Compare with the `iec-i' option. IEC-I Auto-scale numbers according to the _International Electronical Commission (IEC)_ standard. For input numbers, accept one of the following suffixes. For output numbers, values larger than 1024 will be rounded, and printed with one of the following suffixes: `Ki' => 1024^1 = 2^10 (Kibi) `Mi' => 1024^2 = 2^20 (Mebi) `Gi' => 1024^3 = 2^30 (Gibi) `Ti' => 1024^4 = 2^40 (Tebi) `Pi' => 1024^5 = 2^50 (Pebi) `Ei' => 1024^6 = 2^60 (Exbi) `Zi' => 1024^7 = 2^70 (Zebi) `Yi' => 1024^8 = 2^80 (Yobi) The `iec-i' option uses a two-letter suffix symbol (e.g. `Gi'), as the _iec_ standard recommends, but this is not always common in practice. Compare with the `iec' option. AUTO `auto' can only be used with `--from'. With this method, numbers with `K',`M',`G',`T',`P',`E',`Z',`Y' suffixes are interpreted as _SI_ values, and numbers with `Ki', `Mi',`Gi',`Ti',`Pi',`Ei',`Zi',`Yi' suffixes are interpreted as _IEC_ values. 4.2.3 Examples of using `numfmt' -------------------------------- Converting a single number from/to _human_ representation: $ nunfmt --to=si 500000 500K $ numfmt --to=iec 500000 489K $ numfmt --to=iec-i 500000 489Ki $ numfmt --from=si 1M 1000000 $ numfmt --from=iec 1M 1048576 # with '--from=auto', M=Mega, Mi=Mebi $ numfmt --from=auto 1M 1000000 $ numfmt --from=auto 1Mi 1048576 Converting from `SI' to `IEC' scales (e.g. when a harddisk capacity is advertised as `1TB', while checking the drive's capacity gives lower values): $ numfmt --from=si --to=iec 1T 932G Converting a single field from an input file / piped input (these contrived examples are for demonstration purposes only, as both `ls' and `df' support the `--human-readable' option to output sizes in human-readable format): # Third field (file size) will be shown in SI representation $ ls -log | numfmt --field 3 --header --to=si | head -n4 -rw-r--r-- 1 94K Aug 23 2011 ABOUT-NLS -rw-r--r-- 1 3.7K Jan 7 16:15 AUTHORS -rw-r--r-- 1 36K Jun 1 2011 COPYING -rw-r--r-- 1 0 Jan 7 15:15 ChangeLog # Second field (size) will be shown in IEC representation $ df --block-size=1 | numfmt --field 2 --header --to=iec | head -n4 File system 1B-blocks Used Available Use% Mounted on rootfs 132G 104741408 26554036 80% / tmpfs 794M 7580 804960 1% /run/shm /dev/sdb1 694G 651424756 46074696 94% /home Output can be tweaked using `--padding' or `--format': # Pad to 10 characters, right-aligned $ du -s * | numfmt --to=si --padding=10 2.5K config.log 108 config.status 1.7K configure 20 configure.ac # Pad to 10 characters, left-aligned $ du -s * | numfmt --to=si --padding=-10 2.5K config.log 108 config.status 1.7K configure 20 configure.ac # Pad to 10 characters, left-aligned, using 'format' $ du -s * | numfmt --to=si --format="%10f" 2.5K config.log 108 config.status 1.7K configure 20 configure.ac # Pad to 10 characters, left-aligned, using 'format' $ du -s * | numfmt --to=si --padding="%-10f" 2.5K config.log 108 config.status 1.7K configure 20 configure.ac With locales that support grouping digits, using `--grouping' or `--format' enables grouping. In `POSIX' locale, grouping is silently ignored: $ LC_ALL=C numfmt --from=iec --grouping 2G 2147483648 $ LC_ALL=en_US.utf8 numfmt --from=iec --grouping 2G 2,147,483,648 $ LC_ALL=ta_IN numfmt --from=iec --grouping 2G 2,14,74,83,648 $ LC_ALL=C ./src/numfmt --from=iec --format="==%'15f==" 2G == 2147483648== $ LC_ALL=en_US.utf8 ./src/numfmt --from=iec --format="==%'15f==" 2G == 2,147,483,648== $ LC_ALL=en_US.utf8 ./src/numfmt --from=iec --format="==%'-15f==" 2G ==2,147,483,648 == $ LC_ALL=ta_IN ./src/numfmt --from=iec --format="==%'15f==" 2G == 2,14,74,83,648== 4.3 `pr': Paginate or columnate files for printing ================================================== `pr' writes each FILE (`-' means standard input), or standard input if none are given, to standard output, paginating and optionally outputting in multicolumn format; optionally merges all FILEs, printing all in parallel, one per column. Synopsis: pr [OPTION]... [FILE]... By default, a 5-line header is printed at each page: two blank lines; a line with the date, the file name, and the page count; and two more blank lines. A footer of five blank lines is also printed. The default PAGE_LENGTH is 66 lines. The default number of text lines is therefore 56. The text line of the header takes the form `DATE STRING PAGE', with spaces inserted around STRING so that the line takes up the full PAGE_WIDTH. Here, DATE is the date (see the `-D' or `--date-format' option for details), STRING is the centered header string, and PAGE identifies the page number. The `LC_MESSAGES' locale category affects the spelling of PAGE; in the default C locale, it is `Page NUMBER' where NUMBER is the decimal page number. Form feeds in the input cause page breaks in the output. Multiple form feeds produce empty pages. Columns are of equal width, separated by an optional string (default is `space'). For multicolumn output, lines will always be truncated to PAGE_WIDTH (default 72), unless you use the `-J' option. For single column output no line truncation occurs by default. Use `-W' option to truncate lines in that case. The program accepts the following options. Also see *note Common options::. `+FIRST_PAGE[:LAST_PAGE]' `--pages=FIRST_PAGE[:LAST_PAGE]' Begin printing with page FIRST_PAGE and stop with LAST_PAGE. Missing `:LAST_PAGE' implies end of file. While estimating the number of skipped pages each form feed in the input file results in a new page. Page counting with and without `+FIRST_PAGE' is identical. By default, counting starts with the first page of input file (not first page printed). Line numbering may be altered by `-N' option. `-COLUMN' `--columns=COLUMN' With each single FILE, produce COLUMN columns of output (default is 1) and print columns down, unless `-a' is used. The column width is automatically decreased as COLUMN increases; unless you use the `-W/-w' option to increase PAGE_WIDTH as well. This option might well cause some lines to be truncated. The number of lines in the columns on each page are balanced. The options `-e' and `-i' are on for multiple text-column output. Together with `-J' option column alignment and line truncation is turned off. Lines of full length are joined in a free field format and `-S' option may set field separators. `-COLUMN' may not be used with `-m' option. `-a' `--across' With each single FILE, print columns across rather than down. The `-COLUMN' option must be given with COLUMN greater than one. If a line is too long to fit in a column, it is truncated. `-c' `--show-control-chars' Print control characters using hat notation (e.g., `^G'); print other nonprinting characters in octal backslash notation. By default, nonprinting characters are not changed. `-d' `--double-space' Double space the output. `-D FORMAT' `--date-format=FORMAT' Format header dates using FORMAT, using the same conventions as for the command `date +FORMAT'. *Note date invocation::. Except for directives, which start with `%', characters in FORMAT are printed unchanged. You can use this option to specify an arbitrary string in place of the header date, e.g., `--date-format="Monday morning"'. The default date format is `%Y-%m-%d %H:%M' (for example, `2001-12-04 23:59'); but if the `POSIXLY_CORRECT' environment variable is set and the `LC_TIME' locale category specifies the POSIX locale, the default is `%b %e %H:%M %Y' (for example, `Dec 4 23:59 2001'. Time stamps are listed according to the time zone rules specified by the `TZ' environment variable, or by the system default rules if `TZ' is not set. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. `-e[IN-TABCHAR[IN-TABWIDTH]]' `--expand-tabs[=IN-TABCHAR[IN-TABWIDTH]]' Expand TABs to spaces on input. Optional argument IN-TABCHAR is the input tab character (default is the TAB character). Second optional argument IN-TABWIDTH is the input tab character's width (default is 8). `-f' `-F' `--form-feed' Use a form feed instead of newlines to separate output pages. This does not alter the default page length of 66 lines. `-h HEADER' `--header=HEADER' Replace the file name in the header with the centered string HEADER. When using the shell, HEADER should be quoted and should be separated from `-h' by a space. `-i[OUT-TABCHAR[OUT-TABWIDTH]]' `--output-tabs[=OUT-TABCHAR[OUT-TABWIDTH]]' Replace spaces with TABs on output. Optional argument OUT-TABCHAR is the output tab character (default is the TAB character). Second optional argument OUT-TABWIDTH is the output tab character's width (default is 8). `-J' `--join-lines' Merge lines of full length. Used together with the column options `-COLUMN', `-a -COLUMN' or `-m'. Turns off `-W/-w' line truncation; no column alignment used; may be used with `--sep-string[=STRING]'. `-J' has been introduced (together with `-W' and `--sep-string') to disentangle the old (POSIX-compliant) options `-w' and `-s' along with the three column options. `-l PAGE_LENGTH' `--length=PAGE_LENGTH' Set the page length to PAGE_LENGTH (default 66) lines, including the lines of the header [and the footer]. If PAGE_LENGTH is less than or equal to 10, the header and footer are omitted, as if the `-t' option had been given. `-m' `--merge' Merge and print all FILEs in parallel, one in each column. If a line is too long to fit in a column, it is truncated, unless the `-J' option is used. `--sep-string[=STRING]' may be used. Empty pages in some FILEs (form feeds set) produce empty columns, still marked by STRING. The result is a continuous line numbering and column marking throughout the whole merged file. Completely empty merged pages show no separators or line numbers. The default header becomes `DATE PAGE' with spaces inserted in the middle; this may be used with the `-h' or `--header' option to fill up the middle blank part. `-n[NUMBER-SEPARATOR[DIGITS]]' `--number-lines[=NUMBER-SEPARATOR[DIGITS]]' Provide DIGITS digit line numbering (default for DIGITS is 5). With multicolumn output the number occupies the first DIGITS column positions of each text column or only each line of `-m' output. With single column output the number precedes each line just as `-m' does. Default counting of the line numbers starts with the first line of the input file (not the first line printed, compare the `--page' option and `-N' option). Optional argument NUMBER-SEPARATOR is the character appended to the line number to separate it from the text followed. The default separator is the TAB character. In a strict sense a TAB is always printed with single column output only. The TAB width varies with the TAB position, e.g., with the left MARGIN specified by `-o' option. With multicolumn output priority is given to `equal width of output columns' (a POSIX specification). The TAB width is fixed to the value of the first column and does not change with different values of left MARGIN. That means a fixed number of spaces is always printed in the place of the NUMBER-SEPARATOR TAB. The tabification depends upon the output position. `-N LINE_NUMBER' `--first-line-number=LINE_NUMBER' Start line counting with the number LINE_NUMBER at first line of first page printed (in most cases not the first line of the input file). `-o MARGIN' `--indent=MARGIN' Indent each line with a margin MARGIN spaces wide (default is zero). The total page width is the size of the margin plus the PAGE_WIDTH set with the `-W/-w' option. A limited overflow may occur with numbered single column output (compare `-n' option). `-r' `--no-file-warnings' Do not print a warning message when an argument FILE cannot be opened. (The exit status will still be nonzero, however.) `-s[CHAR]' `--separator[=CHAR]' Separate columns by a single character CHAR. The default for CHAR is the TAB character without `-w' and `no character' with `-w'. Without `-s' the default separator `space' is set. `-s[char]' turns off line truncation of all three column options (`-COLUMN'|`-a -COLUMN'|`-m') unless `-w' is set. This is a POSIX-compliant formulation. `-S[STRING]' `--sep-string[=STRING]' Use STRING to separate output columns. The `-S' option doesn't affect the `-W/-w' option, unlike the `-s' option which does. It does not affect line truncation or column alignment. Without `-S', and with `-J', `pr' uses the default output separator, TAB. Without `-S' or `-J', `pr' uses a `space' (same as `-S" "'). If no `STRING' argument is specified, `""' is assumed. `-t' `--omit-header' Do not print the usual header [and footer] on each page, and do not fill out the bottom of pages (with blank lines or a form feed). No page structure is produced, but form feeds set in the input files are retained. The predefined pagination is not changed. `-t' or `-T' may be useful together with other options; e.g.: `-t -e4', expand TAB characters in the input file to 4 spaces but don't make any other changes. Use of `-t' overrides `-h'. `-T' `--omit-pagination' Do not print header [and footer]. In addition eliminate all form feeds set in the input files. `-v' `--show-nonprinting' Print nonprinting characters in octal backslash notation. `-w PAGE_WIDTH' `--width=PAGE_WIDTH' Set page width to PAGE_WIDTH characters for multiple text-column output only (default for PAGE_WIDTH is 72). `-s[CHAR]' turns off the default page width and any line truncation and column alignment. Lines of full length are merged, regardless of the column options set. No PAGE_WIDTH setting is possible with single column output. A POSIX-compliant formulation. `-W PAGE_WIDTH' `--page_width=PAGE_WIDTH' Set the page width to PAGE_WIDTH characters. That's valid with and without a column option. Text lines are truncated, unless `-J' is used. Together with one of the three column options (`-COLUMN', `-a -COLUMN' or `-m') column alignment is always used. The separator options `-S' or `-s' don't affect the `-W' option. Default is 72 characters. Without `-W PAGE_WIDTH' and without any of the column options NO line truncation is used (defined to keep downward compatibility and to meet most frequent tasks). That's equivalent to `-W 72 -J'. The header line is never truncated. An exit status of zero indicates success, and a nonzero value indicates failure. 4.4 `fold': Wrap input lines to fit in specified width ====================================================== `fold' writes each FILE (`-' means standard input), or standard input if none are given, to standard output, breaking long lines. Synopsis: fold [OPTION]... [FILE]... By default, `fold' breaks lines wider than 80 columns. The output is split into as many lines as necessary. `fold' counts screen columns by default; thus, a tab may count more than one column, backspace decreases the column count, and carriage return sets the column to zero. The program accepts the following options. Also see *note Common options::. `-b' `--bytes' Count bytes rather than columns, so that tabs, backspaces, and carriage returns are each counted as taking up one column, just like other characters. `-s' `--spaces' Break at word boundaries: the line is broken after the last blank before the maximum line length. If the line contains no such blanks, the line is broken at the maximum line length as usual. `-w WIDTH' `--width=WIDTH' Use a maximum line length of WIDTH columns instead of 80. For compatibility `fold' supports an obsolete option syntax `-WIDTH'. New scripts should use `-w WIDTH' instead. An exit status of zero indicates success, and a nonzero value indicates failure. 5 Output of parts of files ************************** These commands output pieces of the input. 5.1 `head': Output the first part of files ========================================== `head' prints the first part (10 lines by default) of each FILE; it reads from standard input if no files are given or when given a FILE of `-'. Synopsis: head [OPTION]... [FILE]... If more than one FILE is specified, `head' prints a one-line header consisting of: ==> FILE NAME <== before the output for each FILE. The program accepts the following options. Also see *note Common options::. `-c K' `--bytes=K' Print the first K bytes, instead of initial lines. However, if K starts with a `-', print all but the last K bytes of each file. K may be, or may be an integer optionally followed by, one of the following multiplicative suffixes: `b' => 512 ("blocks") `KB' => 1000 (KiloBytes) `K' => 1024 (KibiBytes) `MB' => 1000*1000 (MegaBytes) `M' => 1024*1024 (MebiBytes) `GB' => 1000*1000*1000 (GigaBytes) `G' => 1024*1024*1024 (GibiBytes) and so on for `T', `P', `E', `Z', and `Y'. `-n K' `--lines=K' Output the first K lines. However, if K starts with a `-', print all but the last K lines of each file. Size multiplier suffixes are the same as with the `-c' option. `-q' `--quiet' `--silent' Never print file name headers. `-v' `--verbose' Always print file name headers. For compatibility `head' also supports an obsolete option syntax `-COUNTOPTIONS', which is recognized only if it is specified first. COUNT is a decimal number optionally followed by a size letter (`b', `k', `m') as in `-c', or `l' to mean count by lines, or other option letters (`cqv'). Scripts intended for standard hosts should use `-c COUNT' or `-n COUNT' instead. If your script must also run on hosts that support only the obsolete syntax, it is usually simpler to avoid `head', e.g., by using `sed 5q' instead of `head -5'. An exit status of zero indicates success, and a nonzero value indicates failure. 5.2 `tail': Output the last part of files ========================================= `tail' prints the last part (10 lines by default) of each FILE; it reads from standard input if no files are given or when given a FILE of `-'. Synopsis: tail [OPTION]... [FILE]... If more than one FILE is specified, `tail' prints a one-line header consisting of: ==> FILE NAME <== before the output for each FILE. GNU `tail' can output any amount of data (some other versions of `tail' cannot). It also has no `-r' option (print in reverse), since reversing a file is really a different job from printing the end of a file; BSD `tail' (which is the one with `-r') can only reverse files that are at most as large as its buffer, which is typically 32 KiB. A more reliable and versatile way to reverse files is the GNU `tac' command. The program accepts the following options. Also see *note Common options::. `-c K' `--bytes=K' Output the last K bytes, instead of final lines. However, if K starts with a `+', start printing with the Kth byte from the start of each file, instead of from the end. K may be, or may be an integer optionally followed by, one of the following multiplicative suffixes: `b' => 512 ("blocks") `KB' => 1000 (KiloBytes) `K' => 1024 (KibiBytes) `MB' => 1000*1000 (MegaBytes) `M' => 1024*1024 (MebiBytes) `GB' => 1000*1000*1000 (GigaBytes) `G' => 1024*1024*1024 (GibiBytes) and so on for `T', `P', `E', `Z', and `Y'. `-f' `--follow[=HOW]' Loop forever trying to read more characters at the end of the file, presumably because the file is growing. If more than one file is given, `tail' prints a header whenever it gets output from a different file, to indicate which file that output is from. There are two ways to specify how you'd like to track files with this option, but that difference is noticeable only when a followed file is removed or renamed. If you'd like to continue to track the end of a growing file even after it has been unlinked, use `--follow=descriptor'. This is the default behavior, but it is not useful if you're tracking a log file that may be rotated (removed or renamed, then reopened). In that case, use `--follow=name' to track the named file, perhaps by reopening it periodically to see if it has been removed and recreated by some other program. Note that the inotify-based implementation handles this case without the need for any periodic reopening. No matter which method you use, if the tracked file is determined to have shrunk, `tail' prints a message saying the file has been truncated and resumes tracking the end of the file from the newly-determined endpoint. When a file is removed, `tail''s behavior depends on whether it is following the name or the descriptor. When following by name, tail can detect that a file has been removed and gives a message to that effect, and if `--retry' has been specified it will continue checking periodically to see if the file reappears. When following a descriptor, tail does not detect that the file has been unlinked or renamed and issues no message; even though the file may no longer be accessible via its original name, it may still be growing. The option values `descriptor' and `name' may be specified only with the long form of the option, not with `-f'. The `-f' option is ignored if no FILE operand is specified and standard input is a FIFO or a pipe. Likewise, the `-f' option has no effect for any operand specified as `-', when standard input is a FIFO or a pipe. With kernel inotify support, output is triggered by file changes and is generally very prompt. Otherwise, `tail' sleeps for one second between checks-- use `--sleep-interval=N' to change that default--which can make the output appear slightly less responsive or bursty. When using tail without inotify support, you can make it more responsive by using a sub-second sleep interval, e.g., via an alias like this: alias tail='tail -s.1' `-F' This option is the same as `--follow=name --retry'. That is, tail will attempt to reopen a file when it is removed. Should this fail, tail will keep trying until it becomes accessible again. `--retry' This option is useful mainly when following by name (i.e., with `--follow=name'). Without this option, when tail encounters a file that doesn't exist or is otherwise inaccessible, it reports that fact and never checks it again. `--sleep-interval=NUMBER' Change the number of seconds to wait between iterations (the default is 1.0). During one iteration, every specified file is checked to see if it has changed size. Historical implementations of `tail' have required that NUMBER be an integer. However, GNU `tail' accepts an arbitrary floating point number. *Note Floating point::. When `tail' uses inotify, this polling-related option is usually ignored. However, if you also specify `--pid=P', `tail' checks whether process P is alive at least every NUMBER seconds. `--pid=PID' When following by name or by descriptor, you may specify the process ID, PID, of the sole writer of all FILE arguments. Then, shortly after that process terminates, tail will also terminate. This will work properly only if the writer and the tailing process are running on the same machine. For example, to save the output of a build in a file and to watch the file grow, if you invoke `make' and `tail' like this then the tail process will stop when your build completes. Without this option, you would have had to kill the `tail -f' process yourself. $ make >& makerr & tail --pid=$! -f makerr If you specify a PID that is not in use or that does not correspond to the process that is writing to the tailed files, then `tail' may terminate long before any FILEs stop growing or it may not terminate until long after the real writer has terminated. Note that `--pid' cannot be supported on some systems; `tail' will print a warning if this is the case. `--max-unchanged-stats=N' When tailing a file by name, if there have been N (default n=5) consecutive iterations for which the file has not changed, then `open'/`fstat' the file to determine if that file name is still associated with the same device/inode-number pair as before. When following a log file that is rotated, this is approximately the number of seconds between when tail prints the last pre-rotation lines and when it prints the lines that have accumulated in the new log file. This option is meaningful only when polling (i.e., without inotify) and when following by name. `-n K' `--lines=K' Output the last K lines. However, if K starts with a `+', start printing with the Kth line from the start of each file, instead of from the end. Size multiplier suffixes are the same as with the `-c' option. `-q' `--quiet' `--silent' Never print file name headers. `-v' `--verbose' Always print file name headers. For compatibility `tail' also supports an obsolete usage `tail -[COUNT][bcl][f] [FILE]', which is recognized only if it does not conflict with the usage described above. This obsolete form uses exactly one option and at most one file. In the option, COUNT is an optional decimal number optionally followed by a size letter (`b', `c', `l') to mean count by 512-byte blocks, bytes, or lines, optionally followed by `f' which has the same meaning as `-f'. On older systems, the leading `-' can be replaced by `+' in the obsolete option syntax with the same meaning as in counts, and obsolete usage overrides normal usage when the two conflict. This obsolete behavior can be enabled or disabled with the `_POSIX2_VERSION' environment variable (*note Standards conformance::). Scripts intended for use on standard hosts should avoid obsolete syntax and should use `-c COUNT[b]', `-n COUNT', and/or `-f' instead. If your script must also run on hosts that support only the obsolete syntax, you can often rewrite it to avoid problematic usages, e.g., by using `sed -n '$p'' rather than `tail -1'. If that's not possible, the script can use a test like `if tail -c +1 /dev/null 2>&1; then ...' to decide which syntax to use. Even if your script assumes the standard behavior, you should still beware usages whose behaviors differ depending on the POSIX version. For example, avoid `tail - main.c', since it might be interpreted as either `tail main.c' or as `tail -- - main.c'; avoid `tail -c 4', since it might mean either `tail -c4' or `tail -c 10 4'; and avoid `tail +4', since it might mean either `tail ./+4' or `tail -n +4'. An exit status of zero indicates success, and a nonzero value indicates failure. 5.3 `split': Split a file into pieces. ====================================== `split' creates output files containing consecutive or interleaved sections of INPUT (standard input if none is given or INPUT is `-'). Synopsis: split [OPTION] [INPUT [PREFIX]] By default, `split' puts 1000 lines of INPUT (or whatever is left over for the last section), into each output file. The output files' names consist of PREFIX (`x' by default) followed by a group of characters (`aa', `ab', ... by default), such that concatenating the output files in traditional sorted order by file name produces the original input file (except `-nr/N'). By default split will initially create files with two generated suffix characters, and will increase this width by two when the next most significant position reaches the last character. (`yz', `zaaa', `zaab', ...). In this way an arbitrary number of output files are supported, which sort as described above, even in the presence of an `--additional-suffix' option. If the `-a' option is specified and the output file names are exhausted, `split' reports an error without deleting the output files that it did create. The program accepts the following options. Also see *note Common options::. `-l LINES' `--lines=LINES' Put LINES lines of INPUT into each output file. For compatibility `split' also supports an obsolete option syntax `-LINES'. New scripts should use `-l LINES' instead. `-b SIZE' `--bytes=SIZE' Put SIZE bytes of INPUT into each output file. SIZE may be, or may be an integer optionally followed by, one of the following multiplicative suffixes: `b' => 512 ("blocks") `KB' => 1000 (KiloBytes) `K' => 1024 (KibiBytes) `MB' => 1000*1000 (MegaBytes) `M' => 1024*1024 (MebiBytes) `GB' => 1000*1000*1000 (GigaBytes) `G' => 1024*1024*1024 (GibiBytes) and so on for `T', `P', `E', `Z', and `Y'. `-C SIZE' `--line-bytes=SIZE' Put into each output file as many complete lines of INPUT as possible without exceeding SIZE bytes. Individual lines longer than SIZE bytes are broken into multiple files. SIZE has the same format as for the `--bytes' option. `--filter=COMMAND' With this option, rather than simply writing to each output file, write through a pipe to the specified shell COMMAND for each output file. COMMAND should use the $FILE environment variable, which is set to a different output file name for each invocation of the command. For example, imagine that you have a 1TiB compressed file that, if uncompressed, would be too large to reside on disk, yet you must split it into individually-compressed pieces of a more manageable size. To do that, you might run this command: xz -dc BIG.xz | split -b200G --filter='xz > $FILE.xz' - big- Assuming a 10:1 compression ratio, that would create about fifty 20GiB files with names `big-aa.xz', `big-ab.xz', `big-ac.xz', etc. `-n CHUNKS' `--number=CHUNKS' Split INPUT to CHUNKS output files where CHUNKS may be: N generate N files based on current size of INPUT K/N only output Kth of N to stdout l/N generate N files without splitting lines l/K/N likewise but only output Kth of N to stdout r/N like `l' but use round robin distribution r/K/N likewise but only output Kth of N to stdout Any excess bytes remaining after dividing the INPUT into N chunks, are assigned to the last chunk. Any excess bytes appearing after the initial calculation are discarded (except when using `r' mode). All N files are created even if there are fewer than N lines, or the INPUT is truncated. For `l' mode, chunks are approximately INPUT size / N. The INPUT is partitioned into N equal sized portions, with the last assigned any excess. If a line _starts_ within a partition it is written completely to the corresponding file. Since lines are not split even if they overlap a partition, the files written can be larger or smaller than the partition size, and even empty if a line is so long as to completely overlap the partition. For `r' mode, the size of INPUT is irrelevant, and so can be a pipe for example. `-a LENGTH' `--suffix-length=LENGTH' Use suffixes of length LENGTH. If a LENGTH of 0 is specified, this is the same as if (any previous) `-a' was not specified, and thus enables the default behavior, which starts the suffix length at 2, and unless `-n' or `--numeric-suffixes=FROM' is specified, will auto increase the length by 2 as required. `-d' `--numeric-suffixes[=FROM]' Use digits in suffixes rather than lower-case letters. The numerical suffix counts from FROM if specified, 0 otherwise. Note specifying a FROM value also disables the default auto suffix length expansion described above, and so you may also want to specify `-a' to allow suffixes beyond `99'. `--additional-suffix=SUFFIX' Append an additional SUFFIX to output file names. SUFFIX must not contain slash. `-e' `--elide-empty-files' Suppress the generation of zero-length output files. This can happen with the `--number' option if a file is (truncated to be) shorter than the number requested, or if a line is so long as to completely span a chunk. The output file sequence numbers, always run consecutively even when this option is specified. `-u' `--unbuffered' Immediately copy input to output in `--number r/...' mode, which is a much slower mode of operation. `--verbose' Write a diagnostic just before each output file is opened. An exit status of zero indicates success, and a nonzero value indicates failure. Here are a few examples to illustrate how the `--number' (`-n') option works: Notice how, by default, one line may be split onto two or more: $ seq -w 6 10 > k; split -n3 k; head xa? ==> xaa <== 06 07 ==> xab <== 08 0 ==> xac <== 9 10 Use the "l/" modifier to suppress that: $ seq -w 6 10 > k; split -nl/3 k; head xa? ==> xaa <== 06 07 ==> xab <== 08 09 ==> xac <== 10 Use the "r/" modifier to distribute lines in a round-robin fashion: $ seq -w 6 10 > k; split -nr/3 k; head xa? ==> xaa <== 06 09 ==> xab <== 07 10 ==> xac <== 08 You can also extract just the Kth chunk. This extracts and prints just the 7th "chunk" of 33: $ seq 100 > k; split -nl/7/33 k 20 21 22 5.4 `csplit': Split a file into context-determined pieces ========================================================= `csplit' creates zero or more output files containing sections of INPUT (standard input if INPUT is `-'). Synopsis: csplit [OPTION]... INPUT PATTERN... The contents of the output files are determined by the PATTERN arguments, as detailed below. An error occurs if a PATTERN argument refers to a nonexistent line of the input file (e.g., if no remaining line matches a given regular expression). After every PATTERN has been matched, any remaining input is copied into one last output file. By default, `csplit' prints the number of bytes written to each output file after it has been created. The types of pattern arguments are: `N' Create an output file containing the input up to but not including line N (a positive integer). If followed by a repeat count, also create an output file containing the next N lines of the input file once for each repeat. `/REGEXP/[OFFSET]' Create an output file containing the current line up to (but not including) the next line of the input file that contains a match for REGEXP. The optional OFFSET is an integer. If it is given, the input up to (but not including) the matching line plus or minus OFFSET is put into the output file, and the line after that begins the next section of input. `%REGEXP%[OFFSET]' Like the previous type, except that it does not create an output file, so that section of the input file is effectively ignored. `{REPEAT-COUNT}' Repeat the previous pattern REPEAT-COUNT additional times. The REPEAT-COUNT can either be a positive integer or an asterisk, meaning repeat as many times as necessary until the input is exhausted. The output files' names consist of a prefix (`xx' by default) followed by a suffix. By default, the suffix is an ascending sequence of two-digit decimal numbers from `00' to `99'. In any case, concatenating the output files in sorted order by file name produces the original input file. By default, if `csplit' encounters an error or receives a hangup, interrupt, quit, or terminate signal, it removes any output files that it has created so far before it exits. The program accepts the following options. Also see *note Common options::. `-f PREFIX' `--prefix=PREFIX' Use PREFIX as the output file name prefix. `-b SUFFIX' `--suffix=SUFFIX' Use SUFFIX as the output file name suffix. When this option is specified, the suffix string must include exactly one `printf(3)'-style conversion specification, possibly including format specification flags, a field width, a precision specifications, or all of these kinds of modifiers. The format letter must convert a binary unsigned integer argument to readable form. The format letters `d' and `i' are aliases for `u', and the `u', `o', `x', and `X' conversions are allowed. The entire SUFFIX is given (with the current output file number) to `sprintf(3)' to form the file name suffixes for each of the individual output files in turn. If this option is used, the `--digits' option is ignored. `-n DIGITS' `--digits=DIGITS' Use output file names containing numbers that are DIGITS digits long instead of the default 2. `-k' `--keep-files' Do not remove output files when errors are encountered. `-z' `--elide-empty-files' Suppress the generation of zero-length output files. (In cases where the section delimiters of the input file are supposed to mark the first lines of each of the sections, the first output file will generally be a zero-length file unless you use this option.) The output file sequence numbers always run consecutively starting from 0, even when this option is specified. `-s' `-q' `--silent' `--quiet' Do not print counts of output file sizes. An exit status of zero indicates success, and a nonzero value indicates failure. Here is an example of its usage. First, create an empty directory for the exercise, and cd into it: $ mkdir d && cd d Now, split the sequence of 1..14 on lines that end with 0 or 5: $ seq 14 | csplit - '/[05]$/' '{*}' 8 10 15 Each number printed above is the size of an output file that csplit has just created. List the names of those output files: $ ls xx00 xx01 xx02 Use `head' to show their contents: $ head xx* ==> xx00 <== 1 2 3 4 ==> xx01 <== 5 6 7 8 9 ==> xx02 <== 10 11 12 13 14 6 Summarizing files ******************* These commands generate just a few numbers representing entire contents of files. 6.1 `wc': Print newline, word, and byte counts ============================================== `wc' counts the number of bytes, characters, whitespace-separated words, and newlines in each given FILE, or standard input if none are given or for a FILE of `-'. Synopsis: wc [OPTION]... [FILE]... `wc' prints one line of counts for each file, and if the file was given as an argument, it prints the file name following the counts. If more than one FILE is given, `wc' prints a final line containing the cumulative counts, with the file name `total'. The counts are printed in this order: newlines, words, characters, bytes, maximum line length. Each count is printed right-justified in a field with at least one space between fields so that the numbers and file names normally line up nicely in columns. The width of the count fields varies depending on the inputs, so you should not depend on a particular field width. However, as a GNU extension, if only one count is printed, it is guaranteed to be printed without leading spaces. By default, `wc' prints three counts: the newline, words, and byte counts. Options can specify that only certain counts be printed. Options do not undo others previously given, so wc --bytes --words prints both the byte counts and the word counts. With the `--max-line-length' option, `wc' prints the length of the longest line per file, and if there is more than one file it prints the maximum (not the sum) of those lengths. The line lengths here are measured in screen columns, according to the current locale and assuming tab positions in every 8th column. The program accepts the following options. Also see *note Common options::. `-c' `--bytes' Print only the byte counts. `-m' `--chars' Print only the character counts. `-w' `--words' Print only the word counts. `-l' `--lines' Print only the newline counts. `-L' `--max-line-length' Print only the maximum line lengths. `--files0-from=FILE' Disallow processing files named on the command line, and instead process those named in file FILE; each name being terminated by a zero byte (ASCII NUL). This is useful when the list of file names is so long that it may exceed a command line length limitation. In such cases, running `wc' via `xargs' is undesirable because it splits the list into pieces and makes `wc' print a total for each sublist rather than for the entire list. One way to produce a list of ASCII NUL terminated file names is with GNU `find', using its `-print0' predicate. If FILE is `-' then the ASCII NUL terminated file names are read from standard input. For example, to find the length of the longest line in any `.c' or `.h' file in the current hierarchy, do this: find . -name '*.[ch]' -print0 | wc -L --files0-from=- | tail -n1 An exit status of zero indicates success, and a nonzero value indicates failure. 6.2 `sum': Print checksum and block counts ========================================== `sum' computes a 16-bit checksum for each given FILE, or standard input if none are given or for a FILE of `-'. Synopsis: sum [OPTION]... [FILE]... `sum' prints the checksum for each FILE followed by the number of blocks in the file (rounded up). If more than one FILE is given, file names are also printed (by default). (With the `--sysv' option, corresponding file names are printed when there is at least one file argument.) By default, GNU `sum' computes checksums using an algorithm compatible with BSD `sum' and prints file sizes in units of 1024-byte blocks. The program accepts the following options. Also see *note Common options::. `-r' Use the default (BSD compatible) algorithm. This option is included for compatibility with the System V `sum'. Unless `-s' was also given, it has no effect. `-s' `--sysv' Compute checksums using an algorithm compatible with System V `sum''s default, and print file sizes in units of 512-byte blocks. `sum' is provided for compatibility; the `cksum' program (see next section) is preferable in new applications. An exit status of zero indicates success, and a nonzero value indicates failure. 6.3 `cksum': Print CRC checksum and byte counts =============================================== `cksum' computes a cyclic redundancy check (CRC) checksum for each given FILE, or standard input if none are given or for a FILE of `-'. Synopsis: cksum [OPTION]... [FILE]... `cksum' prints the CRC checksum for each file along with the number of bytes in the file, and the file name unless no arguments were given. `cksum' is typically used to ensure that files transferred by unreliable means (e.g., netnews) have not been corrupted, by comparing the `cksum' output for the received files with the `cksum' output for the original files (typically given in the distribution). The CRC algorithm is specified by the POSIX standard. It is not compatible with the BSD or System V `sum' algorithms (see the previous section); it is more robust. The only options are `--help' and `--version'. *Note Common options::. An exit status of zero indicates success, and a nonzero value indicates failure. 6.4 `md5sum': Print or check MD5 digests ======================================== `md5sum' computes a 128-bit checksum (or "fingerprint" or "message-digest") for each specified FILE. Note: The MD5 digest is more reliable than a simple CRC (provided by the `cksum' command) for detecting accidental file corruption, as the chances of accidentally having two files with identical MD5 are vanishingly small. However, it should not be considered secure against malicious tampering: although finding a file with a given MD5 fingerprint is considered infeasible at the moment, it is known how to modify certain files, including digital certificates, so that they appear valid when signed with an MD5 digest. For more secure hashes, consider using SHA-2. *Note sha2 utilities::. If a FILE is specified as `-' or if no files are given `md5sum' computes the checksum for the standard input. `md5sum' can also determine whether a file and checksum are consistent. Synopsis: md5sum [OPTION]... [FILE]... For each FILE, `md5sum' outputs the MD5 checksum, a flag indicating binary or text input mode, and the file name. If FILE contains a backslash or newline, the line is started with a backslash, and each problematic character in the file name is escaped with a backslash, making the output unambiguous even in the presence of arbitrary file names. If FILE is omitted or specified as `-', standard input is read. The program accepts the following options. Also see *note Common options::. `-b' `--binary' Treat each input file as binary, by reading it in binary mode and outputting a `*' flag. This is the inverse of `--text'. On systems like GNU that do not distinguish between binary and text files, this option merely flags each input mode as binary: the MD5 checksum is unaffected. This option is the default on systems like MS-DOS that distinguish between binary and text files, except for reading standard input when standard input is a terminal. `-c' `--check' Read file names and checksum information (not data) from each FILE (or from stdin if no FILE was specified) and report whether the checksums match the contents of the named files. The input to this mode of `md5sum' is usually the output of a prior, checksum-generating run of `md5sum'. Each valid line of input consists of an MD5 checksum, a binary/text flag, and then a file name. Binary mode is indicated with `*', text with ` ' (space). For each such line, `md5sum' reads the named file and computes its MD5 checksum. Then, if the computed message digest does not match the one on the line with the file name, the file is noted as having failed the test. Otherwise, the file passes the test. By default, for each valid line, one line is written to standard output indicating whether the named file passed the test. After all checks have been performed, if there were any failures, a warning is issued to standard error. Use the `--status' option to inhibit that output. If any listed file cannot be opened or read, if any valid line has an MD5 checksum inconsistent with the associated file, or if no valid line is found, `md5sum' exits with nonzero status. Otherwise, it exits successfully. `--quiet' This option is useful only when verifying checksums. When verifying checksums, don't generate an 'OK' message per successfully checked file. Files that fail the verification are reported in the default one-line-per-file format. If there is any checksum mismatch, print a warning summarizing the failures to standard error. `--status' This option is useful only when verifying checksums. When verifying checksums, don't generate the default one-line-per-file diagnostic and don't output the warning summarizing any failures. Failures to open or read a file still evoke individual diagnostics to standard error. If all listed files are readable and are consistent with the associated MD5 checksums, exit successfully. Otherwise exit with a status code indicating there was a failure. `--tag' Output BSD style checksums, which indicate the checksum algorithm used. As a GNU extension, file names with problematic characters are escaped as described above, with the same escaping indicator of `\' at the start of the line, being used. The `--tag' option implies binary mode, and is disallowed with `--text' mode as supporting that would unnecessarily complicate the output format, while providing little benefit. `-t' `--text' Treat each input file as text, by reading it in text mode and outputting a ` ' flag. This is the inverse of `--binary'. This option is the default on systems like GNU that do not distinguish between binary and text files. On other systems, it is the default for reading standard input when standard input is a terminal. This mode is never defaulted to if `--tag' is used. `-w' `--warn' When verifying checksums, warn about improperly formatted MD5 checksum lines. This option is useful only if all but a few lines in the checked input are valid. `--strict' When verifying checksums, if one or more input line is invalid, exit nonzero after all warnings have been issued. An exit status of zero indicates success, and a nonzero value indicates failure. 6.5 `sha1sum': Print or check SHA-1 digests =========================================== `sha1sum' computes a 160-bit checksum for each specified FILE. The usage and options of this command are precisely the same as for `md5sum'. *Note md5sum invocation::. Note: The SHA-1 digest is more secure than MD5, and no collisions of it are known (different files having the same fingerprint). However, it is known that they can be produced with considerable, but not unreasonable, resources. For this reason, it is generally considered that SHA-1 should be gradually phased out in favor of the more secure SHA-2 hash algorithms. *Note sha2 utilities::. 6.6 sha2 utilities: Print or check SHA-2 digests ================================================ The commands `sha224sum', `sha256sum', `sha384sum' and `sha512sum' compute checksums of various lengths (respectively 224, 256, 384 and 512 bits), collectively known as the SHA-2 hashes. The usage and options of these commands are precisely the same as for `md5sum'. *Note md5sum invocation::. Note: The SHA384 and SHA512 digests are considerably slower to compute, especially on 32-bit computers, than SHA224 or SHA256. 7 Operating on sorted files *************************** These commands work with (or produce) sorted files. 7.1 `sort': Sort text files =========================== `sort' sorts, merges, or compares all the lines from the given files, or standard input if none are given or for a FILE of `-'. By default, `sort' writes the results to standard output. Synopsis: sort [OPTION]... [FILE]... `sort' has three modes of operation: sort (the default), merge, and check for sortedness. The following options change the operation mode: `-c' `--check' `--check=diagnose-first' Check whether the given file is already sorted: if it is not all sorted, print a diagnostic containing the first out-of-order line and exit with a status of 1. Otherwise, exit successfully. At most one input file can be given. `-C' `--check=quiet' `--check=silent' Exit successfully if the given file is already sorted, and exit with status 1 otherwise. At most one input file can be given. This is like `-c', except it does not print a diagnostic. `-m' `--merge' Merge the given files by sorting them as a group. Each input file must always be individually sorted. It always works to sort instead of merge; merging is provided because it is faster, in the case where it works. A pair of lines is compared as follows: `sort' compares each pair of fields, in the order specified on the command line, according to the associated ordering options, until a difference is found or no fields are left. If no key fields are specified, `sort' uses a default key of the entire line. Finally, as a last resort when all keys compare equal, `sort' compares entire lines as if no ordering options other than `--reverse' (`-r') were specified. The `--stable' (`-s') option disables this "last-resort comparison" so that lines in which all fields compare equal are left in their original relative order. The `--unique' (`-u') option also disables the last-resort comparison. Unless otherwise specified, all comparisons use the character collating sequence specified by the `LC_COLLATE' locale.(1) GNU `sort' (as specified for all GNU utilities) has no limit on input line length or restrictions on bytes allowed within lines. In addition, if the final byte of an input file is not a newline, GNU `sort' silently supplies one. A line's trailing newline is not part of the line for comparison purposes. Exit status: 0 if no error occurred 1 if invoked with `-c' or `-C' and the input is not sorted 2 if an error occurred If the environment variable `TMPDIR' is set, `sort' uses its value as the directory for temporary files instead of `/tmp'. The `--temporary-directory' (`-T') option in turn overrides the environment variable. The following options affect the ordering of output lines. They may be specified globally or as part of a specific key field. If no key fields are specified, global options apply to comparison of entire lines; otherwise the global options are inherited by key fields that do not specify any special options of their own. In pre-POSIX versions of `sort', global options affect only later key fields, so portable shell scripts should specify global options first. `-b' `--ignore-leading-blanks' Ignore leading blanks when finding sort keys in each line. By default a blank is a space or a tab, but the `LC_CTYPE' locale can change this. Note blanks may be ignored by your locale's collating rules, but without this option they will be significant for character positions specified in keys with the `-k' option. `-d' `--dictionary-order' Sort in "phone directory" order: ignore all characters except letters, digits and blanks when sorting. By default letters and digits are those of ASCII and a blank is a space or a tab, but the `LC_CTYPE' locale can change this. `-f' `--ignore-case' Fold lowercase characters into the equivalent uppercase characters when comparing so that, for example, `b' and `B' sort as equal. The `LC_CTYPE' locale determines character types. When used with `--unique' those lower case equivalent lines are thrown away. (There is currently no way to throw away the upper case equivalent instead. (Any `--reverse' given would only affect the final result, after the throwing away.)) `-g' `--general-numeric-sort' `--sort=general-numeric' Sort numerically, converting a prefix of each line to a long double-precision floating point number. *Note Floating point::. Do not report overflow, underflow, or conversion errors. Use the following collating sequence: * Lines that do not start with numbers (all considered to be equal). * NaNs ("Not a Number" values, in IEEE floating point arithmetic) in a consistent but machine-dependent order. * Minus infinity. * Finite numbers in ascending numeric order (with -0 and +0 equal). * Plus infinity. Use this option only if there is no alternative; it is much slower than `--numeric-sort' (`-n') and it can lose information when converting to floating point. `-h' `--human-numeric-sort' `--sort=human-numeric' Sort numerically, first by numeric sign (negative, zero, or positive); then by SI suffix (either empty, or `k' or `K', or one of `MGTPEZY', in that order; *note Block size::); and finally by numeric value. For example, `1023M' sorts before `1G' because `M' (mega) precedes `G' (giga) as an SI suffix. This option sorts values that are consistently scaled to the nearest suffix, regardless of whether suffixes denote powers of 1000 or 1024, and it therefore sorts the output of any single invocation of the `df', `du', or `ls' commands that are invoked with their `--human-readable' or `--si' options. The syntax for numbers is the same as for the `--numeric-sort' option; the SI suffix must immediately follow the number. `-i' `--ignore-nonprinting' Ignore nonprinting characters. The `LC_CTYPE' locale determines character types. This option has no effect if the stronger `--dictionary-order' (`-d') option is also given. `-M' `--month-sort' `--sort=month' An initial string, consisting of any amount of blanks, followed by a month name abbreviation, is folded to UPPER case and compared in the order `JAN' < `FEB' < ... < `DEC'. Invalid names compare low to valid names. The `LC_TIME' locale category determines the month spellings. By default a blank is a space or a tab, but the `LC_CTYPE' locale can change this. `-n' `--numeric-sort' `--sort=numeric' Sort numerically. The number begins each line and consists of optional blanks, an optional `-' sign, and zero or more digits possibly separated by thousands separators, optionally followed by a decimal-point character and zero or more digits. An empty number is treated as `0'. The `LC_NUMERIC' locale specifies the decimal-point character and thousands separator. By default a blank is a space or a tab, but the `LC_CTYPE' locale can change this. Comparison is exact; there is no rounding error. Neither a leading `+' nor exponential notation is recognized. To compare such strings numerically, use the `--general-numeric-sort' (`-g') option. `-V' `--version-sort' Sort by version name and number. It behaves like a standard sort, except that each sequence of decimal digits is treated numerically as an index/version number. (*Note Details about version sort::.) `-r' `--reverse' Reverse the result of comparison, so that lines with greater key values appear earlier in the output instead of later. `-R' `--random-sort' `--sort=random' Sort by hashing the input keys and then sorting the hash values. Choose the hash function at random, ensuring that it is free of collisions so that differing keys have differing hash values. This is like a random permutation of the inputs (*note shuf invocation::), except that keys with the same value sort together. If multiple random sort fields are specified, the same random hash function is used for all fields. To use different random hash functions for different fields, you can invoke `sort' more than once. The choice of hash function is affected by the `--random-source' option. Other options are: `--compress-program=PROG' Compress any temporary files with the program PROG. With no arguments, PROG must compress standard input to standard output, and when given the `-d' option it must decompress standard input to standard output. Terminate with an error if PROG exits with nonzero status. White space and the backslash character should not appear in PROG; they are reserved for future use. `--files0-from=FILE' Disallow processing files named on the command line, and instead process those named in file FILE; each name being terminated by a zero byte (ASCII NUL). This is useful when the list of file names is so long that it may exceed a command line length limitation. In such cases, running `sort' via `xargs' is undesirable because it splits the list into pieces and makes `sort' print sorted output for each sublist rather than for the entire list. One way to produce a list of ASCII NUL terminated file names is with GNU `find', using its `-print0' predicate. If FILE is `-' then the ASCII NUL terminated file names are read from standard input. `-k POS1[,POS2]' `--key=POS1[,POS2]' Specify a sort field that consists of the part of the line between POS1 and POS2 (or the end of the line, if POS2 is omitted), _inclusive_. Each POS has the form `F[.C][OPTS]', where F is the number of the field to use, and C is the number of the first character from the beginning of the field. Fields and character positions are numbered starting with 1; a character position of zero in POS2 indicates the field's last character. If `.C' is omitted from POS1, it defaults to 1 (the beginning of the field); if omitted from POS2, it defaults to 0 (the end of the field). OPTS are ordering options, allowing individual keys to be sorted according to different rules; see below for details. Keys can span multiple fields. Example: To sort on the second field, use `--key=2,2' (`-k 2,2'). See below for more notes on keys and more examples. See also the `--debug' option to help determine the part of the line being used in the sort. `--debug' Highlight the portion of each line used for sorting. Also issue warnings about questionable usage to stderr. `--batch-size=NMERGE' Merge at most NMERGE inputs at once. When `sort' has to merge more than NMERGE inputs, it merges them in groups of NMERGE, saving the result in a temporary file, which is then used as an input in a subsequent merge. A large value of NMERGE may improve merge performance and decrease temporary storage utilization at the expense of increased memory usage and I/O. Conversely a small value of NMERGE may reduce memory requirements and I/O at the expense of temporary storage consumption and merge performance. The value of NMERGE must be at least 2. The default value is currently 16, but this is implementation-dependent and may change in the future. The value of NMERGE may be bounded by a resource limit for open file descriptors. The commands `ulimit -n' or `getconf OPEN_MAX' may display limits for your systems; these limits may be modified further if your program already has some files open, or if the operating system has other limits on the number of open files. If the value of NMERGE exceeds the resource limit, `sort' silently uses a smaller value. `-o OUTPUT-FILE' `--output=OUTPUT-FILE' Write output to OUTPUT-FILE instead of standard output. Normally, `sort' reads all input before opening OUTPUT-FILE, so you can safely sort a file in place by using commands like `sort -o F F' and `cat F | sort -o F'. However, `sort' with `--merge' (`-m') can open the output file before reading all input, so a command like `cat F | sort -m -o F - G' is not safe as `sort' might start writing `F' before `cat' is done reading it. On newer systems, `-o' cannot appear after an input file if `POSIXLY_CORRECT' is set, e.g., `sort F -o F'. Portable scripts should specify `-o OUTPUT-FILE' before any input files. `--random-source=FILE' Use FILE as a source of random data used to determine which random hash function to use with the `-R' option. *Note Random sources::. `-s' `--stable' Make `sort' stable by disabling its last-resort comparison. This option has no effect if no fields or global ordering options other than `--reverse' (`-r') are specified. `-S SIZE' `--buffer-size=SIZE' Use a main-memory sort buffer of the given SIZE. By default, SIZE is in units of 1024 bytes. Appending `%' causes SIZE to be interpreted as a percentage of physical memory. Appending `K' multiplies SIZE by 1024 (the default), `M' by 1,048,576, `G' by 1,073,741,824, and so on for `T', `P', `E', `Z', and `Y'. Appending `b' causes SIZE to be interpreted as a byte count, with no multiplication. This option can improve the performance of `sort' by causing it to start with a larger or smaller sort buffer than the default. However, this option affects only the initial buffer size. The buffer grows beyond SIZE if `sort' encounters input lines larger than SIZE. `-t SEPARATOR' `--field-separator=SEPARATOR' Use character SEPARATOR as the field separator when finding the sort keys in each line. By default, fields are separated by the empty string between a non-blank character and a blank character. By default a blank is a space or a tab, but the `LC_CTYPE' locale can change this. That is, given the input line ` foo bar', `sort' breaks it into fields ` foo' and ` bar'. The field separator is not considered to be part of either the field preceding or the field following, so with `sort -t " "' the same input line has three fields: an empty field, `foo', and `bar'. However, fields that extend to the end of the line, as `-k 2', or fields consisting of a range, as `-k 2,3', retain the field separators present between the endpoints of the range. To specify ASCII NUL as the field separator, use the two-character string `\0', e.g., `sort -t '\0''. `-T TEMPDIR' `--temporary-directory=TEMPDIR' Use directory TEMPDIR to store temporary files, overriding the `TMPDIR' environment variable. If this option is given more than once, temporary files are stored in all the directories given. If you have a large sort or merge that is I/O-bound, you can often improve performance by using this option to specify directories on different disks and controllers. `--parallel=N' Set the number of sorts run in parallel to N. By default, N is set to the number of available processors, but limited to 8, as there are diminishing performance gains after that. Note also that using N threads increases the memory usage by a factor of log N. Also see *note nproc invocation::. `-u' `--unique' Normally, output only the first of a sequence of lines that compare equal. For the `--check' (`-c' or `-C') option, check that no pair of consecutive lines compares equal. This option also disables the default last-resort comparison. The commands `sort -u' and `sort | uniq' are equivalent, but this equivalence does not extend to arbitrary `sort' options. For example, `sort -n -u' inspects only the value of the initial numeric string when checking for uniqueness, whereas `sort -n | uniq' inspects the entire line. *Note uniq invocation::. `-z' `--zero-terminated' Delimit items with a zero byte rather than a newline (ASCII LF). I.e., treat input as items separated by ASCII NUL and terminate output items with ASCII NUL. This option can be useful in conjunction with `perl -0' or `find -print0' and `xargs -0' which do the same in order to reliably handle arbitrary file names (even those containing blanks or other special characters). Historical (BSD and System V) implementations of `sort' have differed in their interpretation of some options, particularly `-b', `-f', and `-n'. GNU sort follows the POSIX behavior, which is usually (but not always!) like the System V behavior. According to POSIX, `-n' no longer implies `-b'. For consistency, `-M' has been changed in the same way. This may affect the meaning of character positions in field specifications in obscure cases. The only fix is to add an explicit `-b'. A position in a sort field specified with `-k' may have any of the option letters `MbdfghinRrV' appended to it, in which case no global ordering options are inherited by that particular field. The `-b' option may be independently attached to either or both of the start and end positions of a field specification, and if it is inherited from the global options it will be attached to both. If input lines can contain leading or adjacent blanks and `-t' is not used, then `-k' is typically combined with `-b' or an option that implicitly ignores leading blanks (`Mghn') as otherwise the varying numbers of leading blanks in fields can cause confusing results. If the start position in a sort field specifier falls after the end of the line or after the end field, the field is empty. If the `-b' option was specified, the `.C' part of a field specification is counted from the first nonblank character of the field. On older systems, `sort' supports an obsolete origin-zero syntax `+POS1 [-POS2]' for specifying sort keys. The obsolete sequence `sort +A.X -B.Y' is equivalent to `sort -k A+1.X+1,B' if Y is `0' or absent, otherwise it is equivalent to `sort -k A+1.X+1,B+1.Y'. This obsolete behavior can be enabled or disabled with the `_POSIX2_VERSION' environment variable (*note Standards conformance::); it can also be enabled when `POSIXLY_CORRECT' is not set by using the obsolete syntax with `-POS2' present. Scripts intended for use on standard hosts should avoid obsolete syntax and should use `-k' instead. For example, avoid `sort +2', since it might be interpreted as either `sort ./+2' or `sort -k 3'. If your script must also run on hosts that support only the obsolete syntax, it can use a test like `if sort -k 1 /dev/null 2>&1; then ...' to decide which syntax to use. Here are some examples to illustrate various combinations of options. * Sort in descending (reverse) numeric order. sort -n -r * Run no more than 4 sorts concurrently, using a buffer size of 10M. sort --parallel=4 -S 10M * Sort alphabetically, omitting the first and second fields and the blanks at the start of the third field. This uses a single key composed of the characters beginning at the start of the first nonblank character in field three and extending to the end of each line. sort -k 3b * Sort numerically on the second field and resolve ties by sorting alphabetically on the third and fourth characters of field five. Use `:' as the field delimiter. sort -t : -k 2,2n -k 5.3,5.4 Note that if you had written `-k 2n' instead of `-k 2,2n' `sort' would have used all characters beginning in the second field and extending to the end of the line as the primary _numeric_ key. For the large majority of applications, treating keys spanning more than one field as numeric will not do what you expect. Also note that the `n' modifier was applied to the field-end specifier for the first key. It would have been equivalent to specify `-k 2n,2' or `-k 2n,2n'. All modifiers except `b' apply to the associated _field_, regardless of whether the modifier character is attached to the field-start and/or the field-end part of the key specifier. * Sort the password file on the fifth field and ignore any leading blanks. Sort lines with equal values in field five on the numeric user ID in field three. Fields are separated by `:'. sort -t : -k 5b,5 -k 3,3n /etc/passwd sort -t : -n -k 5b,5 -k 3,3 /etc/passwd sort -t : -b -k 5,5 -k 3,3n /etc/passwd These three commands have equivalent effect. The first specifies that the first key's start position ignores leading blanks and the second key is sorted numerically. The other two commands rely on global options being inherited by sort keys that lack modifiers. The inheritance works in this case because `-k 5b,5b' and `-k 5b,5' are equivalent, as the location of a field-end lacking a `.C' character position is not affected by whether initial blanks are skipped. * Sort a set of log files, primarily by IPv4 address and secondarily by time stamp. If two lines' primary and secondary keys are identical, output the lines in the same order that they were input. The log files contain lines that look like this: 4.150.156.3 - - [01/Apr/2004:06:31:51 +0000] message 1 211.24.3.231 - - [24/Apr/2004:20:17:39 +0000] message 2 Fields are separated by exactly one space. Sort IPv4 addresses lexicographically, e.g., 212.61.52.2 sorts before 212.129.233.201 because 61 is less than 129. sort -s -t ' ' -k 4.9n -k 4.5M -k 4.2n -k 4.14,4.21 file*.log | sort -s -t '.' -k 1,1n -k 2,2n -k 3,3n -k 4,4n This example cannot be done with a single `sort' invocation, since IPv4 address components are separated by `.' while dates come just after a space. So it is broken down into two invocations of `sort': the first sorts by time stamp and the second by IPv4 address. The time stamp is sorted by year, then month, then day, and finally by hour-minute-second field, using `-k' to isolate each field. Except for hour-minute-second there's no need to specify the end of each key field, since the `n' and `M' modifiers sort based on leading prefixes that cannot cross field boundaries. The IPv4 addresses are sorted lexicographically. The second sort uses `-s' so that ties in the primary key are broken by the secondary key; the first sort uses `-s' so that the combination of the two sorts is stable. * Generate a tags file in case-insensitive sorted order. find src -type f -print0 | sort -z -f | xargs -0 etags --append The use of `-print0', `-z', and `-0' in this case means that file names that contain blanks or other special characters are not broken up by the sort operation. * Use the common DSU, Decorate Sort Undecorate idiom to sort lines according to their length. awk '{print length, $0}' /etc/passwd | sort -n | cut -f2- -d' ' In general this technique can be used to sort data that the `sort' command does not support, or is inefficient at, sorting directly. * Shuffle a list of directories, but preserve the order of files within each directory. For instance, one could use this to generate a music playlist in which albums are shuffled but the songs of each album are played in order. ls */* | sort -t / -k 1,1R -k 2,2 ---------- Footnotes ---------- (1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to `en_US'), then `sort' may produce output that is sorted differently than you're accustomed to. In that case, set the `LC_ALL' environment variable to `C'. Note that setting only `LC_COLLATE' has two problems. First, it is ineffective if `LC_ALL' is also set. Second, it has undefined behavior if `LC_CTYPE' (or `LANG', if `LC_CTYPE' is unset) is set to an incompatible value. For example, you get undefined behavior if `LC_CTYPE' is `ja_JP.PCK' but `LC_COLLATE' is `en_US.UTF-8'. 7.2 `shuf': Shuffling text ========================== `shuf' shuffles its input by outputting a random permutation of its input lines. Each output permutation is equally likely. Synopses: shuf [OPTION]... [FILE] shuf -e [OPTION]... [ARG]... shuf -i LO-HI [OPTION]... `shuf' has three modes of operation that affect where it obtains its input lines. By default, it reads lines from standard input. The following options change the operation mode: `-e' `--echo' Treat each command-line operand as an input line. `-i LO-HI' `--input-range=LO-HI' Act as if input came from a file containing the range of unsigned decimal integers LO...HI, one per line. `shuf''s other options can affect its behavior in all operation modes: `-n LINES' `--head-count=COUNT' Output at most COUNT lines. By default, all input lines are output. `-o OUTPUT-FILE' `--output=OUTPUT-FILE' Write output to OUTPUT-FILE instead of standard output. `shuf' reads all input before opening OUTPUT-FILE, so you can safely shuffle a file in place by using commands like `shuf -o F out $ dd bs=1 skip=222 count=6 < out 2>/dev/null; echo deeper Note that although the listing above includes a trailing slash for the `deeper' entry, the offsets select the name without the trailing slash. However, if you invoke `ls' with `--dired' along with an option like `--escape' (aka `-b') and operate on a file whose name contains special characters, notice that the backslash _is_ included: $ touch 'a b' $ ls -blog --dired 'a b' -rw-r--r-- 1 0 Jun 10 12:28 a\ b //DIRED// 30 34 //DIRED-OPTIONS// --quoting-style=escape If you use a quoting style that adds quote marks (e.g., `--quoting-style=c'), then the offsets include the quote marks. So beware that the user may select the quoting style via the environment variable `QUOTING_STYLE'. Hence, applications using `--dired' should either specify an explicit `--quoting-style=literal' option (aka `-N' or `--literal') on the command line, or else be prepared to parse the escaped names. `--full-time' Produce long format directory listings, and list times in full. It is equivalent to using `--format=long' with `--time-style=full-iso' (*note Formatting file timestamps::). `-g' Produce long format directory listings, but don't display owner information. `-G' `--no-group' Inhibit display of group information in a long format directory listing. (This is the default in some non-GNU versions of `ls', so we provide this option for compatibility.) `-h' `--human-readable' Append a size letter to each size, such as `M' for mebibytes. Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes. This option is equivalent to `--block-size=human-readable'. Use the `--si' option if you prefer powers of 1000. `-i' `--inode' Print the inode number (also called the file serial number and index number) of each file to the left of the file name. (This number uniquely identifies each file within a particular file system.) `-l' `--format=long' `--format=verbose' In addition to the name of each file, print the file type, file mode bits, number of hard links, owner name, group name, size, and timestamp (*note Formatting file timestamps::), normally the modification time. Print question marks for information that cannot be determined. Normally the size is printed as a byte count without punctuation, but this can be overridden (*note Block size::). For example, `-h' prints an abbreviated, human-readable count, and `--block-size="'1"' prints a byte count with the thousands separator of the current locale. For each directory that is listed, preface the files with a line `total BLOCKS', where BLOCKS is the total disk allocation for all files in that directory. The block size currently defaults to 1024 bytes, but this can be overridden (*note Block size::). The BLOCKS computed counts each hard link separately; this is arguably a deficiency. The file type is one of the following characters: `-' regular file `b' block special file `c' character special file `C' high performance ("contiguous data") file `d' directory `D' door (Solaris 2.5 and up) `l' symbolic link `M' off-line ("migrated") file (Cray DMF) `n' network special file (HP-UX) `p' FIFO (named pipe) `P' port (Solaris 10 and up) `s' socket `?' some other file type The file mode bits listed are similar to symbolic mode specifications (*note Symbolic Modes::). But `ls' combines multiple bits into the third character of each set of permissions as follows: `s' If the set-user-ID or set-group-ID bit and the corresponding executable bit are both set. `S' If the set-user-ID or set-group-ID bit is set but the corresponding executable bit is not set. `t' If the restricted deletion flag or sticky bit, and the other-executable bit, are both set. The restricted deletion flag is another name for the sticky bit. *Note Mode Structure::. `T' If the restricted deletion flag or sticky bit is set but the other-executable bit is not set. `x' If the executable bit is set and none of the above apply. `-' Otherwise. Following the file mode bits is a single character that specifies whether an alternate access method such as an access control list applies to the file. When the character following the file mode bits is a space, there is no alternate access method. When it is a printing character, then there is such a method. GNU `ls' uses a `.' character to indicate a file with an SELinux security context, but no other alternate access method. A file with any other combination of alternate access methods is marked with a `+' character. `-n' `--numeric-uid-gid' Produce long format directory listings, but display numeric user and group IDs instead of the owner and group names. `-o' Produce long format directory listings, but don't display group information. It is equivalent to using `--format=long' with `--no-group' . `-s' `--size' Print the disk allocation of each file to the left of the file name. This is the amount of disk space used by the file, which is usually a bit more than the file's size, but it can be less if the file has holes. Normally the disk allocation is printed in units of 1024 bytes, but this can be overridden (*note Block size::). For files that are NFS-mounted from an HP-UX system to a BSD system, this option reports sizes that are half the correct values. On HP-UX systems, it reports sizes that are twice the correct values for files that are NFS-mounted from BSD systems. This is due to a flaw in HP-UX; it also affects the HP-UX `ls' program. `--si' Append an SI-style abbreviation to each size, such as `M' for megabytes. Powers of 1000 are used, not 1024; `M' stands for 1,000,000 bytes. This option is equivalent to `--block-size=si'. Use the `-h' or `--human-readable' option if you prefer powers of 1024. `-Z' `--context' Display the SELinux security context or `?' if none is found. When used with the `-l' option, print the security context to the left of the size column. 10.1.3 Sorting the output ------------------------- These options change the order in which `ls' sorts the information it outputs. By default, sorting is done by character code (e.g., ASCII order). `-c' `--time=ctime' `--time=status' If the long listing format (e.g., `-l', `-o') is being used, print the status change time (the `ctime' in the inode) instead of the modification time. When explicitly sorting by time (`--sort=time' or `-t') or when not using a long listing format, sort according to the status change time. `-f' Primarily, like `-U'--do not sort; list the files in whatever order they are stored in the directory. But also enable `-a' (list all files) and disable `-l', `--color', and `-s' (if they were specified before the `-f'). `-r' `--reverse' Reverse whatever the sorting method is--e.g., list files in reverse alphabetical order, youngest first, smallest first, or whatever. `-S' `--sort=size' Sort by file size, largest first. `-t' `--sort=time' Sort by modification time (the `mtime' in the inode), newest first. `-u' `--time=atime' `--time=access' `--time=use' If the long listing format (e.g., `--format=long') is being used, print the last access time (the `atime' in the inode). When explicitly sorting by time (`--sort=time' or `-t') or when not using a long listing format, sort according to the access time. `-U' `--sort=none' Do not sort; list the files in whatever order they are stored in the directory. (Do not do any of the other unrelated things that `-f' does.) This is especially useful when listing very large directories, since not doing any sorting can be noticeably faster. `-v' `--sort=version' Sort by version name and number, lowest first. It behaves like a default sort, except that each sequence of decimal digits is treated numerically as an index/version number. (*Note Details about version sort::.) `-X' `--sort=extension' Sort directory contents alphabetically by file extension (characters after the last `.'); files with no extension are sorted first. 10.1.4 Details about version sort --------------------------------- Version sorting handles the fact that file names frequently include indices or version numbers. Standard sorting usually does not produce the order that one expects because comparisons are made on a character-by-character basis. Version sorting is especially useful when browsing directories that contain many files with indices/version numbers in their names: $ ls -1 $ ls -1v abc.zml-1.gz abc.zml-1.gz abc.zml-12.gz abc.zml-2.gz abc.zml-2.gz abc.zml-12.gz Version-sorted strings are compared such that if VER1 and VER2 are version numbers and PREFIX and SUFFIX (SUFFIX matching the regular expression `(\.[A-Za-z~][A-Za-z0-9~]*)*') are strings then VER1 < VER2 implies that the name composed of "PREFIX VER1 SUFFIX" sorts before "PREFIX VER2 SUFFIX". Note also that leading zeros of numeric parts are ignored: $ ls -1 $ ls -1v abc-1.007.tgz abc-1.01a.tgz abc-1.012b.tgz abc-1.007.tgz abc-1.01a.tgz abc-1.012b.tgz This functionality is implemented using gnulib's `filevercmp' function, which has some caveats worth noting. * `LC_COLLATE' is ignored, which means `ls -v' and `sort -V' will sort non-numeric prefixes as if the `LC_COLLATE' locale category was set to `C'. * Some suffixes will not be matched by the regular expression mentioned above. Consequently these examples may not sort as you expect: abc-1.2.3.4.7z abc-1.2.3.7z abc-1.2.3.4.x86_64.rpm abc-1.2.3.x86_64.rpm 10.1.5 General output formatting -------------------------------- These options affect the appearance of the overall output. `-1' `--format=single-column' List one file per line. This is the default for `ls' when standard output is not a terminal. `-C' `--format=vertical' List files in columns, sorted vertically. This is the default for `ls' if standard output is a terminal. It is always the default for the `dir' program. GNU `ls' uses variable width columns to display as many files as possible in the fewest lines. `--color [=WHEN]' Specify whether to use color for distinguishing file types. WHEN may be omitted, or one of: * none - Do not use color at all. This is the default. * auto - Only use color if standard output is a terminal. * always - Always use color. Specifying `--color' and no WHEN is equivalent to `--color=always'. Piping a colorized listing through a pager like `more' or `less' usually produces unreadable results. However, using `more -f' does seem to work. Note that using the `--color' option may incur a noticeable performance penalty when run in a directory with very many entries, because the default settings require that `ls' `stat' every single file it lists. However, if you would like most of the file-type coloring but can live without the other coloring options (e.g., executable, orphan, sticky, other-writable, capability), use `dircolors' to set the `LS_COLORS' environment variable like this, eval $(dircolors -p | perl -pe \ 's/^((CAP|S[ET]|O[TR]|M|E)\w+).*/$1 00/' | dircolors -) and on a `dirent.d_type'-capable file system, `ls' will perform only one `stat' call per command line argument. `-F' `--classify' `--indicator-style=classify' Append a character to each file name indicating the file type. Also, for regular files that are executable, append `*'. The file type indicators are `/' for directories, `@' for symbolic links, `|' for FIFOs, `=' for sockets, `>' for doors, and nothing for regular files. Do not follow symbolic links listed on the command line unless the `--dereference-command-line' (`-H'), `--dereference' (`-L'), or `--dereference-command-line-symlink-to-dir' options are specified. `--file-type' `--indicator-style=file-type' Append a character to each file name indicating the file type. This is like `-F', except that executables are not marked. `--indicator-style=WORD' Append a character indicator with style WORD to entry names, as follows: `none' Do not append any character indicator; this is the default. `slash' Append `/' for directories. This is the same as the `-p' option. `file-type' Append `/' for directories, `@' for symbolic links, `|' for FIFOs, `=' for sockets, and nothing for regular files. This is the same as the `--file-type' option. `classify' Append `*' for executable regular files, otherwise behave as for `file-type'. This is the same as the `-F' or `--classify' option. `-k' `--kibibytes' Set the default block size to its normal value of 1024 bytes, overriding any contrary specification in environment variables (*note Block size::). This option is in turn overridden by the `--block-size', `-h' or `--human-readable', and `--si' options. The `-k' or `--kibibytes' option affects the per-directory block count written by the `-l' and similar options, and the size written by the `-s' or `--size' option. It does not affect the file size written by `-l'. `-m' `--format=commas' List files horizontally, with as many as will fit on each line, separated by `, ' (a comma and a space). `-p' `--indicator-style=slash' Append a `/' to directory names. `-x' `--format=across' `--format=horizontal' List the files in columns, sorted horizontally. `-T COLS' `--tabsize=COLS' Assume that each tab stop is COLS columns wide. The default is 8. `ls' uses tabs where possible in the output, for efficiency. If COLS is zero, do not use tabs at all. Some terminal emulators (at least Apple Terminal 1.5 (133) from Mac OS X 10.4.8) do not properly align columns to the right of a TAB following a non-ASCII byte. If you use such a terminal emulator, use the `-T0' option or put `TABSIZE=0' in your environment to tell `ls' to align using spaces, not tabs. `-w' `--width=COLS' Assume the screen is COLS columns wide. The default is taken from the terminal settings if possible; otherwise the environment variable `COLUMNS' is used if it is set; otherwise the default is 80. 10.1.6 Formatting file timestamps --------------------------------- By default, file timestamps are listed in abbreviated form, using a date like `Mar 30 2002' for non-recent timestamps, and a date-without-year and time like `Mar 30 23:45' for recent timestamps. This format can change depending on the current locale as detailed below. A timestamp is considered to be "recent" if it is less than six months old, and is not dated in the future. If a timestamp dated today is not listed in recent form, the timestamp is in the future, which means you probably have clock skew problems which may break programs like `make' that rely on file timestamps. Time stamps are listed according to the time zone rules specified by the `TZ' environment variable, or by the system default rules if `TZ' is not set. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. The following option changes how file timestamps are printed. `--time-style=STYLE' List timestamps in style STYLE. The STYLE should be one of the following: `+FORMAT' List timestamps using FORMAT, where FORMAT is interpreted like the format argument of `date' (*note date invocation::). For example, `--time-style="+%Y-%m-%d %H:%M:%S"' causes `ls' to list timestamps like `2002-03-30 23:45:56'. As with `date', FORMAT's interpretation is affected by the `LC_TIME' locale category. If FORMAT contains two format strings separated by a newline, the former is used for non-recent files and the latter for recent files; if you want output columns to line up, you may need to insert spaces in one of the two formats. `full-iso' List timestamps in full using ISO 8601 date, time, and time zone format with nanosecond precision, e.g., `2002-03-30 23:45:56.477817180 -0700'. This style is equivalent to `+%Y-%m-%d %H:%M:%S.%N %z'. This is useful because the time output includes all the information that is available from the operating system. For example, this can help explain `make''s behavior, since GNU `make' uses the full timestamp to determine whether a file is out of date. `long-iso' List ISO 8601 date and time in minutes, e.g., `2002-03-30 23:45'. These timestamps are shorter than `full-iso' timestamps, and are usually good enough for everyday work. This style is equivalent to `+%Y-%m-%d %H:%M'. `iso' List ISO 8601 dates for non-recent timestamps (e.g., `2002-03-30 '), and ISO 8601 month, day, hour, and minute for recent timestamps (e.g., `03-30 23:45'). These timestamps are uglier than `long-iso' timestamps, but they carry nearly the same information in a smaller space and their brevity helps `ls' output fit within traditional 80-column output lines. The following two `ls' invocations are equivalent: newline=' ' ls -l --time-style="+%Y-%m-%d $newline%m-%d %H:%M" ls -l --time-style="iso" `locale' List timestamps in a locale-dependent form. For example, a Finnish locale might list non-recent timestamps like `maalis 30 2002' and recent timestamps like `maalis 30 23:45'. Locale-dependent timestamps typically consume more space than `iso' timestamps and are harder for programs to parse because locale conventions vary so widely, but they are easier for many people to read. The `LC_TIME' locale category specifies the timestamp format. The default POSIX locale uses timestamps like `Mar 30 2002' and `Mar 30 23:45'; in this locale, the following two `ls' invocations are equivalent: newline=' ' ls -l --time-style="+%b %e %Y$newline%b %e %H:%M" ls -l --time-style="locale" Other locales behave differently. For example, in a German locale, `--time-style="locale"' might be equivalent to `--time-style="+%e. %b %Y $newline%e. %b %H:%M"' and might generate timestamps like `30. Ma"r 2002 ' and `30. Ma"r 23:45'. `posix-STYLE' List POSIX-locale timestamps if the `LC_TIME' locale category is POSIX, STYLE timestamps otherwise. For example, the `posix-long-iso' style lists timestamps like `Mar 30 2002' and `Mar 30 23:45' when in the POSIX locale, and like `2002-03-30 23:45' otherwise. You can specify the default value of the `--time-style' option with the environment variable `TIME_STYLE'; if `TIME_STYLE' is not set the default style is `locale'. GNU Emacs 21.3 and later use the `--dired' option and therefore can parse any date format, but if you are using Emacs 21.1 or 21.2 and specify a non-POSIX locale you may need to set `TIME_STYLE="posix-long-iso"'. To avoid certain denial-of-service attacks, timestamps that would be longer than 1000 bytes may be treated as errors. 10.1.7 Formatting the file names -------------------------------- These options change how file names themselves are printed. `-b' `--escape' `--quoting-style=escape' Quote nongraphic characters in file names using alphabetic and octal backslash sequences like those used in C. `-N' `--literal' `--quoting-style=literal' Do not quote file names. However, with `ls' nongraphic characters are still printed as question marks if the output is a terminal and you do not specify the `--show-control-chars' option. `-q' `--hide-control-chars' Print question marks instead of nongraphic characters in file names. This is the default if the output is a terminal and the program is `ls'. `-Q' `--quote-name' `--quoting-style=c' Enclose file names in double quotes and quote nongraphic characters as in C. `--quoting-style=WORD' Use style WORD to quote file names and other strings that may contain arbitrary characters. The WORD should be one of the following: `literal' Output strings as-is; this is the same as the `-N' or `--literal' option. `shell' Quote strings for the shell if they contain shell metacharacters or would cause ambiguous output. The quoting is suitable for POSIX-compatible shells like `bash', but it does not always work for incompatible shells like `csh'. `shell-always' Quote strings for the shell, even if they would normally not require quoting. `c' Quote strings as for C character string literals, including the surrounding double-quote characters; this is the same as the `-Q' or `--quote-name' option. `escape' Quote strings as for C character string literals, except omit the surrounding double-quote characters; this is the same as the `-b' or `--escape' option. `clocale' Quote strings as for C character string literals, except use surrounding quotation marks appropriate for the locale. `locale' Quote strings as for C character string literals, except use surrounding quotation marks appropriate for the locale, and quote 'like this' instead of "like this" in the default C locale. This looks nicer on many displays. You can specify the default value of the `--quoting-style' option with the environment variable `QUOTING_STYLE'. If that environment variable is not set, the default value is `literal', but this default may change to `shell' in a future version of this package. `--show-control-chars' Print nongraphic characters as-is in file names. This is the default unless the output is a terminal and the program is `ls'. 10.2 `dir': Briefly list directory contents =========================================== `dir' is equivalent to `ls -C -b'; that is, by default files are listed in columns, sorted vertically, and special characters are represented by backslash escape sequences. *Note `ls': ls invocation. 10.3 `vdir': Verbosely list directory contents ============================================== `vdir' is equivalent to `ls -l -b'; that is, by default files are listed in long format and special characters are represented by backslash escape sequences. 10.4 `dircolors': Color setup for `ls' ====================================== `dircolors' outputs a sequence of shell commands to set up the terminal for color output from `ls' (and `dir', etc.). Typical usage: eval "$(dircolors [OPTION]... [FILE])" If FILE is specified, `dircolors' reads it to determine which colors to use for which file types and extensions. Otherwise, a precompiled database is used. For details on the format of these files, run `dircolors --print-database'. To make `dircolors' read a `~/.dircolors' file if it exists, you can put the following lines in your `~/.bashrc' (or adapt them to your favorite shell): d=.dircolors test -r $d && eval "$(dircolors $d)" The output is a shell command to set the `LS_COLORS' environment variable. You can specify the shell syntax to use on the command line, or `dircolors' will guess it from the value of the `SHELL' environment variable. The program accepts the following options. Also see *note Common options::. `-b' `--sh' `--bourne-shell' Output Bourne shell commands. This is the default if the `SHELL' environment variable is set and does not end with `csh' or `tcsh'. `-c' `--csh' `--c-shell' Output C shell commands. This is the default if `SHELL' ends with `csh' or `tcsh'. `-p' `--print-database' Print the (compiled-in) default color configuration database. This output is itself a valid configuration file, and is fairly descriptive of the possibilities. An exit status of zero indicates success, and a nonzero value indicates failure. 11 Basic operations ******************* This chapter describes the commands for basic file manipulation: copying, moving (renaming), and deleting (removing). 11.1 `cp': Copy files and directories ===================================== `cp' copies files (or, optionally, directories). The copy is completely independent of the original. You can either copy one file to another, or copy arbitrarily many files to a destination directory. Synopses: cp [OPTION]... [-T] SOURCE DEST cp [OPTION]... SOURCE... DIRECTORY cp [OPTION]... -t DIRECTORY SOURCE... * If two file names are given, `cp' copies the first file to the second. * If the `--target-directory' (`-t') option is given, or failing that if the last file is a directory and the `--no-target-directory' (`-T') option is not given, `cp' copies each SOURCE file to the specified directory, using the SOURCEs' names. Generally, files are written just as they are read. For exceptions, see the `--sparse' option below. By default, `cp' does not copy directories. However, the `-R', `-a', and `-r' options cause `cp' to copy recursively by descending into source directories and copying files to corresponding destination directories. When copying from a symbolic link, `cp' normally follows the link only when not copying recursively. This default can be overridden with the `--archive' (`-a'), `-d', `--dereference' (`-L'), `--no-dereference' (`-P'), and `-H' options. If more than one of these options is specified, the last one silently overrides the others. When copying to a symbolic link, `cp' follows the link only when it refers to an existing regular file. However, when copying to a dangling symbolic link, `cp' refuses by default, and fails with a diagnostic, since the operation is inherently dangerous. This behavior is contrary to historical practice and to POSIX. Set `POSIXLY_CORRECT' to make `cp' attempt to create the target of a dangling destination symlink, in spite of the possible risk. Also, when an option like `--backup' or `--link' acts to rename or remove the destination before copying, `cp' renames or removes the symbolic link rather than the file it points to. By default, `cp' copies the contents of special files only when not copying recursively. This default can be overridden with the `--copy-contents' option. `cp' generally refuses to copy a file onto itself, with the following exception: if `--force --backup' is specified with SOURCE and DEST identical, and referring to a regular file, `cp' will make a backup file, either regular or numbered, as specified in the usual ways (*note Backup options::). This is useful when you simply want to make a backup of an existing file before changing it. The program accepts the following options. Also see *note Common options::. `-a' `--archive' Preserve as much as possible of the structure and attributes of the original files in the copy (but do not attempt to preserve internal directory structure; i.e., `ls -U' may list the entries in a copied directory in a different order). Try to preserve SELinux security context and extended attributes (xattr), but ignore any failure to do that and print no corresponding diagnostic. Equivalent to `-dR --preserve=all' with the reduced diagnostics. `--attributes-only' Copy only the specified attributes of the source file to the destination. If the destination already exists, do not alter its contents. See the `--preserve' option for controlling which attributes to copy. `-b' `--backup[=METHOD]' *Note Backup options::. Make a backup of each file that would otherwise be overwritten or removed. As a special case, `cp' makes a backup of SOURCE when the force and backup options are given and SOURCE and DEST are the same name for an existing, regular file. One useful application of this combination of options is this tiny Bourne shell script: #!/bin/sh # Usage: backup FILE... # Create a GNU-style backup of each listed FILE. fail=0 for i; do cp --backup --force --preserve=all -- "$i" "$i" || fail=1 done exit $fail `--copy-contents' If copying recursively, copy the contents of any special files (e.g., FIFOs and device files) as if they were regular files. This means trying to read the data in each source file and writing it to the destination. It is usually a mistake to use this option, as it normally has undesirable effects on special files like FIFOs and the ones typically found in the `/dev' directory. In most cases, `cp -R --copy-contents' will hang indefinitely trying to read from FIFOs and special files like `/dev/console', and it will fill up your destination disk if you use it to copy `/dev/zero'. This option has no effect unless copying recursively, and it does not affect the copying of symbolic links. `-d' Copy symbolic links as symbolic links rather than copying the files that they point to, and preserve hard links between source files in the copies. Equivalent to `--no-dereference --preserve=links'. `-f' `--force' When copying without this option and an existing destination file cannot be opened for writing, the copy fails. However, with `--force', when a destination file cannot be opened, `cp' then removes it and tries to open it again. Contrast this behavior with that enabled by `--link' and `--symbolic-link', whereby the destination file is never opened but rather is removed unconditionally. Also see the description of `--remove-destination'. This option is independent of the `--interactive' or `-i' option: neither cancels the effect of the other. This option is ignored when the `--no-clobber' or `-n' option is also used. `-H' If a command line argument specifies a symbolic link, then copy the file it points to rather than the symbolic link itself. However, copy (preserving its nature) any symbolic link that is encountered via recursive traversal. `-i' `--interactive' When copying a file other than a directory, prompt whether to overwrite an existing destination file. The `-i' option overrides a previous `-n' option. `-l' `--link' Make hard links instead of copies of non-directories. `-L' `--dereference' Follow symbolic links when copying from them. With this option, `cp' cannot create a symbolic link. For example, a symlink (to regular file) in the source tree will be copied to a regular file in the destination tree. `-n' `--no-clobber' Do not overwrite an existing file. The `-n' option overrides a previous `-i' option. This option is mutually exclusive with `-b' or `--backup' option. `-P' `--no-dereference' Copy symbolic links as symbolic links rather than copying the files that they point to. This option affects only symbolic links in the source; symbolic links in the destination are always followed if possible. `-p' `--preserve[=ATTRIBUTE_LIST]' Preserve the specified attributes of the original files. If specified, the ATTRIBUTE_LIST must be a comma-separated list of one or more of the following strings: `mode' Preserve the file mode bits and access control lists. `ownership' Preserve the owner and group. On most modern systems, only users with appropriate privileges may change the owner of a file, and ordinary users may preserve the group ownership of a file only if they happen to be a member of the desired group. `timestamps' Preserve the times of last access and last modification, when possible. On older systems, it is not possible to preserve these attributes when the affected file is a symbolic link. However, many systems now provide the `utimensat' function, which makes it possible even for symbolic links. `links' Preserve in the destination files any links between corresponding source files. Note that with `-L' or `-H', this option can convert symbolic links to hard links. For example, $ mkdir c; : > a; ln -s a b; cp -aH a b c; ls -i1 c 74161745 a 74161745 b Note the inputs: `b' is a symlink to regular file `a', yet the files in destination directory, `c/', are hard-linked. Since `-a' implies `--preserve=links', and since `-H' tells `cp' to dereference command line arguments, it sees two files with the same inode number, and preserves the perceived hard link. Here is a similar example that exercises `cp''s `-L' option: $ mkdir b c; (cd b; : > a; ln -s a b); cp -aL b c; ls -i1 c/b 74163295 a 74163295 b `context' Preserve SELinux security context of the file, or fail with full diagnostics. `xattr' Preserve extended attributes of the file, or fail with full diagnostics. If `cp' is built without xattr support, ignore this option. If SELinux context, ACLs or Capabilities are implemented using xattrs, they are preserved implicitly by this option as well, i.e., even without specifying `--preserve=mode' or `--preserve=context'. `all' Preserve all file attributes. Equivalent to specifying all of the above, but with the difference that failure to preserve SELinux security context or extended attributes does not change `cp''s exit status. In contrast to `-a', all but `Operation not supported' warnings are output. Using `--preserve' with no ATTRIBUTE_LIST is equivalent to `--preserve=mode,ownership,timestamps'. In the absence of this option, each destination file is created with the mode bits of the corresponding source file, minus the bits set in the umask and minus the set-user-ID and set-group-ID bits. *Note File permissions::. `--no-preserve=ATTRIBUTE_LIST' Do not preserve the specified attributes. The ATTRIBUTE_LIST has the same form as for `--preserve'. `--parents' Form the name of each destination file by appending to the target directory a slash and the specified name of the source file. The last argument given to `cp' must be the name of an existing directory. For example, the command: cp --parents a/b/c existing_dir copies the file `a/b/c' to `existing_dir/a/b/c', creating any missing intermediate directories. `-R' `-r' `--recursive' Copy directories recursively. By default, do not follow symbolic links in the source; see the `--archive' (`-a'), `-d', `--dereference' (`-L'), `--no-dereference' (`-P'), and `-H' options. Special files are copied by creating a destination file of the same type as the source; see the `--copy-contents' option. It is not portable to use `-r' to copy symbolic links or special files. On some non-GNU systems, `-r' implies the equivalent of `-L' and `--copy-contents' for historical reasons. Also, it is not portable to use `-R' to copy symbolic links unless you also specify `-P', as POSIX allows implementations that dereference symbolic links by default. `--reflink[=WHEN]' Perform a lightweight, copy-on-write (COW) copy, if supported by the file system. Once it has succeeded, beware that the source and destination files share the same disk data blocks as long as they remain unmodified. Thus, if a disk I/O error affects data blocks of one of the files, the other suffers the same fate. The WHEN value can be one of the following: `always' The default behavior: if the copy-on-write operation is not supported then report the failure for each file and exit with a failure status. `auto' If the copy-on-write operation is not supported then fall back to the standard copy behaviour. This option is overridden by the `--link', `--symbolic-link' and `--attributes-only' options, thus allowing it to be used to configure the default data copying behavior for `cp'. For example, with the following alias, `cp' will use the minimum amount of space supported by the file system. alias cp='cp --reflink=auto --sparse=always' `--remove-destination' Remove each existing destination file before attempting to open it (contrast with `-f' above). `--sparse=WHEN' A "sparse file" contains "holes"--a sequence of zero bytes that does not occupy any physical disk blocks; the `read' system call reads these as zeros. This can both save considerable disk space and increase speed, since many binary files contain lots of consecutive zero bytes. By default, `cp' detects holes in input source files via a crude heuristic and makes the corresponding output file sparse as well. Only regular files may be sparse. The WHEN value can be one of the following: `auto' The default behavior: if the input file is sparse, attempt to make the output file sparse, too. However, if an output file exists but refers to a non-regular file, then do not attempt to make it sparse. `always' For each sufficiently long sequence of zero bytes in the input file, attempt to create a corresponding hole in the output file, even if the input file does not appear to be sparse. This is useful when the input file resides on a file system that does not support sparse files (for example, `efs' file systems in SGI IRIX 5.3 and earlier), but the output file is on a type of file system that does support them. Holes may be created only in regular files, so if the destination file is of some other type, `cp' does not even try to make it sparse. `never' Never make the output file sparse. This is useful in creating a file for use with the `mkswap' command, since such a file must not have any holes. `--strip-trailing-slashes' Remove any trailing slashes from each SOURCE argument. *Note Trailing slashes::. `-s' `--symbolic-link' Make symbolic links instead of copies of non-directories. All source file names must be absolute (starting with `/') unless the destination files are in the current directory. This option merely results in an error message on systems that do not support symbolic links. `-S SUFFIX' `--suffix=SUFFIX' Append SUFFIX to each backup file made with `-b'. *Note Backup options::. `-t DIRECTORY' `--target-directory=DIRECTORY' Specify the destination DIRECTORY. *Note Target directory::. `-T' `--no-target-directory' Do not treat the last operand specially when it is a directory or a symbolic link to a directory. *Note Target directory::. `-u' `--update' Do not copy a non-directory that has an existing destination with the same or newer modification time. If time stamps are being preserved, the comparison is to the source time stamp truncated to the resolutions of the destination file system and of the system calls used to update time stamps; this avoids duplicate work if several `cp -pu' commands are executed with the same source and destination. If `--preserve=links' is also specified (like with `cp -au' for example), that will take precedence. Consequently, depending on the order that files are processed from the source, newer files in the destination may be replaced, to mirror hard links in the source. `-v' `--verbose' Print the name of each file before copying it. `-x' `--one-file-system' Skip subdirectories that are on different file systems from the one that the copy started on. However, mount point directories _are_ copied. An exit status of zero indicates success, and a nonzero value indicates failure. 11.2 `dd': Convert and copy a file ================================== `dd' copies a file (from standard input to standard output, by default) with a changeable I/O block size, while optionally performing conversions on it. Synopses: dd [OPERAND]... dd OPTION The only options are `--help' and `--version'. *Note Common options::. `dd' accepts the following operands, whose syntax was inspired by the DD (data definition) statement of OS/360 JCL. `if=FILE' Read from FILE instead of standard input. `of=FILE' Write to FILE instead of standard output. Unless `conv=notrunc' is given, `dd' truncates FILE to zero bytes (or the size specified with `seek='). `ibs=BYTES' Set the input block size to BYTES. This makes `dd' read BYTES per block. The default is 512 bytes. `obs=BYTES' Set the output block size to BYTES. This makes `dd' write BYTES per block. The default is 512 bytes. `bs=BYTES' Set both input and output block sizes to BYTES. This makes `dd' read and write BYTES per block, overriding any `ibs' and `obs' settings. In addition, if no data-transforming `conv' option is specified, input is copied to the output as soon as it's read, even if it is smaller than the block size. `cbs=BYTES' Set the conversion block size to BYTES. When converting variable-length records to fixed-length ones (`conv=block') or the reverse (`conv=unblock'), use BYTES as the fixed record length. `skip=N' Skip N `ibs'-byte blocks in the input file before copying. If `iflag=skip_bytes' is specified, N is interpreted as a byte count rather than a block count. `seek=N' Skip N `obs'-byte blocks in the output file before copying. if `oflag=seek_bytes' is specified, N is interpreted as a byte count rather than a block count. `count=N' Copy N `ibs'-byte blocks from the input file, instead of everything until the end of the file. if `iflag=count_bytes' is specified, N is interpreted as a byte count rather than a block count. Note if the input may return short reads as could be the case when reading from a pipe for example, `iflag=fullblock' will ensure that `count=' corresponds to complete input blocks rather than the traditional POSIX specified behavior of counting input read operations. `status=WHICH' Transfer information is normally output to stderr upon receipt of the `INFO' signal or when `dd' exits. Specifying WHICH will identify which information to suppress. `noxfer' Do not print the transfer rate and volume statistics that normally make up the last status line. `none' Do not print any informational messages to stderr. Error messages are output as normal. `conv=CONVERSION[,CONVERSION]...' Convert the file as specified by the CONVERSION argument(s). (No spaces around any comma(s).) Conversions: `ascii' Convert EBCDIC to ASCII, using the conversion table specified by POSIX. This provides a 1:1 translation for all 256 bytes. `ebcdic' Convert ASCII to EBCDIC. This is the inverse of the `ascii' conversion. `ibm' Convert ASCII to alternate EBCDIC, using the alternate conversion table specified by POSIX. This is not a 1:1 translation, but reflects common historical practice for `~', `[', and `]'. The `ascii', `ebcdic', and `ibm' conversions are mutually exclusive. `block' For each line in the input, output `cbs' bytes, replacing the input newline with a space and padding with spaces as necessary. `unblock' Remove any trailing spaces in each `cbs'-sized input block, and append a newline. The `block' and `unblock' conversions are mutually exclusive. `lcase' Change uppercase letters to lowercase. `ucase' Change lowercase letters to uppercase. The `lcase' and `ucase' conversions are mutually exclusive. `sparse' Try to seek rather than write NUL output blocks. On a file system that supports sparse files, this will create sparse output when extending the output file. Be careful when using this option in conjunction with `conv=notrunc' or `oflag=append'. With `conv=notrunc', existing data in the output file corresponding to NUL blocks from the input, will be untouched. With `oflag=append' the seeks performed will be ineffective. Similarly, when the output is a device rather than a file, NUL input blocks are not copied, and therefore this option is most useful with virtual or pre zeroed devices. `swab' Swap every pair of input bytes. GNU `dd', unlike others, works when an odd number of bytes are read--the last byte is simply copied (since there is nothing to swap it with). `sync' Pad every input block to size of `ibs' with trailing zero bytes. When used with `block' or `unblock', pad with spaces instead of zero bytes. The following "conversions" are really file flags and don't affect internal processing: `excl' Fail if the output file already exists; `dd' must create the output file itself. `nocreat' Do not create the output file; the output file must already exist. The `excl' and `nocreat' conversions are mutually exclusive. `notrunc' Do not truncate the output file. `noerror' Continue after read errors. `fdatasync' Synchronize output data just before finishing. This forces a physical write of output data. `fsync' Synchronize output data and metadata just before finishing. This forces a physical write of output data and metadata. `iflag=FLAG[,FLAG]...' Access the input file using the flags specified by the FLAG argument(s). (No spaces around any comma(s).) `oflag=FLAG[,FLAG]...' Access the output file using the flags specified by the FLAG argument(s). (No spaces around any comma(s).) Here are the flags. Not every flag is supported on every operating system. `append' Write in append mode, so that even if some other process is writing to this file, every `dd' write will append to the current contents of the file. This flag makes sense only for output. If you combine this flag with the `of=FILE' operand, you should also specify `conv=notrunc' unless you want the output file to be truncated before being appended to. `cio' Use concurrent I/O mode for data. This mode performs direct I/O and drops the POSIX requirement to serialize all I/O to the same file. A file cannot be opened in CIO mode and with a standard open at the same time. `direct' Use direct I/O for data, avoiding the buffer cache. Note that the kernel may impose restrictions on read or write buffer sizes. For example, with an ext4 destination file system and a linux-based kernel, using `oflag=direct' will cause writes to fail with `EINVAL' if the output buffer size is not a multiple of 512. `directory' Fail unless the file is a directory. Most operating systems do not allow I/O to a directory, so this flag has limited utility. `dsync' Use synchronized I/O for data. For the output file, this forces a physical write of output data on each write. For the input file, this flag can matter when reading from a remote file that has been written to synchronously by some other process. Metadata (e.g., last-access and last-modified time) is not necessarily synchronized. `sync' Use synchronized I/O for both data and metadata. `nocache' Discard the data cache for a file. When count=0 all cache is discarded, otherwise the cache is dropped for the processed portion of the file. Also when count=0 failure to discard the cache is diagnosed and reflected in the exit status. Here as some usage examples: # Advise to drop cache for whole file dd if=ifile iflag=nocache count=0 # Ensure drop cache for the whole file dd of=ofile oflag=nocache conv=notrunc,fdatasync count=0 # Drop cache for part of file dd if=ifile iflag=nocache skip=10 count=10 of=/dev/null # Stream data using just the read-ahead cache dd if=ifile of=ofile iflag=nocache oflag=nocache `nonblock' Use non-blocking I/O. `noatime' Do not update the file's access time. Some older file systems silently ignore this flag, so it is a good idea to test it on your files before relying on it. `noctty' Do not assign the file to be a controlling terminal for `dd'. This has no effect when the file is not a terminal. On many hosts (e.g., GNU/Linux hosts), this option has no effect at all. `nofollow' Do not follow symbolic links. `nolinks' Fail if the file has multiple hard links. `binary' Use binary I/O. This option has an effect only on nonstandard platforms that distinguish binary from text I/O. `text' Use text I/O. Like `binary', this option has no effect on standard platforms. `fullblock' Accumulate full blocks from input. The `read' system call may return early if a full block is not available. When that happens, continue calling `read' to fill the remainder of the block. This flag can be used only with `iflag'. This flag is useful with pipes for example as they may return short reads. In that case, this flag is needed to ensure that a `count=' argument is interpreted as a block count rather than a count of read operations. `count_bytes' Interpret the `count=' operand as a byte count, rather than a block count, which allows specifying a length that is not a multiple of the I/O block size. This flag can be used only with `iflag'. `skip_bytes' Interpret the `skip=' operand as a byte count, rather than a block count, which allows specifying an offset that is not a multiple of the I/O block size. This flag can be used only with `iflag'. `seek_bytes' Interpret the `seek=' operand as a byte count, rather than a block count, which allows specifying an offset that is not a multiple of the I/O block size. This flag can be used only with `oflag'. These flags are not supported on all systems, and `dd' rejects attempts to use them when they are not supported. When reading from standard input or writing to standard output, the `nofollow' and `noctty' flags should not be specified, and the other flags (e.g., `nonblock') can affect how other processes behave with the affected file descriptors, even after `dd' exits. The numeric-valued strings above (N and BYTES) can be followed by a multiplier: `b'=512, `c'=1, `w'=2, `xM'=M, or any of the standard block size suffixes like `k'=1024 (*note Block size::). Any block size you specify via `bs=', `ibs=', `obs=', `cbs=' should not be too large--values larger than a few megabytes are generally wasteful or (as in the gigabyte..exabyte case) downright counterproductive or error-inducing. To process data that is at an offset or size that is not a multiple of the I/O block size, you can use the `skip_bytes', `seek_bytes' and `count_bytes' flags. Alternatively the traditional method of separate `dd' invocations can be used. For example, the following shell commands copy data in 512 KiB blocks between a disk and a tape, but do not save or restore a 4 KiB label at the start of the disk: disk=/dev/rdsk/c0t1d0s2 tape=/dev/rmt/0 # Copy all but the label from disk to tape. (dd bs=4k skip=1 count=0 && dd bs=512k) <$disk >$tape # Copy from tape back to disk, but leave the disk label alone. (dd bs=4k seek=1 count=0 && dd bs=512k) <$tape >$disk Sending an `INFO' signal to a running `dd' process makes it print I/O statistics to standard error and then resume copying. In the example below, `dd' is run in the background to copy 10 million blocks. The `kill' command makes it output intermediate I/O statistics, and when `dd' completes normally or is killed by the `SIGINT' signal, it outputs the final statistics. $ dd if=/dev/zero of=/dev/null count=10MB & pid=$! $ kill -s INFO $pid; wait $pid 3385223+0 records in 3385223+0 records out 1733234176 bytes (1.7 GB) copied, 6.42173 seconds, 270 MB/s 10000000+0 records in 10000000+0 records out 5120000000 bytes (5.1 GB) copied, 18.913 seconds, 271 MB/s On systems lacking the `INFO' signal `dd' responds to the `USR1' signal instead, unless the `POSIXLY_CORRECT' environment variable is set. An exit status of zero indicates success, and a nonzero value indicates failure. 11.3 `install': Copy files and set attributes ============================================= `install' copies files while setting their file mode bits and, if possible, their owner and group. Synopses: install [OPTION]... [-T] SOURCE DEST install [OPTION]... SOURCE... DIRECTORY install [OPTION]... -t DIRECTORY SOURCE... install [OPTION]... -d DIRECTORY... * If two file names are given, `install' copies the first file to the second. * If the `--target-directory' (`-t') option is given, or failing that if the last file is a directory and the `--no-target-directory' (`-T') option is not given, `install' copies each SOURCE file to the specified directory, using the SOURCEs' names. * If the `--directory' (`-d') option is given, `install' creates each DIRECTORY and any missing parent directories. Parent directories are created with mode `u=rwx,go=rx' (755), regardless of the `-m' option or the current umask. *Note Directory Setuid and Setgid::, for how the set-user-ID and set-group-ID bits of parent directories are inherited. `install' is similar to `cp', but allows you to control the attributes of destination files. It is typically used in Makefiles to copy programs into their destination directories. It refuses to copy files onto themselves. `install' never preserves extended attributes (xattr). The program accepts the following options. Also see *note Common options::. `-b' `--backup[=METHOD]' *Note Backup options::. Make a backup of each file that would otherwise be overwritten or removed. `-C' `--compare' Compare each pair of source and destination files, and if the destination has identical content and any specified owner, group, permissions, and possibly SELinux context, then do not modify the destination at all. `-c' Ignored; for compatibility with old Unix versions of `install'. `-D' Create any missing parent directories of DEST, then copy SOURCE to DEST. This option is ignored if a destination directory is specified via `--target-directory=DIR'. `-d' `--directory' Create any missing parent directories, giving them the default attributes. Then create each given directory, setting their owner, group and mode as given on the command line or to the defaults. `-g GROUP' `--group=GROUP' Set the group ownership of installed files or directories to GROUP. The default is the process's current group. GROUP may be either a group name or a numeric group ID. `-m MODE' `--mode=MODE' Set the file mode bits for the installed file or directory to MODE, which can be either an octal number, or a symbolic mode as in `chmod', with `a=' (no access allowed to anyone) as the point of departure (*note File permissions::). The default mode is `u=rwx,go=rx,a-s'--read, write, and execute for the owner, read and execute for group and other, and with set-user-ID and set-group-ID disabled. This default is not quite the same as `755', since it disables instead of preserving set-user-ID and set-group-ID on directories. *Note Directory Setuid and Setgid::. `-o OWNER' `--owner=OWNER' If `install' has appropriate privileges (is run as root), set the ownership of installed files or directories to OWNER. The default is `root'. OWNER may be either a user name or a numeric user ID. `--preserve-context' Preserve the SELinux security context of files and directories. Failure to preserve the context in all of the files or directories will result in an exit status of 1. If SELinux is disabled then print a warning and ignore the option. `-p' `--preserve-timestamps' Set the time of last access and the time of last modification of each installed file to match those of each corresponding original file. When a file is installed without this option, its last access and last modification times are both set to the time of installation. This option is useful if you want to use the last modification times of installed files to keep track of when they were last built as opposed to when they were last installed. `-s' `--strip' Strip the symbol tables from installed binary executables. `--strip-program=PROGRAM' Program used to strip binaries. `-S SUFFIX' `--suffix=SUFFIX' Append SUFFIX to each backup file made with `-b'. *Note Backup options::. `-t DIRECTORY' `--target-directory=DIRECTORY' Specify the destination DIRECTORY. *Note Target directory::. `-T' `--no-target-directory' Do not treat the last operand specially when it is a directory or a symbolic link to a directory. *Note Target directory::. `-v' `--verbose' Print the name of each file before copying it. `-Z CONTEXT' `--context=CONTEXT' Set the default SELinux security context to be used for any created files and directories. If SELinux is disabled then print a warning and ignore the option. An exit status of zero indicates success, and a nonzero value indicates failure. 11.4 `mv': Move (rename) files ============================== `mv' moves or renames files (or directories). Synopses: mv [OPTION]... [-T] SOURCE DEST mv [OPTION]... SOURCE... DIRECTORY mv [OPTION]... -t DIRECTORY SOURCE... * If two file names are given, `mv' moves the first file to the second. * If the `--target-directory' (`-t') option is given, or failing that if the last file is a directory and the `--no-target-directory' (`-T') option is not given, `mv' moves each SOURCE file to the specified directory, using the SOURCEs' names. `mv' can move any type of file from one file system to another. Prior to version `4.0' of the fileutils, `mv' could move only regular files between file systems. For example, now `mv' can move an entire directory hierarchy including special device files from one partition to another. It first uses some of the same code that's used by `cp -a' to copy the requested directories and files, then (assuming the copy succeeded) it removes the originals. If the copy fails, then the part that was copied to the destination partition is removed. If you were to copy three directories from one partition to another and the copy of the first directory succeeded, but the second didn't, the first would be left on the destination partition and the second and third would be left on the original partition. `mv' always tries to copy extended attributes (xattr), which may include SELinux context, ACLs or Capabilities. Upon failure all but `Operation not supported' warnings are output. If a destination file exists but is normally unwritable, standard input is a terminal, and the `-f' or `--force' option is not given, `mv' prompts the user for whether to replace the file. (You might own the file, or have write permission on its directory.) If the response is not affirmative, the file is skipped. _Warning_: Avoid specifying a source name with a trailing slash, when it might be a symlink to a directory. Otherwise, `mv' may do something very surprising, since its behavior depends on the underlying rename system call. On a system with a modern Linux-based kernel, it fails with `errno=ENOTDIR'. However, on other systems (at least FreeBSD 6.1 and Solaris 10) it silently renames not the symlink but rather the directory referenced by the symlink. *Note Trailing slashes::. The program accepts the following options. Also see *note Common options::. `-b' `--backup[=METHOD]' *Note Backup options::. Make a backup of each file that would otherwise be overwritten or removed. `-f' `--force' Do not prompt the user before removing a destination file. If you specify more than one of the `-i', `-f', `-n' options, only the final one takes effect. `-i' `--interactive' Prompt whether to overwrite each existing destination file, regardless of its permissions. If the response is not affirmative, the file is skipped. If you specify more than one of the `-i', `-f', `-n' options, only the final one takes effect. `-n' `--no-clobber' Do not overwrite an existing file. If you specify more than one of the `-i', `-f', `-n' options, only the final one takes effect. This option is mutually exclusive with `-b' or `--backup' option. `-u' `--update' Do not move a non-directory that has an existing destination with the same or newer modification time. If the move is across file system boundaries, the comparison is to the source time stamp truncated to the resolutions of the destination file system and of the system calls used to update time stamps; this avoids duplicate work if several `mv -u' commands are executed with the same source and destination. `-v' `--verbose' Print the name of each file before moving it. `--strip-trailing-slashes' Remove any trailing slashes from each SOURCE argument. *Note Trailing slashes::. `-S SUFFIX' `--suffix=SUFFIX' Append SUFFIX to each backup file made with `-b'. *Note Backup options::. `-t DIRECTORY' `--target-directory=DIRECTORY' Specify the destination DIRECTORY. *Note Target directory::. `-T' `--no-target-directory' Do not treat the last operand specially when it is a directory or a symbolic link to a directory. *Note Target directory::. An exit status of zero indicates success, and a nonzero value indicates failure. 11.5 `rm': Remove files or directories ====================================== `rm' removes each given FILE. By default, it does not remove directories. Synopsis: rm [OPTION]... [FILE]... If the `-I' or `--interactive=once' option is given, and there are more than three files or the `-r', `-R', or `--recursive' are given, then `rm' prompts the user for whether to proceed with the entire operation. If the response is not affirmative, the entire command is aborted. Otherwise, if a file is unwritable, standard input is a terminal, and the `-f' or `--force' option is not given, or the `-i' or `--interactive=always' option _is_ given, `rm' prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped. Any attempt to remove a file whose last file name component is `.' or `..' is rejected without any prompting. _Warning_: If you use `rm' to remove a file, it is usually possible to recover the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using `shred'. The program accepts the following options. Also see *note Common options::. `-d' `--dir' Remove the listed directories if they are empty. `-f' `--force' Ignore nonexistent files and missing operands, and never prompt the user. Ignore any previous `--interactive' (`-i') option. `-i' Prompt whether to remove each file. If the response is not affirmative, the file is skipped. Ignore any previous `--force' (`-f') option. Equivalent to `--interactive=always'. `-I' Prompt once whether to proceed with the command, if more than three files are named or if a recursive removal is requested. Ignore any previous `--force' (`-f') option. Equivalent to `--interactive=once'. `--interactive [=WHEN]' Specify when to issue an interactive prompt. WHEN may be omitted, or one of: * never - Do not prompt at all. * once - Prompt once if more than three files are named or if a recursive removal is requested. Equivalent to `-I'. * always - Prompt for every file being removed. Equivalent to `-i'. `--interactive' with no WHEN is equivalent to `--interactive=always'. `--one-file-system' When removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument. This option is useful when removing a build "chroot" hierarchy, which normally contains no valuable data. However, it is not uncommon to bind-mount `/home' into such a hierarchy, to make it easier to use one's start-up file. The catch is that it's easy to forget to unmount `/home'. Then, when you use `rm -rf' to remove your normally throw-away chroot, that command will remove everything under `/home', too. Use the `--one-file-system' option, and it will warn about and skip directories on other file systems. Of course, this will not save your `/home' if it and your chroot happen to be on the same file system. `--preserve-root' Fail upon any attempt to remove the root directory, `/', when used with the `--recursive' option. This is the default behavior. *Note Treating / specially::. `--no-preserve-root' Do not treat `/' specially when removing recursively. This option is not recommended unless you really want to remove all the files on your computer. *Note Treating / specially::. `-r' `-R' `--recursive' Remove the listed directories and their contents recursively. `-v' `--verbose' Print the name of each file before removing it. One common question is how to remove files whose names begin with a `-'. GNU `rm', like every program that uses the `getopt' function to parse its arguments, lets you use the `--' option to indicate that all following arguments are non-options. To remove a file called `-f' in the current directory, you could type either: rm -- -f or: rm ./-f The Unix `rm' program's use of a single `-' for this purpose predates the development of the getopt standard syntax. An exit status of zero indicates success, and a nonzero value indicates failure. 11.6 `shred': Remove files more securely ======================================== `shred' overwrites devices or files, to help prevent even very expensive hardware from recovering the data. Ordinarily when you remove a file (*note rm invocation::), the data is not actually destroyed. Only the index listing where the file is stored is destroyed, and the storage is made available for reuse. There are undelete utilities that will attempt to reconstruct the index and can bring the file back if the parts were not reused. On a busy system with a nearly-full drive, space can get reused in a few seconds. But there is no way to know for sure. If you have sensitive data, you may want to be sure that recovery is not possible by actually overwriting the file with non-sensitive data. However, even after doing that, it is possible to take the disk back to a laboratory and use a lot of sensitive (and expensive) equipment to look for the faint "echoes" of the original data underneath the overwritten data. If the data has only been overwritten once, it's not even that hard. The best way to remove something irretrievably is to destroy the media it's on with acid, melt it down, or the like. For cheap removable media like floppy disks, this is the preferred method. However, hard drives are expensive and hard to melt, so the `shred' utility tries to achieve a similar effect non-destructively. This uses many overwrite passes, with the data patterns chosen to maximize the damage they do to the old data. While this will work on floppies, the patterns are designed for best effect on hard drives. For more details, see the source code and Peter Gutmann's paper `Secure Deletion of Data from Magnetic and Solid-State Memory' (http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html), from the proceedings of the Sixth USENIX Security Symposium (San Jose, California, July 22-25, 1996). *Please note* that `shred' relies on a very important assumption: that the file system overwrites data in place. This is the traditional way to do things, but many modern file system designs do not satisfy this assumption. Exceptions include: * Log-structured or journaled file systems, such as those supplied with AIX and Solaris, and JFS, ReiserFS, XFS, Ext3 (in `data=journal' mode), BFS, NTFS, etc., when they are configured to journal _data_. * File systems that write redundant data and carry on even if some writes fail, such as RAID-based file systems. * File systems that make snapshots, such as Network Appliance's NFS server. * File systems that cache in temporary locations, such as NFS version 3 clients. * Compressed file systems. In the particular case of ext3 file systems, the above disclaimer applies (and `shred' is thus of limited effectiveness) only in `data=journal' mode, which journals file data in addition to just metadata. In both the `data=ordered' (default) and `data=writeback' modes, `shred' works as usual. Ext3 journaling modes can be changed by adding the `data=something' option to the mount options for a particular file system in the `/etc/fstab' file, as documented in the mount man page (man mount). If you are not sure how your file system operates, then you should assume that it does not overwrite data in place, which means that shred cannot reliably operate on regular files in your file system. Generally speaking, it is more reliable to shred a device than a file, since this bypasses the problem of file system design mentioned above. However, even shredding devices is not always completely reliable. For example, most disks map out bad sectors invisibly to the application; if the bad sectors contain sensitive data, `shred' won't be able to destroy it. `shred' makes no attempt to detect or report this problem, just as it makes no attempt to do anything about backups. However, since it is more reliable to shred devices than files, `shred' by default does not truncate or remove the output file. This default is more suitable for devices, which typically cannot be truncated and should not be removed. Finally, consider the risk of backups and mirrors. File system backups and remote mirrors may contain copies of the file that cannot be removed, and that will allow a shredded file to be recovered later. So if you keep any data you may later want to destroy using `shred', be sure that it is not backed up or mirrored. shred [OPTION]... FILE[...] The program accepts the following options. Also see *note Common options::. `-f' `--force' Override file permissions if necessary to allow overwriting. `-NUMBER' `-n NUMBER' `--iterations=NUMBER' By default, `shred' uses 3 passes of overwrite. You can reduce this to save time, or increase it if you think it's appropriate. After 25 passes all of the internal overwrite patterns will have been used at least once. `--random-source=FILE' Use FILE as a source of random data used to overwrite and to choose pass ordering. *Note Random sources::. `-s BYTES' `--size=BYTES' Shred the first BYTES bytes of the file. The default is to shred the whole file. BYTES can be followed by a size specification like `K', `M', or `G' to specify a multiple. *Note Block size::. `-u' `--remove' After shredding a file, truncate it (if possible) and then remove it. If a file has multiple links, only the named links will be removed. `-v' `--verbose' Display to standard error all status updates as sterilization proceeds. `-x' `--exact' By default, `shred' rounds the size of a regular file up to the next multiple of the file system block size to fully erase the last block of the file. Use `--exact' to suppress that behavior. Thus, by default if you shred a 10-byte regular file on a system with 512-byte blocks, the resulting file will be 512 bytes long. With this option, shred does not increase the apparent size of the file. `-z' `--zero' Normally, the last pass that `shred' writes is made up of random data. If this would be conspicuous on your hard drive (for example, because it looks like encrypted data), or you just think it's tidier, the `--zero' option adds an additional overwrite pass with all zero bits. This is in addition to the number of passes specified by the `--iterations' option. You might use the following command to erase all trace of the file system you'd created on the floppy disk in your first drive. That command takes about 20 minutes to erase a "1.44MB" (actually 1440 KiB) floppy. shred --verbose /dev/fd0 Similarly, to erase all data on a selected partition of your hard disk, you could give a command like this: shred --verbose /dev/sda5 On modern disks, a single pass should be adequate, and it will take one third the time of the default three-pass approach. # 1 pass, write pseudo-random data; 3x faster than the default shred --verbose -n1 /dev/sda5 To be on the safe side, use at least one pass that overwrites using pseudo-random data. I.e., don't be tempted to use `-n0 --zero', in case some disk controller optimizes the process of writing blocks of all zeros, and thereby does not clear all bytes in a block. Some SSDs may do just that. A FILE of `-' denotes standard output. The intended use of this is to shred a removed temporary file. For example: i=$(mktemp) exec 3<>"$i" rm -- "$i" echo "Hello, world" >&3 shred - >&3 exec 3>- However, the command `shred - >file' does not shred the contents of FILE, since the shell truncates FILE before invoking `shred'. Use the command `shred file' or (if using a Bourne-compatible shell) the command `shred - 1<>file' instead. An exit status of zero indicates success, and a nonzero value indicates failure. 12 Special file types ********************* This chapter describes commands which create special types of files (and `rmdir', which removes directories, one special file type). Although Unix-like operating systems have markedly fewer special file types than others, not _everything_ can be treated only as the undifferentiated byte stream of "normal files". For example, when a file is created or removed, the system must record this information, which it does in a "directory"--a special type of file. Although you can read directories as normal files, if you're curious, in order for the system to do its job it must impose a structure, a certain order, on the bytes of the file. Thus it is a "special" type of file. Besides directories, other special file types include named pipes (FIFOs), symbolic links, sockets, and so-called "special files". 12.1 `link': Make a hard link via the link syscall ================================================== `link' creates a single hard link at a time. It is a minimalist interface to the system-provided `link' function. *Note Hard Links: (libc)Hard Links. It avoids the bells and whistles of the more commonly-used `ln' command (*note ln invocation::). Synopsis: link FILENAME LINKNAME FILENAME must specify an existing file, and LINKNAME must specify a nonexistent entry in an existing directory. `link' simply calls `link (FILENAME, LINKNAME)' to create the link. On a GNU system, this command acts like `ln --directory --no-target-directory FILENAME LINKNAME'. However, the `--directory' and `--no-target-directory' options are not specified by POSIX, and the `link' command is more portable in practice. If FILENAME is a symbolic link, it is unspecified whether LINKNAME will be a hard link to the symbolic link or to the target of the symbolic link. Use `ln -P' or `ln -L' to specify which behavior is desired. An exit status of zero indicates success, and a nonzero value indicates failure. 12.2 `ln': Make links between files =================================== `ln' makes links between files. By default, it makes hard links; with the `-s' option, it makes symbolic (or "soft") links. Synopses: ln [OPTION]... [-T] TARGET LINKNAME ln [OPTION]... TARGET ln [OPTION]... TARGET... DIRECTORY ln [OPTION]... -t DIRECTORY TARGET... * If two file names are given, `ln' creates a link to the first file from the second. * If one TARGET is given, `ln' creates a link to that file in the current directory. * If the `--target-directory' (`-t') option is given, or failing that if the last file is a directory and the `--no-target-directory' (`-T') option is not given, `ln' creates a link to each TARGET file in the specified directory, using the TARGETs' names. Normally `ln' does not remove existing files. Use the `--force' (`-f') option to remove them unconditionally, the `--interactive' (`-i') option to remove them conditionally, and the `--backup' (`-b') option to rename them. A "hard link" is another name for an existing file; the link and the original are indistinguishable. Technically speaking, they share the same inode, and the inode contains all the information about a file--indeed, it is not incorrect to say that the inode _is_ the file. Most systems prohibit making a hard link to a directory; on those where it is allowed, only the super-user can do so (and with caution, since creating a cycle will cause problems to many other utilities). Hard links cannot cross file system boundaries. (These restrictions are not mandated by POSIX, however.) "Symbolic links" ("symlinks" for short), on the other hand, are a special file type (which not all kernels support: System V release 3 (and older) systems lack symlinks) in which the link file actually refers to a different file, by name. When most operations (opening, reading, writing, and so on) are passed the symbolic link file, the kernel automatically "dereferences" the link and operates on the target of the link. But some operations (e.g., removing) work on the link file itself, rather than on its target. The owner and group of a symlink are not significant to file access performed through the link, but do have implications on deleting a symbolic link from a directory with the restricted deletion bit set. On the GNU system, the mode of a symlink has no significance and cannot be changed, but on some BSD systems, the mode can be changed and will affect whether the symlink will be traversed in file name resolution. *Note Symbolic Links: (libc)Symbolic Links. Symbolic links can contain arbitrary strings; a "dangling symlink" occurs when the string in the symlink does not resolve to a file. There are no restrictions against creating dangling symbolic links. There are trade-offs to using absolute or relative symlinks. An absolute symlink always points to the same file, even if the directory containing the link is moved. However, if the symlink is visible from more than one machine (such as on a networked file system), the file pointed to might not always be the same. A relative symbolic link is resolved in relation to the directory that contains the link, and is often useful in referring to files on the same device without regards to what name that device is mounted on when accessed via networked machines. When creating a relative symlink in a different location than the current directory, the resolution of the symlink will be different than the resolution of the same string from the current directory. Therefore, many users prefer to first change directories to the location where the relative symlink will be created, so that tab-completion or other file resolution will find the same target as what will be placed in the symlink. The program accepts the following options. Also see *note Common options::. `-b' `--backup[=METHOD]' *Note Backup options::. Make a backup of each file that would otherwise be overwritten or removed. `-d' `-F' `--directory' Allow users with appropriate privileges to attempt to make hard links to directories. However, note that this will probably fail due to system restrictions, even for the super-user. `-f' `--force' Remove existing destination files. `-i' `--interactive' Prompt whether to remove existing destination files. `-L' `--logical' If `-s' is not in effect, and the source file is a symbolic link, create the hard link to the file referred to by the symbolic link, rather than the symbolic link itself. `-n' `--no-dereference' Do not treat the last operand specially when it is a symbolic link to a directory. Instead, treat it as if it were a normal file. When the destination is an actual directory (not a symlink to one), there is no ambiguity. The link is created in that directory. But when the specified destination is a symlink to a directory, there are two ways to treat the user's request. `ln' can treat the destination just as it would a normal directory and create the link in it. On the other hand, the destination can be viewed as a non-directory--as the symlink itself. In that case, `ln' must delete or backup that symlink before creating the new link. The default is to treat a destination that is a symlink to a directory just like a directory. This option is weaker than the `--no-target-directory' (`-T') option, so it has no effect if both options are given. `-P' `--physical' If `-s' is not in effect, and the source file is a symbolic link, create the hard link to the symbolic link itself. On platforms where this is not supported by the kernel, this option creates a symbolic link with identical contents; since symbolic link contents cannot be edited, any file name resolution performed through either link will be the same as if a hard link had been created. `-r' `--relative' Make symbolic links relative to the link location. Example: ln -srv /a/file /tmp '/tmp/file' -> '../a/file' *Note realpath invocation::, which gives greater control over relative file name generation. `-s' `--symbolic' Make symbolic links instead of hard links. This option merely produces an error message on systems that do not support symbolic links. `-S SUFFIX' `--suffix=SUFFIX' Append SUFFIX to each backup file made with `-b'. *Note Backup options::. `-t DIRECTORY' `--target-directory=DIRECTORY' Specify the destination DIRECTORY. *Note Target directory::. `-T' `--no-target-directory' Do not treat the last operand specially when it is a directory or a symbolic link to a directory. *Note Target directory::. `-v' `--verbose' Print the name of each file after linking it successfully. If `-L' and `-P' are both given, the last one takes precedence. If `-s' is also given, `-L' and `-P' are silently ignored. If neither option is given, then this implementation defaults to `-P' if the system `link' supports hard links to symbolic links (such as the GNU system), and `-L' if `link' follows symbolic links (such as on BSD). An exit status of zero indicates success, and a nonzero value indicates failure. Examples: Bad Example: # Create link ../a pointing to a in that directory. # Not really useful because it points to itself. ln -s a .. Better Example: # Change to the target before creating symlinks to avoid being confused. cd .. ln -s adir/a . Bad Example: # Hard coded file names don't move well. ln -s $(pwd)/a /some/dir/ Better Example: # Relative file names survive directory moves and also # work across networked file systems. ln -s afile anotherfile ln -s ../adir/afile yetanotherfile 12.3 `mkdir': Make directories ============================== `mkdir' creates directories with the specified names. Synopsis: mkdir [OPTION]... NAME... `mkdir' creates each directory NAME in the order given. It reports an error if NAME already exists, unless the `-p' option is given and NAME is a directory. The program accepts the following options. Also see *note Common options::. `-m MODE' `--mode=MODE' Set the file permission bits of created directories to MODE, which uses the same syntax as in `chmod' and uses `a=rwx' (read, write and execute allowed for everyone) for the point of the departure. *Note File permissions::. Normally the directory has the desired file mode bits at the moment it is created. As a GNU extension, MODE may also mention special mode bits, but in this case there may be a temporary window during which the directory exists but its special mode bits are incorrect. *Note Directory Setuid and Setgid::, for how the set-user-ID and set-group-ID bits of directories are inherited unless overridden in this way. `-p' `--parents' Make any missing parent directories for each argument, setting their file permission bits to the umask modified by `u+wx'. Ignore existing parent directories, and do not change their file permission bits. To set the file permission bits of any newly-created parent directories to a value that includes `u+wx', you can set the umask before invoking `mkdir'. For example, if the shell command `(umask u=rwx,go=rx; mkdir -p P/Q)' creates the parent `P' it sets the parent's permission bits to `u=rwx,go=rx'. To set a parent's special mode bits as well, you can invoke `chmod' after `mkdir'. *Note Directory Setuid and Setgid::, for how the set-user-ID and set-group-ID bits of newly-created parent directories are inherited. `-v' `--verbose' Print a message for each created directory. This is most useful with `--parents'. `-Z CONTEXT' `--context=CONTEXT' Set the default SELinux security context to be used for created directories. An exit status of zero indicates success, and a nonzero value indicates failure. 12.4 `mkfifo': Make FIFOs (named pipes) ======================================= `mkfifo' creates FIFOs (also called "named pipes") with the specified names. Synopsis: mkfifo [OPTION] NAME... A "FIFO" is a special file type that permits independent processes to communicate. One process opens the FIFO file for writing, and another for reading, after which data can flow as with the usual anonymous pipe in shells or elsewhere. The program accepts the following option. Also see *note Common options::. `-m MODE' `--mode=MODE' Set the mode of created FIFOs to MODE, which is symbolic as in `chmod' and uses `a=rw' (read and write allowed for everyone) for the point of departure. MODE should specify only file permission bits. *Note File permissions::. `-Z CONTEXT' `--context=CONTEXT' Set the default SELinux security context to be used for created FIFOs. An exit status of zero indicates success, and a nonzero value indicates failure. 12.5 `mknod': Make block or character special files =================================================== `mknod' creates a FIFO, character special file, or block special file with the specified name. Synopsis: mknod [OPTION]... NAME TYPE [MAJOR MINOR] Unlike the phrase "special file type" above, the term "special file" has a technical meaning on Unix: something that can generate or receive data. Usually this corresponds to a physical piece of hardware, e.g., a printer or a disk. (These files are typically created at system-configuration time.) The `mknod' command is what creates files of this type. Such devices can be read either a character at a time or a "block" (many characters) at a time, hence we say there are "block special" files and "character special" files. Due to shell aliases and built-in `mknod' functions, using an unadorned `mknod' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env mknod ...') to avoid interference from the shell. The arguments after NAME specify the type of file to make: `p' for a FIFO `b' for a block special file `c' for a character special file When making a block or character special file, the major and minor device numbers must be given after the file type. If a major or minor device number begins with `0x' or `0X', it is interpreted as hexadecimal; otherwise, if it begins with `0', as octal; otherwise, as decimal. The program accepts the following option. Also see *note Common options::. `-m MODE' `--mode=MODE' Set the mode of created files to MODE, which is symbolic as in `chmod' and uses `a=rw' as the point of departure. MODE should specify only file permission bits. *Note File permissions::. `-Z CONTEXT' `--context=CONTEXT' Set the default SELinux security context to be used for created files. An exit status of zero indicates success, and a nonzero value indicates failure. 12.6 `readlink': Print value of a symlink or canonical file name ================================================================ `readlink' may work in one of two supported modes: `Readlink mode' `readlink' outputs the value of the given symbolic links. If `readlink' is invoked with an argument other than the name of a symbolic link, it produces no output and exits with a nonzero exit code. `Canonicalize mode' `readlink' outputs the absolute name of the given files which contain no `.', `..' components nor any repeated separators (`/') or symbolic links. readlink [OPTION]... FILE... By default, `readlink' operates in readlink mode. The program accepts the following options. Also see *note Common options::. `-f' `--canonicalize' Activate canonicalize mode. If any component of the file name except the last one is missing or unavailable, `readlink' produces no output and exits with a nonzero exit code. A trailing slash is ignored. `-e' `--canonicalize-existing' Activate canonicalize mode. If any component is missing or unavailable, `readlink' produces no output and exits with a nonzero exit code. A trailing slash requires that the name resolve to a directory. `-m' `--canonicalize-missing' Activate canonicalize mode. If any component is missing or unavailable, `readlink' treats it as a directory. `-n' `--no-newline' Do not print the output delimiter, when a single FILE is specified. Print a warning if specified along with multiple FILEs. `-s' `-q' `--silent' `--quiet' Suppress most error messages. `-v' `--verbose' Report error messages. `-z' `--zero' Separate output items with NUL characters. The `readlink' utility first appeared in OpenBSD 2.1. The `realpath' command without options, operates like `readlink' in canonicalize mode. An exit status of zero indicates success, and a nonzero value indicates failure. 12.7 `rmdir': Remove empty directories ====================================== `rmdir' removes empty directories. Synopsis: rmdir [OPTION]... DIRECTORY... If any DIRECTORY argument does not refer to an existing empty directory, it is an error. The program accepts the following options. Also see *note Common options::. `--ignore-fail-on-non-empty' Ignore each failure to remove a directory that is solely because the directory is non-empty. `-p' `--parents' Remove DIRECTORY, then try to remove each component of DIRECTORY. So, for example, `rmdir -p a/b/c' is similar to `rmdir a/b/c a/b a'. As such, it fails if any of those directories turns out not to be empty. Use the `--ignore-fail-on-non-empty' option to make it so such a failure does not evoke a diagnostic and does not cause `rmdir' to exit unsuccessfully. `-v' `--verbose' Give a diagnostic for each successful removal. DIRECTORY is removed. *Note rm invocation::, for how to remove non-empty directories (recursively). An exit status of zero indicates success, and a nonzero value indicates failure. 12.8 `unlink': Remove files via the unlink syscall ================================================== `unlink' deletes a single specified file name. It is a minimalist interface to the system-provided `unlink' function. *Note Deleting Files: (libc)Deleting Files. Synopsis: It avoids the bells and whistles of the more commonly-used `rm' command (*note rm invocation::). unlink FILENAME On some systems `unlink' can be used to delete the name of a directory. On others, it can be used that way only by a privileged user. In the GNU system `unlink' can never delete the name of a directory. The `unlink' command honors the `--help' and `--version' options. To remove a file whose name begins with `-', prefix the name with `./', e.g., `unlink ./--help'. An exit status of zero indicates success, and a nonzero value indicates failure. 13 Changing file attributes *************************** A file is not merely its contents, a name, and a file type (*note Special file types::). A file also has an owner (a user ID), a group (a group ID), permissions (what the owner can do with the file, what people in the group can do, and what everyone else can do), various timestamps, and other information. Collectively, we call these a file's "attributes". These commands change file attributes. 13.1 `chown': Change file owner and group ========================================= `chown' changes the user and/or group ownership of each given FILE to NEW-OWNER or to the user and group of an existing reference file. Synopsis: chown [OPTION]... {NEW-OWNER | --reference=REF_FILE} FILE... If used, NEW-OWNER specifies the new owner and/or group as follows (with no embedded white space): [OWNER] [ : [GROUP] ] Specifically: OWNER If only an OWNER (a user name or numeric user ID) is given, that user is made the owner of each given file, and the files' group is not changed. OWNER`:'GROUP If the OWNER is followed by a colon and a GROUP (a group name or numeric group ID), with no spaces between them, the group ownership of the files is changed as well (to GROUP). OWNER`:' If a colon but no group name follows OWNER, that user is made the owner of the files and the group of the files is changed to OWNER's login group. `:'GROUP If the colon and following GROUP are given, but the owner is omitted, only the group of the files is changed; in this case, `chown' performs the same function as `chgrp'. `:' If only a colon is given, or if NEW-OWNER is empty, neither the owner nor the group is changed. If OWNER or GROUP is intended to represent a numeric user or group ID, then you may specify it with a leading `+'. *Note Disambiguating names and IDs::. Some older scripts may still use `.' in place of the `:' separator. POSIX 1003.1-2001 (*note Standards conformance::) does not require support for that, but for backward compatibility GNU `chown' supports `.' so long as no ambiguity results. New scripts should avoid the use of `.' because it is not portable, and because it has undesirable results if the entire OWNER`.'GROUP happens to identify a user whose name contains `.'. The `chown' command sometimes clears the set-user-ID or set-group-ID permission bits. This behavior depends on the policy and functionality of the underlying `chown' system call, which may make system-dependent file mode modifications outside the control of the `chown' command. For example, the `chown' command might not affect those bits when invoked by a user with appropriate privileges, or when the bits signify some function other than executable permission (e.g., mandatory locking). When in doubt, check the underlying system behavior. The program accepts the following options. Also see *note Common options::. `-c' `--changes' Verbosely describe the action for each FILE whose ownership actually changes. `-f' `--silent' `--quiet' Do not print error messages about files whose ownership cannot be changed. `--from=OLD-OWNER' Change a FILE's ownership only if it has current attributes specified by OLD-OWNER. OLD-OWNER has the same form as NEW-OWNER described above. This option is useful primarily from a security standpoint in that it narrows considerably the window of potential abuse. For example, to reflect a user ID numbering change for one user's files without an option like this, `root' might run find / -owner OLDUSER -print0 | xargs -0 chown -h NEWUSER But that is dangerous because the interval between when the `find' tests the existing file's owner and when the `chown' is actually run may be quite large. One way to narrow the gap would be to invoke chown for each file as it is found: find / -owner OLDUSER -exec chown -h NEWUSER {} \; But that is very slow if there are many affected files. With this option, it is safer (the gap is narrower still) though still not perfect: chown -h -R --from=OLDUSER NEWUSER / `--dereference' Do not act on symbolic links themselves but rather on what they point to. This is the default. `-h' `--no-dereference' Act on symbolic links themselves instead of what they point to. This mode relies on the `lchown' system call. On systems that do not provide the `lchown' system call, `chown' fails when a file specified on the command line is a symbolic link. By default, no diagnostic is issued for symbolic links encountered during a recursive traversal, but see `--verbose'. `--preserve-root' Fail upon any attempt to recursively change the root directory, `/'. Without `--recursive', this option has no effect. *Note Treating / specially::. `--no-preserve-root' Cancel the effect of any preceding `--preserve-root' option. *Note Treating / specially::. `--reference=REF_FILE' Change the user and group of each FILE to be the same as those of REF_FILE. If REF_FILE is a symbolic link, do not use the user and group of the symbolic link, but rather those of the file it refers to. `-v' `--verbose' Output a diagnostic for every file processed. If a symbolic link is encountered during a recursive traversal on a system without the `lchown' system call, and `--no-dereference' is in effect, then issue a diagnostic saying neither the symbolic link nor its referent is being changed. `-R' `--recursive' Recursively change ownership of directories and their contents. `-H' If `--recursive' (`-R') is specified and a command line argument is a symbolic link to a directory, traverse it. *Note Traversing symlinks::. `-L' In a recursive traversal, traverse every symbolic link to a directory that is encountered. *Note Traversing symlinks::. `-P' Do not traverse any symbolic links. This is the default if none of `-H', `-L', or `-P' is specified. *Note Traversing symlinks::. An exit status of zero indicates success, and a nonzero value indicates failure. Examples: # Change the owner of /u to "root". chown root /u # Likewise, but also change its group to "staff". chown root:staff /u # Change the owner of /u and subfiles to "root". chown -hR root /u 13.2 `chgrp': Change group ownership ==================================== `chgrp' changes the group ownership of each given FILE to GROUP (which can be either a group name or a numeric group ID) or to the group of an existing reference file. Synopsis: chgrp [OPTION]... {GROUP | --reference=REF_FILE} FILE... If GROUP is intended to represent a numeric group ID, then you may specify it with a leading `+'. *Note Disambiguating names and IDs::. The program accepts the following options. Also see *note Common options::. `-c' `--changes' Verbosely describe the action for each FILE whose group actually changes. `-f' `--silent' `--quiet' Do not print error messages about files whose group cannot be changed. `--dereference' Do not act on symbolic links themselves but rather on what they point to. This is the default. `-h' `--no-dereference' Act on symbolic links themselves instead of what they point to. This mode relies on the `lchown' system call. On systems that do not provide the `lchown' system call, `chgrp' fails when a file specified on the command line is a symbolic link. By default, no diagnostic is issued for symbolic links encountered during a recursive traversal, but see `--verbose'. `--preserve-root' Fail upon any attempt to recursively change the root directory, `/'. Without `--recursive', this option has no effect. *Note Treating / specially::. `--no-preserve-root' Cancel the effect of any preceding `--preserve-root' option. *Note Treating / specially::. `--reference=REF_FILE' Change the group of each FILE to be the same as that of REF_FILE. If REF_FILE is a symbolic link, do not use the group of the symbolic link, but rather that of the file it refers to. `-v' `--verbose' Output a diagnostic for every file processed. If a symbolic link is encountered during a recursive traversal on a system without the `lchown' system call, and `--no-dereference' is in effect, then issue a diagnostic saying neither the symbolic link nor its referent is being changed. `-R' `--recursive' Recursively change the group ownership of directories and their contents. `-H' If `--recursive' (`-R') is specified and a command line argument is a symbolic link to a directory, traverse it. *Note Traversing symlinks::. `-L' In a recursive traversal, traverse every symbolic link to a directory that is encountered. *Note Traversing symlinks::. `-P' Do not traverse any symbolic links. This is the default if none of `-H', `-L', or `-P' is specified. *Note Traversing symlinks::. An exit status of zero indicates success, and a nonzero value indicates failure. Examples: # Change the group of /u to "staff". chgrp staff /u # Change the group of /u and subfiles to "staff". chgrp -hR staff /u 13.3 `chmod': Change access permissions ======================================= `chmod' changes the access permissions of the named files. Synopsis: chmod [OPTION]... {MODE | --reference=REF_FILE} FILE... `chmod' never changes the permissions of symbolic links, since the `chmod' system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, `chmod' changes the permissions of the pointed-to file. In contrast, `chmod' ignores symbolic links encountered during recursive directory traversals. A successful use of `chmod' clears the set-group-ID bit of a regular file if the file's group ID does not match the user's effective group ID or one of the user's supplementary group IDs, unless the user has appropriate privileges. Additional restrictions may cause the set-user-ID and set-group-ID bits of MODE or REF_FILE to be ignored. This behavior depends on the policy and functionality of the underlying `chmod' system call. When in doubt, check the underlying system behavior. If used, MODE specifies the new file mode bits. For details, see the section on *note File permissions::. If you really want MODE to have a leading `-', you should use `--' first, e.g., `chmod -- -w file'. Typically, though, `chmod a-w file' is preferable, and `chmod -w file' (without the `--') complains if it behaves differently from what `chmod a-w file' would do. The program accepts the following options. Also see *note Common options::. `-c' `--changes' Verbosely describe the action for each FILE whose permissions actually changes. `-f' `--silent' `--quiet' Do not print error messages about files whose permissions cannot be changed. `--preserve-root' Fail upon any attempt to recursively change the root directory, `/'. Without `--recursive', this option has no effect. *Note Treating / specially::. `--no-preserve-root' Cancel the effect of any preceding `--preserve-root' option. *Note Treating / specially::. `-v' `--verbose' Verbosely describe the action or non-action taken for every FILE. `--reference=REF_FILE' Change the mode of each FILE to be the same as that of REF_FILE. *Note File permissions::. If REF_FILE is a symbolic link, do not use the mode of the symbolic link, but rather that of the file it refers to. `-R' `--recursive' Recursively change permissions of directories and their contents. An exit status of zero indicates success, and a nonzero value indicates failure. 13.4 `touch': Change file timestamps ==================================== `touch' changes the access and/or modification times of the specified files. Synopsis: touch [OPTION]... FILE... Any FILE argument that does not exist is created empty, unless option `--no-create' (`-c') or `--no-dereference' (`-h') was in effect. A FILE argument string of `-' is handled specially and causes `touch' to change the times of the file associated with standard output. By default, `touch' sets file timestamps to the current time. Because `touch' acts on its operands left to right, the resulting timestamps of earlier and later operands may disagree. Also, the determination of what time is "current" depends on the platform. Platforms with network file systems often use different clocks for the operating system and for file systems; because `touch' typically uses file systems' clocks by default, clock skew can cause the resulting file timestamps to appear to be in a program's "future" or "past". The `touch' command sets the file's timestamp to the greatest representable value that is not greater than the requested time. This can differ from the requested time for several reasons. First, the requested time may have a higher resolution than supported. Second, a file system may use different resolutions for different types of times. Third, file timestamps may use a different resolution than operating system timestamps. Fourth, the operating system primitives used to update timestamps may employ yet a different resolution. For example, in theory a file system might use 10-microsecond resolution for access time and 100-nanosecond resolution for modification time, and the operating system might use nanosecond resolution for the current time and microsecond resolution for the primitive that `touch' uses to set a file's timestamp to an arbitrary value. When setting file timestamps to the current time, `touch' can change the timestamps for files that the user does not own but has write permission for. Otherwise, the user must own the files. Some older systems have a further restriction: the user must own the files unless both the access and modification times are being set to the current time. Although `touch' provides options for changing two of the times--the times of last access and modification--of a file, there is actually a standard third one as well: the inode change time. This is often referred to as a file's `ctime'. The inode change time represents the time when the file's meta-information last changed. One common example of this is when the permissions of a file change. Changing the permissions doesn't access the file, so the atime doesn't change, nor does it modify the file, so the mtime doesn't change. Yet, something about the file itself has changed, and this must be noted somewhere. This is the job of the ctime field. This is necessary, so that, for example, a backup program can make a fresh copy of the file, including the new permissions value. Another operation that modifies a file's ctime without affecting the others is renaming. In any case, it is not possible, in normal operations, for a user to change the ctime field to a user-specified value. Some operating systems and file systems support a fourth time: the birth time, when the file was first created; by definition, this timestamp never changes. Time stamps assume the time zone rules specified by the `TZ' environment variable, or by the system default rules if `TZ' is not set. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. You can avoid ambiguities during daylight saving transitions by using UTC time stamps. The program accepts the following options. Also see *note Common options::. `-a' `--time=atime' `--time=access' `--time=use' Change the access time only. `-c' `--no-create' Do not warn about or create files that do not exist. `-d' `--date=TIME' Use TIME instead of the current time. It can contain month names, time zones, `am' and `pm', `yesterday', etc. For example, `--date="2004-02-27 14:19:13.489392193 +0530"' specifies the instant of time that is 489,392,193 nanoseconds after February 27, 2004 at 2:19:13 PM in a time zone that is 5 hours and 30 minutes east of UTC. *Note Date input formats::. File systems that do not support high-resolution time stamps silently ignore any excess precision here. `-f' Ignored; for compatibility with BSD versions of `touch'. `-h' `--no-dereference' Attempt to change the timestamps of a symbolic link, rather than what the link refers to. When using this option, empty files are not created, but option `-c' must also be used to avoid warning about files that do not exist. Not all systems support changing the timestamps of symlinks, since underlying system support for this action was not required until POSIX 2008. Also, on some systems, the mere act of examining a symbolic link changes the access time, such that only changes to the modification time will persist long enough to be observable. When coupled with option `-r', a reference timestamp is taken from a symbolic link rather than the file it refers to. `-m' `--time=mtime' `--time=modify' Change the modification time only. `-r FILE' `--reference=FILE' Use the times of the reference FILE instead of the current time. If this option is combined with the `--date=TIME' (`-d TIME') option, the reference FILE's time is the origin for any relative TIMEs given, but is otherwise ignored. For example, `-r foo -d '-5 seconds'' specifies a time stamp equal to five seconds before the corresponding time stamp for `foo'. If FILE is a symbolic link, the reference timestamp is taken from the target of the symlink, unless `-h' was also in effect. `-t [[CC]YY]MMDDHHMM[.SS]' Use the argument (optional four-digit or two-digit years, months, days, hours, minutes, optional seconds) instead of the current time. If the year is specified with only two digits, then CC is 20 for years in the range 0 ... 68, and 19 for years in 69 ... 99. If no digits of the year are specified, the argument is interpreted as a date in the current year. On the atypical systems that support leap seconds, SS may be `60'. On older systems, `touch' supports an obsolete syntax, as follows. If no timestamp is given with any of the `-d', `-r', or `-t' options, and if there are two or more FILEs and the first FILE is of the form `MMDDHHMM[YY]' and this would be a valid argument to the `-t' option (if the YY, if any, were moved to the front), and if the represented year is in the range 1969-1999, that argument is interpreted as the time for the other files instead of as a file name. This obsolete behavior can be enabled or disabled with the `_POSIX2_VERSION' environment variable (*note Standards conformance::), but portable scripts should avoid commands whose behavior depends on this variable. For example, use `touch ./12312359 main.c' or `touch -t 12312359 main.c' rather than the ambiguous `touch 12312359 main.c'. An exit status of zero indicates success, and a nonzero value indicates failure. 14 Disk usage ************* No disk can hold an infinite amount of data. These commands report how much disk storage is in use or available, report other file and file status information, and write buffers to disk. 14.1 `df': Report file system disk space usage ============================================== `df' reports the amount of disk space used and available on file systems. Synopsis: df [OPTION]... [FILE]... With no arguments, `df' reports the space used and available on all currently mounted file systems (of all types). Otherwise, `df' reports on the file system containing each argument FILE. Normally the disk space is printed in units of 1024 bytes, but this can be overridden (*note Block size::). Non-integer quantities are rounded up to the next higher unit. For bind mounts and without arguments, `df' only outputs the statistics for that device with the shortest mount point name in the list of file systems (MTAB), i.e., it hides duplicate entries, unless the `-a' option is specified. With the same logic, `df' elides a mount entry of a dummy pseude device if there is another mount entry of a real block device for that mount point with the same device number, e.g. the early-boot pseudo file system `rootfs' is not shown per default when already the real root device has been mounted. If an argument FILE is a disk device file containing a mounted file system, `df' shows the space available on that file system rather than on the file system containing the device node (i.e., the root file system). GNU `df' does not attempt to determine the disk usage on unmounted file systems, because on most kinds of systems doing so requires extremely nonportable intimate knowledge of file system structures. The program accepts the following options. Also see *note Common options::. `-a' `--all' Include in the listing dummy file systems, which are omitted by default. Such file systems are typically special-purpose pseudo-file-systems, such as automounter entries. `-B SIZE' `--block-size=SIZE' Scale sizes by SIZE before printing them (*note Block size::). For example, `-BG' prints sizes in units of 1,073,741,824 bytes. `--total' Print a grand total of all arguments after all arguments have been processed. This can be used to find out the total disk size, usage and available space of all listed devices. For the grand total line, `df' prints `"total"' into the SOURCE column, and `"-"' into the TARGET column. If there is no SOURCE column (see `--output'), then `df' prints `"total"' into the TARGET column, if present. `-h' `--human-readable' Append a size letter to each size, such as `M' for mebibytes. Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes. This option is equivalent to `--block-size=human-readable'. Use the `--si' option if you prefer powers of 1000. `-H' Equivalent to `--si'. `-i' `--inodes' List inode usage information instead of block usage. An inode (short for index node) contains information about a file such as its owner, permissions, timestamps, and location on the disk. `-k' Print sizes in 1024-byte blocks, overriding the default block size (*note Block size::). This option is equivalent to `--block-size=1K'. `-l' `--local' Limit the listing to local file systems. By default, remote file systems are also listed. `--no-sync' Do not invoke the `sync' system call before getting any usage data. This may make `df' run significantly faster on systems with many disks, but on some systems (notably SunOS) the results may be slightly out of date. This is the default. `--output' `--output[=FIELD_LIST]' Use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted. In the latter case, the order of the columns conforms to the order of the field descriptions below. The use of the `--output' together with each of the options `-i', `-P', and `-T' is mutually exclusive. FIELD_LIST is a comma-separated list of columns to be included in `df''s output and therefore effectively controls the order of output columns. Each field can thus be used at the place of choice, but yet must only be used once. Valid field names in the FIELD_LIST are: `source' The source of the mount point, usually a device. `fstype' File system type. `itotal' Total number of inodes. `iused' Number of used inodes. `iavail' Number of available inodes. `ipcent' Percentage of IUSED divided by ITOTAL. `size' Total number of blocks. `used' Number of used blocks. `avail' Number of available blocks. `pcent' Percentage of USED divided by SIZE. `target' The mount point. The fields for block and inodes statistics are affected by the scaling options like `-h' as usual. The definition of the FIELD_LIST can even be splitted among several `--output' uses. #!/bin/sh # Print the TARGET (i.e., the mount point) along with their percentage # statistic regarding the blocks and the inodes. df --out=target --output=pcent,ipcent # Print all available fields. df --o `-P' `--portability' Use the POSIX output format. This is like the default format except for the following: 1. The information about each file system is always printed on exactly one line; a mount device is never put on a line by itself. This means that if the mount device name is more than 20 characters long (e.g., for some network mounts), the columns are misaligned. 2. The labels in the header output line are changed to conform to POSIX. 3. The default block size and output format are unaffected by the `DF_BLOCK_SIZE', `BLOCK_SIZE' and `BLOCKSIZE' environment variables. However, the default block size is still affected by `POSIXLY_CORRECT': it is 512 if `POSIXLY_CORRECT' is set, 1024 otherwise. *Note Block size::. `--si' Append an SI-style abbreviation to each size, such as `M' for megabytes. Powers of 1000 are used, not 1024; `M' stands for 1,000,000 bytes. This option is equivalent to `--block-size=si'. Use the `-h' or `--human-readable' option if you prefer powers of 1024. `--sync' Invoke the `sync' system call before getting any usage data. On some systems (notably SunOS), doing this yields more up to date results, but in general this option makes `df' much slower, especially when there are many or very busy file systems. `-t FSTYPE' `--type=FSTYPE' Limit the listing to file systems of type FSTYPE. Multiple file system types can be specified by giving multiple `-t' options. By default, nothing is omitted. `-T' `--print-type' Print each file system's type. The types printed here are the same ones you can include or exclude with `-t' and `-x'. The particular types printed are whatever is supported by the system. Here are some of the common names (this list is certainly not exhaustive): `nfs' An NFS file system, i.e., one mounted over a network from another machine. This is the one type name which seems to be used uniformly by all systems. `4.2, ufs, efs...' A file system on a locally-mounted hard disk. (The system might even support more than one type here; Linux does.) `hsfs, cdfs' A file system on a CD-ROM drive. HP-UX uses `cdfs', most other systems use `hsfs' (`hs' for "High Sierra"). `pcfs' An MS-DOS file system, usually on a diskette. `-x FSTYPE' `--exclude-type=FSTYPE' Limit the listing to file systems not of type FSTYPE. Multiple file system types can be eliminated by giving multiple `-x' options. By default, no file system types are omitted. `-v' Ignored; for compatibility with System V versions of `df'. An exit status of zero indicates success, and a nonzero value indicates failure. Failure includes the case where no output is generated, so you can inspect the exit status of a command like `df -t ext3 -t reiserfs DIR' to test whether DIR is on a file system of type `ext3' or `reiserfs'. Since the list of file systems (MTAB) is needed to determine the file system type, failure includes the cases when that list cannot be read and one or more of the options `-a', `-l', `-t' or `-x' is used together with a file name argument. 14.2 `du': Estimate file space usage ==================================== `du' reports the amount of disk space used by the specified files and for each subdirectory (of directory arguments). Synopsis: du [OPTION]... [FILE]... With no arguments, `du' reports the disk space for the current directory. Normally the disk space is printed in units of 1024 bytes, but this can be overridden (*note Block size::). Non-integer quantities are rounded up to the next higher unit. If two or more hard links point to the same file, only one of the hard links is counted. The FILE argument order affects which links are counted, and changing the argument order may change the numbers that `du' outputs. The program accepts the following options. Also see *note Common options::. `-0' `--null' Output a zero byte (ASCII NUL) at the end of each line, rather than a newline. This option enables other programs to parse the output of `du' even when that output would contain data with embedded newlines. `-a' `--all' Show counts for all files, not just directories. `--apparent-size' Print apparent sizes, rather than disk usage. The apparent size of a file is the number of bytes reported by `wc -c' on regular files, or more generally, `ls -l --block-size=1' or `stat --format=%s'. For example, a file containing the word `zoo' with no newline would, of course, have an apparent size of 3. Such a small file may require anywhere from 0 to 16 KiB or more of disk space, depending on the type and configuration of the file system on which the file resides. However, a sparse file created with this command: dd bs=1 seek=2GiB if=/dev/null of=big has an apparent size of 2 GiB, yet on most modern systems, it actually uses almost no disk space. `-B SIZE' `--block-size=SIZE' Scale sizes by SIZE before printing them (*note Block size::). For example, `-BG' prints sizes in units of 1,073,741,824 bytes. `-b' `--bytes' Equivalent to `--apparent-size --block-size=1'. `-c' `--total' Print a grand total of all arguments after all arguments have been processed. This can be used to find out the total disk usage of a given set of files or directories. `-D' `--dereference-args' Dereference symbolic links that are command line arguments. Does not affect other symbolic links. This is helpful for finding out the disk usage of directories, such as `/usr/tmp', which are often symbolic links. `-d DEPTH' `--max-depth=DEPTH' Show the total for each directory (and file if -all) that is at most MAX_DEPTH levels down from the root of the hierarchy. The root is at level 0, so `du --max-depth=0' is equivalent to `du -s'. `--files0-from=FILE' Disallow processing files named on the command line, and instead process those named in file FILE; each name being terminated by a zero byte (ASCII NUL). This is useful when the list of file names is so long that it may exceed a command line length limitation. In such cases, running `du' via `xargs' is undesirable because it splits the list into pieces and makes `du' print with the `--total' (`-c') option for each sublist rather than for the entire list. One way to produce a list of ASCII NUL terminated file names is with GNU `find', using its `-print0' predicate. If FILE is `-' then the ASCII NUL terminated file names are read from standard input. `-H' Equivalent to `--dereference-args' (`-D'). `-h' `--human-readable' Append a size letter to each size, such as `M' for mebibytes. Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes. This option is equivalent to `--block-size=human-readable'. Use the `--si' option if you prefer powers of 1000. `-k' Print sizes in 1024-byte blocks, overriding the default block size (*note Block size::). This option is equivalent to `--block-size=1K'. `-L' `--dereference' Dereference symbolic links (show the disk space used by the file or directory that the link points to instead of the space used by the link). `-l' `--count-links' Count the size of all files, even if they have appeared already (as a hard link). `-m' Print sizes in 1,048,576-byte blocks, overriding the default block size (*note Block size::). This option is equivalent to `--block-size=1M'. `-P' `--no-dereference' For each symbolic links encountered by `du', consider the disk space used by the symbolic link. `-S' `--separate-dirs' Normally, in the output of `du' (when not using `--summarize'), the size listed next to a directory name, D, represents the sum of sizes of all entries beneath D as well as the size of D itself. With `--separate-dirs', the size reported for a directory name, D, is merely the `stat.st_size'-derived size of the directory entry, D. `--si' Append an SI-style abbreviation to each size, such as `M' for megabytes. Powers of 1000 are used, not 1024; `M' stands for 1,000,000 bytes. This option is equivalent to `--block-size=si'. Use the `-h' or `--human-readable' option if you prefer powers of 1024. `-s' `--summarize' Display only a total for each argument. `-t SIZE' `--threshold=SIZE' Exclude entries based on a given SIZE (*note Block size::). If SIZE is positive, then `du' will only print entries with a size greater than or equal to that. If SIZE is negative, then `du' will only print entries with a size smaller than or equal to that. Although GNU `find' can be used to find files of a certain size, `du''s `--threshold' option can be used to also filter directories based on a given size. Please note that the `--threshold' option can be combined with the `--apparent-size' option, and in this case would elide entries based on its apparent size. Here's how you would use `--threshold' to find directories with a size greater than or equal to 200 megabytes: du --threshold=200MB Here's how you would use `--threshold' to find directories and files - note the `-a' - with an apparent size smaller than or equal to 500 bytes: du -a -t -500 --apparent-size `--time' Show time of the most recent modification of any file in the directory, or any of its subdirectories. `--time=ctime' `--time=status' `--time=use' Show the most recent status change time (the `ctime' in the inode) of any file in the directory, instead of the modification time. `--time=atime' `--time=access' Show the most recent access time (the `atime' in the inode) of any file in the directory, instead of the modification time. `--time-style=STYLE' List timestamps in style STYLE. This option has an effect only if the `--time' option is also specified. The STYLE should be one of the following: `+FORMAT' List timestamps using FORMAT, where FORMAT is interpreted like the format argument of `date' (*note date invocation::). For example, `--time-style="+%Y-%m-%d %H:%M:%S"' causes `du' to list timestamps like `2002-03-30 23:45:56'. As with `date', FORMAT's interpretation is affected by the `LC_TIME' locale category. `full-iso' List timestamps in full using ISO 8601 date, time, and time zone format with nanosecond precision, e.g., `2002-03-30 23:45:56.477817180 -0700'. This style is equivalent to `+%Y-%m-%d %H:%M:%S.%N %z'. `long-iso' List ISO 8601 date and time in minutes, e.g., `2002-03-30 23:45'. These timestamps are shorter than `full-iso' timestamps, and are usually good enough for everyday work. This style is equivalent to `+%Y-%m-%d %H:%M'. `iso' List ISO 8601 dates for timestamps, e.g., `2002-03-30'. This style is equivalent to `+%Y-%m-%d'. You can specify the default value of the `--time-style' option with the environment variable `TIME_STYLE'; if `TIME_STYLE' is not set the default style is `long-iso'. For compatibility with `ls', if `TIME_STYLE' begins with `+' and contains a newline, the newline and any later characters are ignored; if `TIME_STYLE' begins with `posix-' the `posix-' is ignored; and if `TIME_STYLE' is `locale' it is ignored. `-X FILE' `--exclude-from=FILE' Like `--exclude', except take the patterns to exclude from FILE, one per line. If FILE is `-', take the patterns from standard input. `--exclude=PATTERN' When recursing, skip subdirectories or files matching PATTERN. For example, `du --exclude='*.o'' excludes files whose names end in `.o'. `-x' `--one-file-system' Skip directories that are on different file systems from the one that the argument being processed is on. On BSD systems, `du' reports sizes that are half the correct values for files that are NFS-mounted from HP-UX systems. On HP-UX systems, it reports sizes that are twice the correct values for files that are NFS-mounted from BSD systems. This is due to a flaw in HP-UX; it also affects the HP-UX `du' program. An exit status of zero indicates success, and a nonzero value indicates failure. 14.3 `stat': Report file or file system status ============================================== `stat' displays information about the specified file(s). Synopsis: stat [OPTION]... [FILE]... With no option, `stat' reports all information about the given files. But it also can be used to report the information of the file systems the given files are located on. If the files are links, `stat' can also give information about the files the links point to. Due to shell aliases and built-in `stat' functions, using an unadorned `stat' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env stat ...') to avoid interference from the shell. `-L' `--dereference' Change how `stat' treats symbolic links. With this option, `stat' acts on the file referenced by each symbolic link argument. Without it, `stat' acts on any symbolic link argument directly. `-f' `--file-system' Report information about the file systems where the given files are located instead of information about the files themselves. This option implies the `-L' option. `-c' `--format=FORMAT' Use FORMAT rather than the default format. FORMAT is automatically newline-terminated, so running a command like the following with two or more FILE operands produces a line of output for each operand: $ stat --format=%d:%i / /usr 2050:2 2057:2 `--printf=FORMAT' Use FORMAT rather than the default format. Like `--format', but interpret backslash escapes, and do not output a mandatory trailing newline. If you want a newline, include `\n' in the FORMAT. Here's how you would use `--printf' to print the device and inode numbers of `/' and `/usr': $ stat --printf='%d:%i\n' / /usr 2050:2 2057:2 `-t' `--terse' Print the information in terse form, suitable for parsing by other programs. The valid FORMAT directives for files with `--format' and `--printf' are: * %a - Access rights in octal * %A - Access rights in human readable form * %b - Number of blocks allocated (see `%B') * %B - The size in bytes of each block reported by `%b' * %C - The SELinux security context of a file, if available * %d - Device number in decimal * %D - Device number in hex * %f - Raw mode in hex * %F - File type * %g - Group ID of owner * %G - Group name of owner * %h - Number of hard links * %i - Inode number * %m - Mount point (See note below) * %n - File name * %N - Quoted file name with dereference if symbolic link * %o - Optimal I/O transfer size hint * %s - Total size, in bytes * %t - Major device type in hex * %T - Minor device type in hex * %u - User ID of owner * %U - User name of owner * %w - Time of file birth, or `-' if unknown * %W - Time of file birth as seconds since Epoch, or `0' * %x - Time of last access * %X - Time of last access as seconds since Epoch * %y - Time of last modification * %Y - Time of last modification as seconds since Epoch * %z - Time of last change * %Z - Time of last change as seconds since Epoch The `%W', `%X', `%Y', and `%Z' formats accept a precision preceded by a period to specify the number of digits to print after the decimal point. For example, `%.3X' outputs the last access time to millisecond precision. If a period is given but no precision, `stat' uses 9 digits, so `%.X' is equivalent to `%.9X'. When discarding excess precision, time stamps are truncated toward minus infinity. zero pad: $ stat -c '[%015Y]' /usr [000001288929712] space align: $ stat -c '[%15Y]' /usr [ 1288929712] $ stat -c '[%-15Y]' /usr [1288929712 ] precision: $ stat -c '[%.3Y]' /usr [1288929712.114] $ stat -c '[%.Y]' /usr [1288929712.114951834] The mount point printed by `%m' is similar to that output by `df', except that: * stat does not dereference symlinks by default (unless `-L' is specified) * stat does not search for specified device nodes in the file system list, instead operating on them directly * stat outputs the alias for a bind mounted file, rather than the initial mount point of its backing device. One can recursively call stat until there is no change in output, to get the current base mount point When listing file system information (`--file-system' (`-f')), you must use a different set of FORMAT directives: * %a - Free blocks available to non-super-user * %b - Total data blocks in file system * %c - Total file nodes in file system * %d - Free file nodes in file system * %f - Free blocks in file system * %i - File System ID in hex * %l - Maximum length of file names * %n - File name * %s - Block size (for faster transfers) * %S - Fundamental block size (for block counts) * %t - Type in hex * %T - Type in human readable form Time stamps are listed according to the time zone rules specified by the `TZ' environment variable, or by the system default rules if `TZ' is not set. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. An exit status of zero indicates success, and a nonzero value indicates failure. 14.4 `sync': Synchronize data on disk with memory ================================================= `sync' writes any data buffered in memory out to disk. This can include (but is not limited to) modified superblocks, modified inodes, and delayed reads and writes. This must be implemented by the kernel; The `sync' program does nothing but exercise the `sync' system call. The kernel keeps data in memory to avoid doing (relatively slow) disk reads and writes. This improves performance, but if the computer crashes, data may be lost or the file system corrupted as a result. The `sync' command ensures everything in memory is written to disk. Any arguments are ignored, except for a lone `--help' or `--version' (*note Common options::). An exit status of zero indicates success, and a nonzero value indicates failure. 14.5 `truncate': Shrink or extend the size of a file ==================================================== `truncate' shrinks or extends the size of each FILE to the specified size. Synopsis: truncate OPTION... FILE... Any FILE that does not exist is created. If a FILE is larger than the specified size, the extra data is lost. If a FILE is shorter, it is extended and the extended part (or hole) reads as zero bytes. The program accepts the following options. Also see *note Common options::. `-c' `--no-create' Do not create files that do not exist. `-o' `--io-blocks' Treat SIZE as number of I/O blocks of the FILE rather than bytes. `-r RFILE' `--reference=RFILE' Base the size of each FILE on the size of RFILE. `-s SIZE' `--size=SIZE' Set or adjust the size of each FILE according to SIZE. SIZE may be, or may be an integer optionally followed by, one of the following multiplicative suffixes: `KB' => 1000 (KiloBytes) `K' => 1024 (KibiBytes) `MB' => 1000*1000 (MegaBytes) `M' => 1024*1024 (MebiBytes) `GB' => 1000*1000*1000 (GigaBytes) `G' => 1024*1024*1024 (GibiBytes) and so on for `T', `P', `E', `Z', and `Y'. SIZE may also be prefixed by one of the following to adjust the size of each FILE based on their current size: `+' => extend by `-' => reduce by `<' => at most `>' => at least `/' => round down to multiple of `%' => round up to multiple of An exit status of zero indicates success, and a nonzero value indicates failure. 15 Printing text **************** This section describes commands that display text strings. 15.1 `echo': Print a line of text ================================= `echo' writes each given STRING to standard output, with a space between each and a newline after the last one. Synopsis: echo [OPTION]... [STRING]... Due to shell aliases and built-in `echo' functions, using an unadorned `echo' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env echo ...') to avoid interference from the shell. The program accepts the following options. Also see *note Common options::. Options must precede operands, and the normally-special argument `--' has no special meaning and is treated like any other STRING. `-n' Do not output the trailing newline. `-e' Enable interpretation of the following backslash-escaped characters in each STRING: `\a' alert (bell) `\b' backspace `\c' produce no further output `\e' escape `\f' form feed `\n' newline `\r' carriage return `\t' horizontal tab `\v' vertical tab `\\' backslash `\0NNN' the eight-bit value that is the octal number NNN (zero to three octal digits), if NNN is a nine-bit value, the ninth bit is ignored `\NNN' the eight-bit value that is the octal number NNN (one to three octal digits), if NNN is a nine-bit value, the ninth bit is ignored `\xHH' the eight-bit value that is the hexadecimal number HH (one or two hexadecimal digits) `-E' Disable interpretation of backslash escapes in each STRING. This is the default. If `-e' and `-E' are both specified, the last one given takes effect. If the `POSIXLY_CORRECT' environment variable is set, then when `echo''s first argument is not `-n' it outputs option-like arguments instead of treating them as options. For example, `echo -ne hello' outputs `-ne hello' instead of plain `hello'. POSIX does not require support for any options, and says that the behavior of `echo' is implementation-defined if any STRING contains a backslash or if the first argument is `-n'. Portable programs can use the `printf' command if they need to omit trailing newlines or output control characters or backslashes. *Note printf invocation::. An exit status of zero indicates success, and a nonzero value indicates failure. 15.2 `printf': Format and print data ==================================== `printf' does formatted printing of text. Synopsis: printf FORMAT [ARGUMENT]... `printf' prints the FORMAT string, interpreting `%' directives and `\' escapes to format numeric and string arguments in a way that is mostly similar to the C `printf' function. *Note `printf' format directives: (libc)Output Conversion Syntax, for details. The differences are listed below. Due to shell aliases and built-in `printf' functions, using an unadorned `printf' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env printf ...') to avoid interference from the shell. * The FORMAT argument is reused as necessary to convert all the given ARGUMENTs. For example, the command `printf %s a b' outputs `ab'. * Missing ARGUMENTs are treated as null strings or as zeros, depending on whether the context expects a string or a number. For example, the command `printf %sx%d' prints `x0'. * An additional escape, `\c', causes `printf' to produce no further output. For example, the command `printf 'A%sC\cD%sF' B E' prints `ABC'. * The hexadecimal escape sequence `\xHH' has at most two digits, as opposed to C where it can have an unlimited number of digits. For example, the command `printf '\x07e'' prints two bytes, whereas the C statement `printf ("\x07e")' prints just one. * `printf' has an additional directive, `%b', which prints its argument string with `\' escapes interpreted in the same way as in the FORMAT string, except that octal escapes are of the form `\0OOO' where OOO is 0 to 3 octal digits. If `\OOO' is nine-bit value, ignore the ninth bit. If a precision is also given, it limits the number of bytes printed from the converted string. * Numeric arguments must be single C constants, possibly with leading `+' or `-'. For example, `printf %.4d -3' outputs `-0003'. * If the leading character of a numeric argument is `"' or `'' then its value is the numeric value of the immediately following character. Any remaining characters are silently ignored if the `POSIXLY_CORRECT' environment variable is set; otherwise, a warning is printed. For example, `printf "%d" "'a"' outputs `97' on hosts that use the ASCII character set, since `a' has the numeric value 97 in ASCII. A floating-point argument must use a period before any fractional digits, but is printed according to the `LC_NUMERIC' category of the current locale. For example, in a locale whose radix character is a comma, the command `printf %g 3.14' outputs `3,14' whereas the command `printf %g 3,14' is an error. *Note Floating point::. `printf' interprets `\OOO' in FORMAT as an octal number (if OOO is 1 to 3 octal digits) specifying a byte to print, and `\xHH' as a hexadecimal number (if HH is 1 to 2 hex digits) specifying a character to print. Note however that when `\OOO' specifies a number larger than 255, `printf' ignores the ninth bit. For example, `printf '\400'' is equivalent to `printf '\0''. `printf' interprets two character syntaxes introduced in ISO C 99: `\u' for 16-bit Unicode (ISO/IEC 10646) characters, specified as four hexadecimal digits HHHH, and `\U' for 32-bit Unicode characters, specified as eight hexadecimal digits HHHHHHHH. `printf' outputs the Unicode characters according to the `LC_CTYPE' locale. Unicode characters in the ranges U+0000...U+009F, U+D800...U+DFFF cannot be specified by this syntax, except for U+0024 ($), U+0040 (@), and U+0060 ()`. The processing of `\u' and `\U' requires a full-featured `iconv' facility. It is activated on systems with glibc 2.2 (or newer), or when `libiconv' is installed prior to this package. Otherwise `\u' and `\U' will print as-is. The only options are a lone `--help' or `--version'. *Note Common options::. Options must precede operands. The Unicode character syntaxes are useful for writing strings in a locale independent way. For example, a string containing the Euro currency symbol $ env printf '\u20AC 14.95' will be output correctly in all locales supporting the Euro symbol (ISO-8859-15, UTF-8, and others). Similarly, a Chinese string $ env printf '\u4e2d\u6587' will be output correctly in all Chinese locales (GB2312, BIG5, UTF-8, etc). Note that in these examples, the `printf' command has been invoked via `env' to ensure that we run the program found via your shell's search path, and not a shell alias or a built-in function. For larger strings, you don't need to look up the hexadecimal code values of each character one by one. ASCII characters mixed with \u escape sequences is also known as the JAVA source file encoding. You can use GNU recode 3.5c (or newer) to convert strings to this encoding. Here is how to convert a piece of text into a shell script which will output this text in a locale-independent way: $ LC_CTYPE=zh_CN.big5 /usr/local/bin/printf \ '\u4e2d\u6587\n' > sample.txt $ recode BIG5..JAVA < sample.txt \ | sed -e "s|^|/usr/local/bin/printf '|" -e "s|$|\\\\n'|" \ > sample.sh An exit status of zero indicates success, and a nonzero value indicates failure. 15.3 `yes': Print a string until interrupted ============================================ `yes' prints the command line arguments, separated by spaces and followed by a newline, forever until it is killed. If no arguments are given, it prints `y' followed by a newline forever until killed. Upon a write error, `yes' exits with status `1'. The only options are a lone `--help' or `--version'. To output an argument that begins with `-', precede it with `--', e.g., `yes -- --help'. *Note Common options::. 16 Conditions ************* This section describes commands that are primarily useful for their exit status, rather than their output. Thus, they are often used as the condition of shell `if' statements, or as the last command in a pipeline. 16.1 `false': Do nothing, unsuccessfully ======================================== `false' does nothing except return an exit status of 1, meaning "failure". It can be used as a place holder in shell scripts where an unsuccessful command is needed. In most modern shells, `false' is a built-in command, so when you use `false' in a script, you're probably using the built-in command, not the one documented here. `false' honors the `--help' and `--version' options. This version of `false' is implemented as a C program, and is thus more secure and faster than a shell script implementation, and may safely be used as a dummy shell for the purpose of disabling accounts. Note that `false' (unlike all other programs documented herein) exits unsuccessfully, even when invoked with `--help' or `--version'. Portable programs should not assume that the exit status of `false' is 1, as it is greater than 1 on some non-GNU hosts. 16.2 `true': Do nothing, successfully ===================================== `true' does nothing except return an exit status of 0, meaning "success". It can be used as a place holder in shell scripts where a successful command is needed, although the shell built-in command `:' (colon) may do the same thing faster. In most modern shells, `true' is a built-in command, so when you use `true' in a script, you're probably using the built-in command, not the one documented here. `true' honors the `--help' and `--version' options. Note, however, that it is possible to cause `true' to exit with nonzero status: with the `--help' or `--version' option, and with standard output already closed or redirected to a file that evokes an I/O error. For example, using a Bourne-compatible shell: $ ./true --version >&- ./true: write error: Bad file number $ ./true --version > /dev/full ./true: write error: No space left on device This version of `true' is implemented as a C program, and is thus more secure and faster than a shell script implementation, and may safely be used as a dummy shell for the purpose of disabling accounts. 16.3 `test': Check file types and compare values ================================================ `test' returns a status of 0 (true) or 1 (false) depending on the evaluation of the conditional expression EXPR. Each part of the expression must be a separate argument. `test' has file status checks, string operators, and numeric comparison operators. `test' has an alternate form that uses opening and closing square brackets instead a leading `test'. For example, instead of `test -d /', you can write `[ -d / ]'. The square brackets must be separate arguments; for example, `[-d /]' does not have the desired effect. Since `test EXPR' and `[ EXPR ]' have the same meaning, only the former form is discussed below. Synopses: test EXPRESSION test [ EXPRESSION ] [ ] [ OPTION Due to shell aliases and built-in `test' functions, using an unadorned `test' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env test ...') to avoid interference from the shell. If EXPRESSION is omitted, `test' returns false. If EXPRESSION is a single argument, `test' returns false if the argument is null and true otherwise. The argument can be any string, including strings like `-d', `-1', `--', `--help', and `--version' that most other programs would treat as options. To get help and version information, invoke the commands `[ --help' and `[ --version', without the usual closing brackets. *Note Common options::. Exit status: 0 if the expression is true, 1 if the expression is false, 2 if an error occurred. 16.3.1 File type tests ---------------------- These options test for particular types of files. (Everything's a file, but not all files are the same!) `-b FILE' True if FILE exists and is a block special device. `-c FILE' True if FILE exists and is a character special device. `-d FILE' True if FILE exists and is a directory. `-f FILE' True if FILE exists and is a regular file. `-h FILE' `-L FILE' True if FILE exists and is a symbolic link. Unlike all other file-related tests, this test does not dereference FILE if it is a symbolic link. `-p FILE' True if FILE exists and is a named pipe. `-S FILE' True if FILE exists and is a socket. `-t FD' True if FD is a file descriptor that is associated with a terminal. 16.3.2 Access permission tests ------------------------------ These options test for particular access permissions. `-g FILE' True if FILE exists and has its set-group-ID bit set. `-k FILE' True if FILE exists and has its "sticky" bit set. `-r FILE' True if FILE exists and read permission is granted. `-u FILE' True if FILE exists and has its set-user-ID bit set. `-w FILE' True if FILE exists and write permission is granted. `-x FILE' True if FILE exists and execute permission is granted (or search permission, if it is a directory). `-O FILE' True if FILE exists and is owned by the current effective user ID. `-G FILE' True if FILE exists and is owned by the current effective group ID. 16.3.3 File characteristic tests -------------------------------- These options test other file characteristics. `-e FILE' True if FILE exists. `-s FILE' True if FILE exists and has a size greater than zero. `FILE1 -nt FILE2' True if FILE1 is newer (according to modification date) than FILE2, or if FILE1 exists and FILE2 does not. `FILE1 -ot FILE2' True if FILE1 is older (according to modification date) than FILE2, or if FILE2 exists and FILE1 does not. `FILE1 -ef FILE2' True if FILE1 and FILE2 have the same device and inode numbers, i.e., if they are hard links to each other. 16.3.4 String tests ------------------- These options test string characteristics. You may need to quote STRING arguments for the shell. For example: test -n "$V" The quotes here prevent the wrong arguments from being passed to `test' if `$V' is empty or contains special characters. `-z STRING' True if the length of STRING is zero. `-n STRING' `STRING' True if the length of STRING is nonzero. `STRING1 = STRING2' True if the strings are equal. `STRING1 == STRING2' True if the strings are equal (synonym for =). `STRING1 != STRING2' True if the strings are not equal. 16.3.5 Numeric tests -------------------- Numeric relational operators. The arguments must be entirely numeric (possibly negative), or the special expression `-l STRING', which evaluates to the length of STRING. `ARG1 -eq ARG2' `ARG1 -ne ARG2' `ARG1 -lt ARG2' `ARG1 -le ARG2' `ARG1 -gt ARG2' `ARG1 -ge ARG2' These arithmetic binary operators return true if ARG1 is equal, not-equal, less-than, less-than-or-equal, greater-than, or greater-than-or-equal than ARG2, respectively. For example: test -1 -gt -2 && echo yes => yes test -l abc -gt 1 && echo yes => yes test 0x100 -eq 1 error--> test: integer expression expected before -eq 16.3.6 Connectives for `test' ----------------------------- The usual logical connectives. `! EXPR' True if EXPR is false. `EXPR1 -a EXPR2' True if both EXPR1 and EXPR2 are true. `EXPR1 -o EXPR2' True if either EXPR1 or EXPR2 is true. 16.4 `expr': Evaluate expressions ================================= `expr' evaluates an expression and writes the result on standard output. Each token of the expression must be a separate argument. Operands are either integers or strings. Integers consist of one or more decimal digits, with an optional leading `-'. `expr' converts anything appearing in an operand position to an integer or a string depending on the operation being applied to it. Strings are not quoted for `expr' itself, though you may need to quote them to protect characters with special meaning to the shell, e.g., spaces. However, regardless of whether it is quoted, a string operand should not be a parenthesis or any of `expr''s operators like `+', so you cannot safely pass an arbitrary string `$str' to expr merely by quoting it to the shell. One way to work around this is to use the GNU extension `+', (e.g., `+ "$str" = foo'); a more portable way is to use `" $str"' and to adjust the rest of the expression to take the leading space into account (e.g., `" $str" = " foo"'). You should not pass a negative integer or a string with leading `-' as `expr''s first argument, as it might be misinterpreted as an option; this can be avoided by parenthesization. Also, portable scripts should not use a string operand that happens to take the form of an integer; this can be worked around by inserting leading spaces as mentioned above. Operators may be given as infix symbols or prefix keywords. Parentheses may be used for grouping in the usual manner. You must quote parentheses and many operators to avoid the shell evaluating them, however. When built with support for the GNU MP library, `expr' uses arbitrary-precision arithmetic; otherwise, it uses native arithmetic types and may fail due to arithmetic overflow. The only options are `--help' and `--version'. *Note Common options::. Options must precede operands. Exit status: 0 if the expression is neither null nor 0, 1 if the expression is null or 0, 2 if the expression is invalid, 3 if an internal error occurred (e.g., arithmetic overflow). 16.4.1 String expressions ------------------------- `expr' supports pattern matching and other string operators. These have higher precedence than both the numeric and relational operators (in the next sections). `STRING : REGEX' Perform pattern matching. The arguments are converted to strings and the second is considered to be a (basic, a la GNU `grep') regular expression, with a `^' implicitly prepended. The first argument is then matched against this regular expression. If the match succeeds and REGEX uses `\(' and `\)', the `:' expression returns the part of STRING that matched the subexpression; otherwise, it returns the number of characters matched. If the match fails, the `:' operator returns the null string if `\(' and `\)' are used in REGEX, otherwise 0. Only the first `\( ... \)' pair is relevant to the return value; additional pairs are meaningful only for grouping the regular expression operators. In the regular expression, `\+', `\?', and `\|' are operators which respectively match one or more, zero or one, or separate alternatives. SunOS and other `expr''s treat these as regular characters. (POSIX allows either behavior.) *Note Regular Expression Library: (regex)Top, for details of regular expression syntax. Some examples are in *note Examples of expr::. `match STRING REGEX' An alternative way to do pattern matching. This is the same as `STRING : REGEX'. `substr STRING POSITION LENGTH' Returns the substring of STRING beginning at POSITION with length at most LENGTH. If either POSITION or LENGTH is negative, zero, or non-numeric, returns the null string. `index STRING CHARSET' Returns the first position in STRING where the first character in CHARSET was found. If no character in CHARSET is found in STRING, return 0. `length STRING' Returns the length of STRING. `+ TOKEN' Interpret TOKEN as a string, even if it is a keyword like MATCH or an operator like `/'. This makes it possible to test `expr length + "$x"' or `expr + "$x" : '.*/\(.\)'' and have it do the right thing even if the value of $X happens to be (for example) `/' or `index'. This operator is a GNU extension. Portable shell scripts should use `" $token" : ' \(.*\)'' instead of `+ "$token"'. To make `expr' interpret keywords as strings, you must use the `quote' operator. 16.4.2 Numeric expressions -------------------------- `expr' supports the usual numeric operators, in order of increasing precedence. These numeric operators have lower precedence than the string operators described in the previous section, and higher precedence than the connectives (next section). `+ -' Addition and subtraction. Both arguments are converted to integers; an error occurs if this cannot be done. `* / %' Multiplication, division, remainder. Both arguments are converted to integers; an error occurs if this cannot be done. 16.4.3 Relations for `expr' --------------------------- `expr' supports the usual logical connectives and relations. These have lower precedence than the string and numeric operators (previous sections). Here is the list, lowest-precedence operator first. `|' Returns its first argument if that is neither null nor zero, otherwise its second argument if it is neither null nor zero, otherwise 0. It does not evaluate its second argument if its first argument is neither null nor zero. `&' Return its first argument if neither argument is null or zero, otherwise 0. It does not evaluate its second argument if its first argument is null or zero. `< <= = == != >= >' Compare the arguments and return 1 if the relation is true, 0 otherwise. `==' is a synonym for `='. `expr' first tries to convert both arguments to integers and do a numeric comparison; if either conversion fails, it does a lexicographic comparison using the character collating sequence specified by the `LC_COLLATE' locale. 16.4.4 Examples of using `expr' ------------------------------- Here are a few examples, including quoting for shell metacharacters. To add 1 to the shell variable `foo', in Bourne-compatible shells: foo=$(expr $foo + 1) To print the non-directory part of the file name stored in `$fname', which need not contain a `/': expr $fname : '.*/\(.*\)' '|' $fname An example showing that `\+' is an operator: expr aaa : 'a\+' => 3 expr abc : 'a\(.\)c' => b expr index abcdef cz => 3 expr index index a error--> expr: syntax error expr index + index a => 0 17 Redirection ************** Unix shells commonly provide several forms of "redirection"--ways to change the input source or output destination of a command. But one useful redirection is performed by a separate command, not by the shell; it's described here. 17.1 `tee': Redirect output to multiple files or processes ========================================================== The `tee' command copies standard input to standard output and also to any files given as arguments. This is useful when you want not only to send some data down a pipe, but also to save a copy. Synopsis: tee [OPTION]... [FILE]... If a file being written to does not already exist, it is created. If a file being written to already exists, the data it previously contained is overwritten unless the `-a' option is used. A FILE of `-' causes `tee' to send another copy of input to standard output, but this is typically not that useful as the copies are interleaved. The program accepts the following options. Also see *note Common options::. `-a' `--append' Append standard input to the given files rather than overwriting them. `-i' `--ignore-interrupts' Ignore interrupt signals. The `tee' command is useful when you happen to be transferring a large amount of data and also want to summarize that data without reading it a second time. For example, when you are downloading a DVD image, you often want to verify its signature or checksum right away. The inefficient way to do it is simply: wget http://example.com/some.iso && sha1sum some.iso One problem with the above is that it makes you wait for the download to complete before starting the time-consuming SHA1 computation. Perhaps even more importantly, the above requires reading the DVD image a second time (the first was from the network). The efficient way to do it is to interleave the download and SHA1 computation. Then, you'll get the checksum for free, because the entire process parallelizes so well: # slightly contrived, to demonstrate process substitution wget -O - http://example.com/dvd.iso \ | tee >(sha1sum > dvd.sha1) > dvd.iso That makes `tee' write not just to the expected output file, but also to a pipe running `sha1sum' and saving the final checksum in a file named `dvd.sha1'. Note, however, that this example relies on a feature of modern shells called "process substitution" (the `>(command)' syntax, above; *Note Process Substitution: (bash)Process Substitution.), so it works with `zsh', `bash', and `ksh', but not with `/bin/sh'. So if you write code like this in a shell script, be sure to start the script with `#!/bin/bash'. Since the above example writes to one file and one process, a more conventional and portable use of `tee' is even better: wget -O - http://example.com/dvd.iso \ | tee dvd.iso | sha1sum > dvd.sha1 You can extend this example to make `tee' write to two processes, computing MD5 and SHA1 checksums in parallel. In this case, process substitution is required: wget -O - http://example.com/dvd.iso \ | tee >(sha1sum > dvd.sha1) \ >(md5sum > dvd.md5) \ > dvd.iso This technique is also useful when you want to make a _compressed_ copy of the contents of a pipe. Consider a tool to graphically summarize disk usage data from `du -ak'. For a large hierarchy, `du -ak' can run for a long time, and can easily produce terabytes of data, so you won't want to rerun the command unnecessarily. Nor will you want to save the uncompressed output. Doing it the inefficient way, you can't even start the GUI until after you've compressed all of the `du' output: du -ak | gzip -9 > /tmp/du.gz gzip -d /tmp/du.gz | xdiskusage -a With `tee' and process substitution, you start the GUI right away and eliminate the decompression completely: du -ak | tee >(gzip -9 > /tmp/du.gz) | xdiskusage -a Finally, if you regularly create more than one type of compressed tarball at once, for example when `make dist' creates both `gzip'-compressed and `bzip2'-compressed tarballs, there may be a better way. Typical `automake'-generated `Makefile' rules create the two compressed tar archives with commands in sequence, like this (slightly simplified): tardir=your-pkg-M.N tar chof - "$tardir" | gzip -9 -c > your-pkg-M.N.tar.gz tar chof - "$tardir" | bzip2 -9 -c > your-pkg-M.N.tar.bz2 However, if the hierarchy you are archiving and compressing is larger than a couple megabytes, and especially if you are using a multi-processor system with plenty of memory, then you can do much better by reading the directory contents only once and running the compression programs in parallel: tardir=your-pkg-M.N tar chof - "$tardir" \ | tee >(gzip -9 -c > your-pkg-M.N.tar.gz) \ | bzip2 -9 -c > your-pkg-M.N.tar.bz2 An exit status of zero indicates success, and a nonzero value indicates failure. 18 File name manipulation ************************* This section describes commands that manipulate file names. 18.1 `basename': Strip directory and suffix from a file name ============================================================ `basename' removes any leading directory components from NAME. Synopsis: basename NAME [SUFFIX] basename OPTION... NAME... If SUFFIX is specified and is identical to the end of NAME, it is removed from NAME as well. Note that since trailing slashes are removed prior to suffix matching, SUFFIX will do nothing if it contains slashes. `basename' prints the result on standard output. Together, `basename' and `dirname' are designed such that if `ls "$name"' succeeds, then the command sequence `cd "$(dirname "$name")"; ls "$(basename "$name")"' will, too. This works for everything except file names containing a trailing newline. POSIX allows the implementation to define the results if NAME is empty or `//'. In the former case, GNU `basename' returns the empty string. In the latter case, the result is `//' on platforms where // is distinct from /, and `/' on platforms where there is no difference. The program accepts the following options. Also see *note Common options::. Options must precede operands. `-a' `--multiple' Support more than one argument. Treat every argument as a NAME. With this, an optional SUFFIX must be specified using the `-s' option. `-s SUFFIX' `--suffix=SUFFIX' Remove a trailing SUFFIX. This option implies the `-a' option. `-z' `--zero' Separate output items with NUL characters. An exit status of zero indicates success, and a nonzero value indicates failure. Examples: # Output "sort". basename /usr/bin/sort # Output "stdio". basename include/stdio.h .h # Output "stdio". basename -s .h include/stdio.h # Output "stdio" followed by "stdlib" basename -a -s .h include/stdio.h include/stdlib.h 18.2 `dirname': Strip last file name component ============================================== `dirname' prints all but the final slash-delimited component of each NAME. Slashes on either side of the final component are also removed. If the string contains no slash, `dirname' prints `.' (meaning the current directory). Synopsis: dirname [OPTION] NAME... NAME need not be a file name, but if it is, this operation effectively lists the directory that contains the final component, including the case when the final component is itself a directory. Together, `basename' and `dirname' are designed such that if `ls "$name"' succeeds, then the command sequence `cd "$(dirname "$name")"; ls "$(basename "$name")"' will, too. This works for everything except file names containing a trailing newline. POSIX allows the implementation to define the results if NAME is `//'. With GNU `dirname', the result is `//' on platforms where // is distinct from /, and `/' on platforms where there is no difference. The program accepts the following option. Also see *note Common options::. `-z' `--zero' Separate output items with NUL characters. An exit status of zero indicates success, and a nonzero value indicates failure. Examples: # Output "/usr/bin". dirname /usr/bin/sort dirname /usr/bin//.// # Output "dir1" followed by "dir2" dirname dir1/str dir2/str # Output ".". dirname stdio.h 18.3 `pathchk': Check file name validity and portability ======================================================== `pathchk' checks validity and portability of file names. Synopsis: pathchk [OPTION]... NAME... For each NAME, `pathchk' prints an error message if any of these conditions is true: 1. One of the existing directories in NAME does not have search (execute) permission, 2. The length of NAME is larger than the maximum supported by the operating system. 3. The length of one component of NAME is longer than its file system's maximum. A nonexistent NAME is not an error, so long a file with that name could be created under the above conditions. The program accepts the following options. Also see *note Common options::. Options must precede operands. `-p' Instead of performing checks based on the underlying file system, print an error message if any of these conditions is true: 1. A file name is empty. 2. A file name contains a character outside the POSIX portable file name character set, namely, the ASCII letters and digits, `.', `_', `-', and `/'. 3. The length of a file name or one of its components exceeds the POSIX minimum limits for portability. `-P' Print an error message if a file name is empty, or if it contains a component that begins with `-'. `--portability' Print an error message if a file name is not portable to all POSIX hosts. This option is equivalent to `-p -P'. Exit status: 0 if all specified file names passed all checks, 1 otherwise. 18.4 `mktemp': Create temporary file or directory ================================================= `mktemp' manages the creation of temporary files and directories. Synopsis: mktemp [OPTION]... [TEMPLATE] Safely create a temporary file or directory based on TEMPLATE, and print its name. If given, TEMPLATE must include at least three consecutive `X's in the last component. If omitted, the template `tmp.XXXXXXXXXX' is used, and option `--tmpdir' is implied. The final run of `X's in the TEMPLATE will be replaced by alpha-numeric characters; thus, on a case-sensitive file system, and with a TEMPLATE including a run of N instances of `X', there are `62**N' potential file names. Older scripts used to create temporary files by simply joining the name of the program with the process id (`$$') as a suffix. However, that naming scheme is easily predictable, and suffers from a race condition where the attacker can create an appropriately named symbolic link, such that when the script then opens a handle to what it thought was an unused file, it is instead modifying an existing file. Using the same scheme to create a directory is slightly safer, since the `mkdir' will fail if the target already exists, but it is still inferior because it allows for denial of service attacks. Therefore, modern scripts should use the `mktemp' command to guarantee that the generated name will be unpredictable, and that knowledge of the temporary file name implies that the file was created by the current script and cannot be modified by other users. When creating a file, the resulting file has read and write permissions for the current user, but no permissions for the group or others; these permissions are reduced if the current umask is more restrictive. Here are some examples (although note that if you repeat them, you will most likely get different file names): * Create a temporary file in the current directory. $ mktemp file.XXXX file.H47c * Create a temporary file with a known suffix. $ mktemp --suffix=.txt file-XXXX file-H08W.txt $ mktemp file-XXXX-XXXX.txt file-XXXX-eI9L.txt * Create a secure fifo relative to the user's choice of `TMPDIR', but falling back to the current directory rather than `/tmp'. Note that `mktemp' does not create fifos, but can create a secure directory in which the fifo can live. Exit the shell if the directory or fifo could not be created. $ dir=$(mktemp -p "${TMPDIR:-.}" -d dir-XXXX) || exit 1 $ fifo=$dir/fifo $ mkfifo "$fifo" || { rmdir "$dir"; exit 1; } * Create and use a temporary file if possible, but ignore failure. The file will reside in the directory named by `TMPDIR', if specified, or else in `/tmp'. $ file=$(mktemp -q) && { > # Safe to use $file only within this block. Use quotes, > # since $TMPDIR, and thus $file, may contain whitespace. > echo ... > "$file" > rm "$file" > } * Act as a semi-random character generator (it is not fully random, since it is impacted by the contents of the current directory). To avoid security holes, do not use the resulting names to create a file. $ mktemp -u XXX Gb9 $ mktemp -u XXX nzC The program accepts the following options. Also see *note Common options::. `-d' `--directory' Create a directory rather than a file. The directory will have read, write, and search permissions for the current user, but no permissions for the group or others; these permissions are reduced if the current umask is more restrictive. `-q' `--quiet' Suppress diagnostics about failure to create a file or directory. The exit status will still reflect whether a file was created. `-u' `--dry-run' Generate a temporary name that does not name an existing file, without changing the file system contents. Using the output of this command to create a new file is inherently unsafe, as there is a window of time between generating the name and using it where another process can create an object by the same name. `-p DIR' `--tmpdir[=DIR]' Treat TEMPLATE relative to the directory DIR. If DIR is not specified (only possible with the long option `--tmpdir') or is the empty string, use the value of `TMPDIR' if available, otherwise use `/tmp'. If this is specified, TEMPLATE must not be absolute. However, TEMPLATE can still contain slashes, although intermediate directories must already exist. `--suffix=SUFFIX' Append SUFFIX to the TEMPLATE. SUFFIX must not contain slash. If `--suffix' is specified, TEMPLATE must end in `X'; if it is not specified, then an appropriate `--suffix' is inferred by finding the last `X' in TEMPLATE. This option exists for use with the default TEMPLATE and for the creation of a SUFFIX that starts with `X'. `-t' Treat TEMPLATE as a single file relative to the value of `TMPDIR' if available, or to the directory specified by `-p', otherwise to `/tmp'. TEMPLATE must not contain slashes. This option is deprecated; the use of `-p' without `-t' offers better defaults (by favoring the command line over `TMPDIR') and more flexibility (by allowing intermediate directories). Exit status: 0 if the file was created, 1 otherwise. 18.5 `realpath': Print the resolved file name. ============================================== `realpath' expands all symbolic links and resolves references to `/./', `/../' and extra `/' characters. By default, all but the last component of the specified files must exist. Synopsis: realpath [OPTION]... FILE... The program accepts the following options. Also see *note Common options::. `-e' `--canonicalize-existing' Ensure that all components of the specified file names exist. If any component is missing or unavailable, `realpath' will output a diagnostic unless the `-q' option is specified, and exit with a nonzero exit code. A trailing slash requires that the name resolve to a directory. `-m' `--canonicalize-missing' If any component of a specified file name is missing or unavailable, treat it as a directory. `-L' `--logical' Symbolic links are resolved in the specified file names, but they are resolved after any subsequent `..' components are processed. `-P' `--physical' Symbolic links are resolved in the specified file names, and they are resolved before any subsequent `..' components are processed. This is the default mode of operation. `-q' `--quiet' Suppress diagnostic messages for specified file names. `-s' `--strip' `--no-symlinks' Do not resolve symbolic links. Only resolve references to `/./', `/../' and remove extra `/' characters. When combined with the `-m' option, realpath operates only on the file name, and does not touch any actual file. `-z' `--zero' Separate output items with NUL characters. `--relative-to=FILE' Print the resolved file names relative to the specified file. Note this option honors the `-m' and `-e' options pertaining to file existence. `--relative-base=BASE' This option is valid when used with `--relative-to', and will restrict the output of `--relative-to' so that relative names are output, only when FILEs are descendants of BASE. Otherwise output the absolute file name. If `--relative-to' was not specified, then the descendants of BASE are printed relative to BASE. If `--relative-to' is specified, then that directory must be a descendant of BASE for this option to have an effect. Note: this option honors the `-m' and `-e' options pertaining to file existence. For example: realpath --relative-to=/usr /tmp /usr/bin => ../tmp => bin realpath --relative-base=/usr /tmp /usr/bin => /tmp => bin Exit status: 0 if all file names were printed without issue. 1 otherwise. 19 Working context ****************** This section describes commands that display or alter the context in which you are working: the current directory, the terminal settings, and so forth. See also the user-related commands in the next section. 19.1 `pwd': Print working directory =================================== `pwd' prints the name of the current directory. Synopsis: pwd [OPTION]... The program accepts the following options. Also see *note Common options::. `-L' `--logical' If the contents of the environment variable `PWD' provide an absolute name of the current directory with no `.' or `..' components, but possibly with symbolic links, then output those contents. Otherwise, fall back to default `-P' handling. `-P' `--physical' Print a fully resolved name for the current directory. That is, all components of the printed name will be actual directory names--none will be symbolic links. If `-L' and `-P' are both given, the last one takes precedence. If neither option is given, then this implementation uses `-P' as the default unless the `POSIXLY_CORRECT' environment variable is set. Due to shell aliases and built-in `pwd' functions, using an unadorned `pwd' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env pwd ...') to avoid interference from the shell. An exit status of zero indicates success, and a nonzero value indicates failure. 19.2 `stty': Print or change terminal characteristics ===================================================== `stty' prints or changes terminal characteristics, such as baud rate. Synopses: stty [OPTION] [SETTING]... stty [OPTION] If given no line settings, `stty' prints the baud rate, line discipline number (on systems that support it), and line settings that have been changed from the values set by `stty sane'. By default, mode reading and setting are performed on the tty line connected to standard input, although this can be modified by the `--file' option. `stty' accepts many non-option arguments that change aspects of the terminal line operation, as described below. The program accepts the following options. Also see *note Common options::. `-a' `--all' Print all current settings in human-readable form. This option may not be used in combination with any line settings. `-F DEVICE' `--file=DEVICE' Set the line opened by the file name specified in DEVICE instead of the tty line connected to standard input. This option is necessary because opening a POSIX tty requires use of the `O_NONDELAY' flag to prevent a POSIX tty from blocking until the carrier detect line is high if the `clocal' flag is not set. Hence, it is not always possible to allow the shell to open the device in the traditional manner. `-g' `--save' Print all current settings in a form that can be used as an argument to another `stty' command to restore the current settings. This option may not be used in combination with any line settings. Many settings can be turned off by preceding them with a `-'. Such arguments are marked below with "May be negated" in their description. The descriptions themselves refer to the positive case, that is, when _not_ negated (unless stated otherwise, of course). Some settings are not available on all POSIX systems, since they use extensions. Such arguments are marked below with "Non-POSIX" in their description. On non-POSIX systems, those or other settings also may not be available, but it's not feasible to document all the variations: just try it and see. An exit status of zero indicates success, and a nonzero value indicates failure. 19.2.1 Control settings ----------------------- Control settings: `parenb' Generate parity bit in output and expect parity bit in input. May be negated. `parodd' Set odd parity (even if negated). May be negated. `cs5' `cs6' `cs7' `cs8' Set character size to 5, 6, 7, or 8 bits. `hup' `hupcl' Send a hangup signal when the last process closes the tty. May be negated. `cstopb' Use two stop bits per character (one if negated). May be negated. `cread' Allow input to be received. May be negated. `clocal' Disable modem control signals. May be negated. `crtscts' Enable RTS/CTS flow control. Non-POSIX. May be negated. `cdtrdsr' Enable DTR/DSR flow control. Non-POSIX. May be negated. 19.2.2 Input settings --------------------- These settings control operations on data received from the terminal. `ignbrk' Ignore break characters. May be negated. `brkint' Make breaks cause an interrupt signal. May be negated. `ignpar' Ignore characters with parity errors. May be negated. `parmrk' Mark parity errors (with a 255-0-character sequence). May be negated. `inpck' Enable input parity checking. May be negated. `istrip' Clear high (8th) bit of input characters. May be negated. `inlcr' Translate newline to carriage return. May be negated. `igncr' Ignore carriage return. May be negated. `icrnl' Translate carriage return to newline. May be negated. `iutf8' Assume input characters are UTF-8 encoded. May be negated. `ixon' Enable XON/XOFF flow control (that is, `CTRL-S'/`CTRL-Q'). May be negated. `ixoff' `tandem' Enable sending of `stop' character when the system input buffer is almost full, and `start' character when it becomes almost empty again. May be negated. `iuclc' Translate uppercase characters to lowercase. Non-POSIX. May be negated. Note ilcuc is not implemented, as one would not be able to issue almost any (lowercase) Unix command, after invoking it. `ixany' Allow any character to restart output (only the start character if negated). Non-POSIX. May be negated. `imaxbel' Enable beeping and not flushing input buffer if a character arrives when the input buffer is full. Non-POSIX. May be negated. 19.2.3 Output settings ---------------------- These settings control operations on data sent to the terminal. `opost' Postprocess output. May be negated. `olcuc' Translate lowercase characters to uppercase. Non-POSIX. May be negated. (Note ouclc is not currently implemented.) `ocrnl' Translate carriage return to newline. Non-POSIX. May be negated. `onlcr' Translate newline to carriage return-newline. Non-POSIX. May be negated. `onocr' Do not print carriage returns in the first column. Non-POSIX. May be negated. `onlret' Newline performs a carriage return. Non-POSIX. May be negated. `ofill' Use fill (padding) characters instead of timing for delays. Non-POSIX. May be negated. `ofdel' Use ASCII DEL characters for fill instead of ASCII NUL characters. Non-POSIX. May be negated. `nl1' `nl0' Newline delay style. Non-POSIX. `cr3' `cr2' `cr1' `cr0' Carriage return delay style. Non-POSIX. `tab3' `tab2' `tab1' `tab0' Horizontal tab delay style. Non-POSIX. `bs1' `bs0' Backspace delay style. Non-POSIX. `vt1' `vt0' Vertical tab delay style. Non-POSIX. `ff1' `ff0' Form feed delay style. Non-POSIX. 19.2.4 Local settings --------------------- `isig' Enable `interrupt', `quit', and `suspend' special characters. May be negated. `icanon' Enable `erase', `kill', `werase', and `rprnt' special characters. May be negated. `iexten' Enable non-POSIX special characters. May be negated. `echo' Echo input characters. May be negated. `echoe' `crterase' Echo `erase' characters as backspace-space-backspace. May be negated. `echok' Echo a newline after a `kill' character. May be negated. `echonl' Echo newline even if not echoing other characters. May be negated. `noflsh' Disable flushing after `interrupt' and `quit' special characters. May be negated. `xcase' Enable input and output of uppercase characters by preceding their lowercase equivalents with `\', when `icanon' is set. Non-POSIX. May be negated. `tostop' Stop background jobs that try to write to the terminal. Non-POSIX. May be negated. `echoprt' `prterase' Echo erased characters backward, between `\' and `/'. Non-POSIX. May be negated. `echoctl' `ctlecho' Echo control characters in hat notation (`^C') instead of literally. Non-POSIX. May be negated. `echoke' `crtkill' Echo the `kill' special character by erasing each character on the line as indicated by the `echoprt' and `echoe' settings, instead of by the `echoctl' and `echok' settings. Non-POSIX. May be negated. 19.2.5 Combination settings --------------------------- Combination settings: `evenp' `parity' Same as `parenb -parodd cs7'. May be negated. If negated, same as `-parenb cs8'. `oddp' Same as `parenb parodd cs7'. May be negated. If negated, same as `-parenb cs8'. `nl' Same as `-icrnl -onlcr'. May be negated. If negated, same as `icrnl -inlcr -igncr onlcr -ocrnl -onlret'. `ek' Reset the `erase' and `kill' special characters to their default values. `sane' Same as: cread -ignbrk brkint -inlcr -igncr icrnl -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke and also sets all special characters to their default values. `cooked' Same as `brkint ignpar istrip icrnl ixon opost isig icanon', plus sets the `eof' and `eol' characters to their default values if they are the same as the `min' and `time' characters. May be negated. If negated, same as `raw'. `raw' Same as: -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -isig -icanon -xcase min 1 time 0 May be negated. If negated, same as `cooked'. `cbreak' Same as `-icanon'. May be negated. If negated, same as `icanon'. `pass8' Same as `-parenb -istrip cs8'. May be negated. If negated, same as `parenb istrip cs7'. `litout' Same as `-parenb -istrip -opost cs8'. May be negated. If negated, same as `parenb istrip opost cs7'. `decctlq' Same as `-ixany'. Non-POSIX. May be negated. `tabs' Same as `tab0'. Non-POSIX. May be negated. If negated, same as `tab3'. `lcase' `LCASE' Same as `xcase iuclc olcuc'. Non-POSIX. May be negated. (Used for terminals with uppercase characters only.) `crt' Same as `echoe echoctl echoke'. `dec' Same as `echoe echoctl echoke -ixany intr ^C erase ^? kill C-u'. 19.2.6 Special characters ------------------------- The special characters' default values vary from system to system. They are set with the syntax `name value', where the names are listed below and the value can be given either literally, in hat notation (`^C'), or as an integer which may start with `0x' to indicate hexadecimal, `0' to indicate octal, or any other digit to indicate decimal. For GNU stty, giving a value of `^-' or `undef' disables that special character. (This is incompatible with Ultrix `stty', which uses a value of `u' to disable a special character. GNU `stty' treats a value `u' like any other, namely to set that special character to .) `intr' Send an interrupt signal. `quit' Send a quit signal. `erase' Erase the last character typed. `kill' Erase the current line. `eof' Send an end of file (terminate the input). `eol' End the line. `eol2' Alternate character to end the line. Non-POSIX. `swtch' Switch to a different shell layer. Non-POSIX. `start' Restart the output after stopping it. `stop' Stop the output. `susp' Send a terminal stop signal. `dsusp' Send a terminal stop signal after flushing the input. Non-POSIX. `rprnt' Redraw the current line. Non-POSIX. `werase' Erase the last word typed. Non-POSIX. `lnext' Enter the next character typed literally, even if it is a special character. Non-POSIX. 19.2.7 Special settings ----------------------- `min N' Set the minimum number of characters that will satisfy a read until the time value has expired, when `-icanon' is set. `time N' Set the number of tenths of a second before reads time out if the minimum number of characters have not been read, when `-icanon' is set. `ispeed N' Set the input speed to N. `ospeed N' Set the output speed to N. `rows N' Tell the tty kernel driver that the terminal has N rows. Non-POSIX. `cols N' `columns N' Tell the kernel that the terminal has N columns. Non-POSIX. `size' Print the number of rows and columns that the kernel thinks the terminal has. (Systems that don't support rows and columns in the kernel typically use the environment variables `LINES' and `COLUMNS' instead; however, GNU `stty' does not know anything about them.) Non-POSIX. `line N' Use line discipline N. Non-POSIX. `speed' Print the terminal speed. `N' Set the input and output speeds to N. N can be one of: 0 50 75 110 134 134.5 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 `exta' `extb'. `exta' is the same as 19200; `extb' is the same as 38400. Many systems, including GNU/Linux, support higher speeds. The `stty' command includes support for speeds of 57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, or 4000000 where the system supports these. 0 hangs up the line if `-clocal' is set. 19.3 `printenv': Print all or some environment variables ======================================================== `printenv' prints environment variable values. Synopsis: printenv [OPTION] [VARIABLE]... If no VARIABLEs are specified, `printenv' prints the value of every environment variable. Otherwise, it prints the value of each VARIABLE that is set, and nothing for those that are not set. The program accepts the following option. Also see *note Common options::. `-0' `--null' Output a zero byte (ASCII NUL) at the end of each line, rather than a newline. This option enables other programs to parse the output of `printenv' even when that output would contain data with embedded newlines. Exit status: 0 if all variables specified were found 1 if at least one specified variable was not found 2 if a write error occurred 19.4 `tty': Print file name of terminal on standard input ========================================================= `tty' prints the file name of the terminal connected to its standard input. It prints `not a tty' if standard input is not a terminal. Synopsis: tty [OPTION]... The program accepts the following option. Also see *note Common options::. `-s' `--silent' `--quiet' Print nothing; only return an exit status. Exit status: 0 if standard input is a terminal 1 if standard input is not a terminal 2 if given incorrect arguments 3 if a write error occurs 20 User information ******************* This section describes commands that print user-related information: logins, groups, and so forth. 20.1 `id': Print user identity ============================== `id' prints information about the given user, or the process running it if no user is specified. Synopsis: id [OPTION]... [USERNAME] By default, it prints the real user ID, real group ID, effective user ID if different from the real user ID, effective group ID if different from the real group ID, and supplemental group IDs. In addition, if SELinux is enabled and the `POSIXLY_CORRECT' environment variable is not set, then print `context=C', where C is the security context. Each of these numeric values is preceded by an identifying string and followed by the corresponding user or group name in parentheses. The options cause `id' to print only part of the above information. Also see *note Common options::. `-g' `--group' Print only the group ID. `-G' `--groups' Print only the group ID and the supplementary groups. `-n' `--name' Print the user or group name instead of the ID number. Requires `-u', `-g', or `-G'. `-r' `--real' Print the real, instead of effective, user or group ID. Requires `-u', `-g', or `-G'. `-u' `--user' Print only the user ID. `-Z' `--context' Print only the security context of the current user. If SELinux is disabled then print a warning and set the exit status to 1. An exit status of zero indicates success, and a nonzero value indicates failure. Primary and supplementary groups for a process are normally inherited from its parent and are usually unchanged since login. This means that if you change the group database after logging in, `id' will not reflect your changes within your existing login session. Running `id' with a user argument causes the user and group database to be consulted afresh, and so will give a different result. 20.2 `logname': Print current login name ======================================== `logname' prints the calling user's name, as found in a system-maintained file (often `/var/run/utmp' or `/etc/utmp'), and exits with a status of 0. If there is no entry for the calling process, `logname' prints an error message and exits with a status of 1. The only options are `--help' and `--version'. *Note Common options::. An exit status of zero indicates success, and a nonzero value indicates failure. 20.3 `whoami': Print effective user ID ====================================== `whoami' prints the user name associated with the current effective user ID. It is equivalent to the command `id -un'. The only options are `--help' and `--version'. *Note Common options::. An exit status of zero indicates success, and a nonzero value indicates failure. 20.4 `groups': Print group names a user is in ============================================= `groups' prints the names of the primary and any supplementary groups for each given USERNAME, or the current process if no names are given. If more than one name is given, the name of each user is printed before the list of that user's groups and the user name is separated from the group list by a colon. Synopsis: groups [USERNAME]... The group lists are equivalent to the output of the command `id -Gn'. Primary and supplementary groups for a process are normally inherited from its parent and are usually unchanged since login. This means that if you change the group database after logging in, `groups' will not reflect your changes within your existing login session. Running `groups' with a list of users causes the user and group database to be consulted afresh, and so will give a different result. The only options are `--help' and `--version'. *Note Common options::. An exit status of zero indicates success, and a nonzero value indicates failure. 20.5 `users': Print login names of users currently logged in ============================================================ `users' prints on a single line a blank-separated list of user names of users currently logged in to the current host. Each user name corresponds to a login session, so if a user has more than one login session, that user's name will appear the same number of times in the output. Synopsis: users [FILE] With no FILE argument, `users' extracts its information from a system-maintained file (often `/var/run/utmp' or `/etc/utmp'). If a file argument is given, `users' uses that file instead. A common choice is `/var/log/wtmp'. The only options are `--help' and `--version'. *Note Common options::. An exit status of zero indicates success, and a nonzero value indicates failure. 20.6 `who': Print who is currently logged in ============================================ `who' prints information about users who are currently logged on. Synopsis: `who' [OPTION] [FILE] [am i] If given no non-option arguments, `who' prints the following information for each user currently logged on: login name, terminal line, login time, and remote hostname or X display. If given one non-option argument, `who' uses that instead of a default system-maintained file (often `/var/run/utmp' or `/etc/utmp') as the name of the file containing the record of users logged on. `/var/log/wtmp' is commonly given as an argument to `who' to look at who has previously logged on. If given two non-option arguments, `who' prints only the entry for the user running it (determined from its standard input), preceded by the hostname. Traditionally, the two arguments given are `am i', as in `who am i'. Time stamps are listed according to the time zone rules specified by the `TZ' environment variable, or by the system default rules if `TZ' is not set. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. The program accepts the following options. Also see *note Common options::. `-a' `--all' Same as `-b -d --login -p -r -t -T -u'. `-b' `--boot' Print the date and time of last system boot. `-d' `--dead' Print information corresponding to dead processes. `-H' `--heading' Print a line of column headings. `-l' `--login' List only the entries that correspond to processes via which the system is waiting for a user to login. The user name is always `LOGIN'. `--lookup' Attempt to canonicalize hostnames found in utmp through a DNS lookup. This is not the default because it can cause significant delays on systems with automatic dial-up internet access. `-m' Same as `who am i'. `-p' `--process' List active processes spawned by init. `-q' `--count' Print only the login names and the number of users logged on. Overrides all other options. `-r' `--runlevel' Print the current (and maybe previous) run-level of the init process. `-s' Ignored; for compatibility with other versions of `who'. `-t' `--time' Print last system clock change. `-u' After the login time, print the number of hours and minutes that the user has been idle. `.' means the user was active in the last minute. `old' means the user has been idle for more than 24 hours. `-w' `-T' `--mesg' `--message' `--writable' After each login name print a character indicating the user's message status: `+' allowing `write' messages `-' disallowing `write' messages `?' cannot find terminal device An exit status of zero indicates success, and a nonzero value indicates failure. 21 System context ***************** This section describes commands that print or change system-wide information. 21.1 `date': Print or set system date and time ============================================== Synopses: date [OPTION]... [+FORMAT] date [-u|--utc|--universal] [ MMDDhhmm[[CC]YY][.ss] ] Invoking `date' with no FORMAT argument is equivalent to invoking it with a default format that depends on the `LC_TIME' locale category. In the default C locale, this format is `'+%a %b %e %H:%M:%S %Z %Y'', so the output looks like `Thu Mar 3 13:47:51 PST 2005'. Normally, `date' uses the time zone rules indicated by the `TZ' environment variable, or the system default rules if `TZ' is not set. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. If given an argument that starts with a `+', `date' prints the current date and time (or the date and time specified by the `--date' option, see below) in the format defined by that argument, which is similar to that of the `strftime' function. Except for conversion specifiers, which start with `%', characters in the format string are printed unchanged. The conversion specifiers are described below. An exit status of zero indicates success, and a nonzero value indicates failure. 21.1.1 Time conversion specifiers --------------------------------- `date' conversion specifiers related to times. `%H' hour (`00'...`23') `%I' hour (`01'...`12') `%k' hour, space padded (` 0'...`23'); equivalent to `%_H'. This is a GNU extension. `%l' hour, space padded (` 1'...`12'); equivalent to `%_I'. This is a GNU extension. `%M' minute (`00'...`59') `%N' nanoseconds (`000000000'...`999999999'). This is a GNU extension. `%p' locale's equivalent of either `AM' or `PM'; blank in many locales. Noon is treated as `PM' and midnight as `AM'. `%P' like `%p', except lower case. This is a GNU extension. `%r' locale's 12-hour clock time (e.g., `11:11:04 PM') `%R' 24-hour hour and minute. Same as `%H:%M'. `%s' seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC. Leap seconds are not counted unless leap second support is available. *Note %s-examples::, for examples. This is a GNU extension. `%S' second (`00'...`60'). This may be `60' if leap seconds are supported. `%T' 24-hour hour, minute, and second. Same as `%H:%M:%S'. `%X' locale's time representation (e.g., `23:13:48') `%z' RFC 2822/ISO 8601 style numeric time zone (e.g., `-0600' or `+0530'), or nothing if no time zone is determinable. This value reflects the numeric time zone appropriate for the current time, using the time zone rules specified by the `TZ' environment variable. The time (and optionally, the time zone rules) can be overridden by the `--date' option. `%:z' RFC 3339/ISO 8601 style numeric time zone with `:' (e.g., `-06:00' or `+05:30'), or nothing if no time zone is determinable. This is a GNU extension. `%::z' Numeric time zone to the nearest second with `:' (e.g., `-06:00:00' or `+05:30:00'), or nothing if no time zone is determinable. This is a GNU extension. `%:::z' Numeric time zone with `:' using the minimum necessary precision (e.g., `-06', `+05:30', or `-04:56:02'), or nothing if no time zone is determinable. This is a GNU extension. `%Z' alphabetic time zone abbreviation (e.g., `EDT'), or nothing if no time zone is determinable. See `%z' for how it is determined. 21.1.2 Date conversion specifiers --------------------------------- `date' conversion specifiers related to dates. `%a' locale's abbreviated weekday name (e.g., `Sun') `%A' locale's full weekday name, variable length (e.g., `Sunday') `%b' locale's abbreviated month name (e.g., `Jan') `%B' locale's full month name, variable length (e.g., `January') `%c' locale's date and time (e.g., `Thu Mar 3 23:05:25 2005') `%C' century. This is like `%Y', except the last two digits are omitted. For example, it is `20' if `%Y' is `2000', and is `-0' if `%Y' is `-001'. It is normally at least two characters, but it may be more. `%d' day of month (e.g., `01') `%D' date; same as `%m/%d/%y' `%e' day of month, space padded; same as `%_d' `%F' full date in ISO 8601 format; same as `%Y-%m-%d'. This is a good choice for a date format, as it is standard and is easy to sort in the usual case where years are in the range 0000...9999. `%g' year corresponding to the ISO week number, but without the century (range `00' through `99'). This has the same format and value as `%y', except that if the ISO week number (see `%V') belongs to the previous or next year, that year is used instead. `%G' year corresponding to the ISO week number. This has the same format and value as `%Y', except that if the ISO week number (see `%V') belongs to the previous or next year, that year is used instead. It is normally useful only if `%V' is also used; for example, the format `%G-%m-%d' is probably a mistake, since it combines the ISO week number year with the conventional month and day. `%h' same as `%b' `%j' day of year (`001'...`366') `%m' month (`01'...`12') `%u' day of week (`1'...`7') with `1' corresponding to Monday `%U' week number of year, with Sunday as the first day of the week (`00'...`53'). Days in a new year preceding the first Sunday are in week zero. `%V' ISO week number, that is, the week number of year, with Monday as the first day of the week (`01'...`53'). If the week containing January 1 has four or more days in the new year, then it is considered week 1; otherwise, it is week 53 of the previous year, and the next week is week 1. (See the ISO 8601 standard.) `%w' day of week (`0'...`6') with 0 corresponding to Sunday `%W' week number of year, with Monday as first day of week (`00'...`53'). Days in a new year preceding the first Monday are in week zero. `%x' locale's date representation (e.g., `12/31/99') `%y' last two digits of year (`00'...`99') `%Y' year. This is normally at least four characters, but it may be more. Year `0000' precedes year `0001', and year `-001' precedes year `0000'. 21.1.3 Literal conversion specifiers ------------------------------------ `date' conversion specifiers that produce literal strings. `%%' a literal % `%n' a newline `%t' a horizontal tab 21.1.4 Padding and other flags ------------------------------ Unless otherwise specified, `date' normally pads numeric fields with zeros, so that, for example, numeric months are always output as two digits. Seconds since the epoch are not padded, though, since there is no natural width for them. As a GNU extension, `date' recognizes any of the following optional flags after the `%': `-' (hyphen) Do not pad the field; useful if the output is intended for human consumption. `_' (underscore) Pad with spaces; useful if you need a fixed number of characters in the output, but zeros are too distracting. `0' (zero) Pad with zeros even if the conversion specifier would normally pad with spaces. `^' Use upper case characters if possible. `#' Use opposite case characters if possible. A field that is normally upper case becomes lower case, and vice versa. Here are some examples of padding: date +%d/%m -d "Feb 1" => 01/02 date +%-d/%-m -d "Feb 1" => 1/2 date +%_d/%_m -d "Feb 1" => 1/ 2 As a GNU extension, you can specify the field width (after any flag, if present) as a decimal number. If the natural size of the output of the field has less than the specified number of characters, the result is written right adjusted and padded to the given size. For example, `%9B' prints the right adjusted month name in a field of width 9. An optional modifier can follow the optional flag and width specification. The modifiers are: `E' Use the locale's alternate representation for date and time. This modifier applies to the `%c', `%C', `%x', `%X', `%y' and `%Y' conversion specifiers. In a Japanese locale, for example, `%Ex' might yield a date format based on the Japanese Emperors' reigns. `O' Use the locale's alternate numeric symbols for numbers. This modifier applies only to numeric conversion specifiers. If the format supports the modifier but no alternate representation is available, it is ignored. 21.1.5 Setting the time ----------------------- If given an argument that does not start with `+', `date' sets the system clock to the date and time specified by that argument (as described below). You must have appropriate privileges to set the system clock. Note for changes to persist across a reboot, the hardware clock may need to be updated from the system clock, which might not happen automatically on your system. The argument must consist entirely of digits, which have the following meaning: `MM' month `DD' day within month `hh' hour `mm' minute `CC' first two digits of year (optional) `YY' last two digits of year (optional) `ss' second (optional) Note, the `--date' and `--set' options may not be used with an argument in the above format. The `--universal' option may be used with such an argument to indicate that the specified date and time are relative to Coordinated Universal Time rather than to the local time zone. 21.1.6 Options for `date' ------------------------- The program accepts the following options. Also see *note Common options::. `-d DATESTR' `--date=DATESTR' Display the date and time specified in DATESTR instead of the current date and time. DATESTR can be in almost any common format. It can contain month names, time zones, `am' and `pm', `yesterday', etc. For example, `--date="2004-02-27 14:19:13.489392193 +0530"' specifies the instant of time that is 489,392,193 nanoseconds after February 27, 2004 at 2:19:13 PM in a time zone that is 5 hours and 30 minutes east of UTC. Note: input currently must be in locale independent format. E.g., the LC_TIME=C below is needed to print back the correct date in many locales: date -d "$(LC_TIME=C date)" *Note Date input formats::. `-f DATEFILE' `--file=DATEFILE' Parse each line in DATEFILE as with `-d' and display the resulting date and time. If DATEFILE is `-', use standard input. This is useful when you have many dates to process, because the system overhead of starting up the `date' executable many times can be considerable. `-I[TIMESPEC]' `--iso-8601[=TIMESPEC]' Display the date using the ISO 8601 format, `%Y-%m-%d'. The argument TIMESPEC specifies the number of additional terms of the time to include. It can be one of the following: `auto' Print just the date. This is the default if TIMESPEC is omitted. `hours' Append the hour of the day to the date. `minutes' Append the hours and minutes. `seconds' Append the hours, minutes and seconds. `ns' Append the hours, minutes, seconds and nanoseconds. If showing any time terms, then include the time zone using the format `%z'. `-r FILE' `--reference=FILE' Display the date and time of the last modification of FILE, instead of the current date and time. `-R' `--rfc-822' `--rfc-2822' Display the date and time using the format `%a, %d %b %Y %H:%M:%S %z', evaluated in the C locale so abbreviations are always in English. For example: Fri, 09 Sep 2005 13:51:39 -0700 This format conforms to Internet RFCs 2822 (ftp://ftp.rfc-editor.org/in-notes/rfc2822.txt) and 822 (ftp://ftp.rfc-editor.org/in-notes/rfc822.txt), the current and previous standards for Internet email. `--rfc-3339=TIMESPEC' Display the date using a format specified by Internet RFC 3339 (ftp://ftp.rfc-editor.org/in-notes/rfc3339.txt). This is a subset of the ISO 8601 format, except that it also permits applications to use a space rather than a `T' to separate dates from times. Unlike the other standard formats, RFC 3339 format is always suitable as input for the `--date' (`-d') and `--file' (`-f') options, regardless of the current locale. The argument TIMESPEC specifies how much of the time to include. It can be one of the following: `date' Print just the full-date, e.g., `2005-09-14'. This is equivalent to the format `%Y-%m-%d'. `seconds' Print the full-date and full-time separated by a space, e.g., `2005-09-14 00:56:06+05:30'. The output ends with a numeric time-offset; here the `+05:30' means that local time is five hours and thirty minutes east of UTC. This is equivalent to the format `%Y-%m-%d %H:%M:%S%:z'. `ns' Like `seconds', but also print nanoseconds, e.g., `2005-09-14 00:56:06.998458565+05:30'. This is equivalent to the format `%Y-%m-%d %H:%M:%S.%N%:z'. `-s DATESTR' `--set=DATESTR' Set the date and time to DATESTR. See `-d' above. See also *note Setting the time::. `-u' `--utc' `--universal' Use Coordinated Universal Time (UTC) by operating as if the `TZ' environment variable were set to the string `UTC0'. Coordinated Universal Time is often called "Greenwich Mean Time" (GMT) for historical reasons. Typically, systems ignore leap seconds and thus implement an approximation to UTC rather than true UTC. 21.1.7 Examples of `date' ------------------------- Here are a few examples. Also see the documentation for the `-d' option in the previous section. * To print the date of the day before yesterday: date --date='2 days ago' * To print the date of the day three months and one day hence: date --date='3 months 1 day' * To print the day of year of Christmas in the current year: date --date='25 Dec' +%j * To print the current full month name and the day of the month: date '+%B %d' But this may not be what you want because for the first nine days of the month, the `%d' expands to a zero-padded two-digit field, for example `date -d 1may '+%B %d'' will print `May 01'. * To print a date without the leading zero for one-digit days of the month, you can use the (GNU extension) `-' flag to suppress the padding altogether: date -d 1may '+%B %-d * To print the current date and time in the format required by many non-GNU versions of `date' when setting the system clock: date +%m%d%H%M%Y.%S * To set the system clock forward by two minutes: date --set='+2 minutes' * To print the date in RFC 2822 format, use `date --rfc-2822'. Here is some example output: Fri, 09 Sep 2005 13:51:39 -0700 * To convert a date string to the number of seconds since the epoch (which is 1970-01-01 00:00:00 UTC), use the `--date' option with the `%s' format. That can be useful in sorting and/or graphing and/or comparing data by date. The following command outputs the number of the seconds since the epoch for the time two minutes after the epoch: date --date='1970-01-01 00:02:00 +0000' +%s 120 If you do not specify time zone information in the date string, `date' uses your computer's idea of the time zone when interpreting the string. For example, if your computer's time zone is that of Cambridge, Massachusetts, which was then 5 hours (i.e., 18,000 seconds) behind UTC: # local time zone used date --date='1970-01-01 00:02:00' +%s 18120 * If you're sorting or graphing dated data, your raw date values may be represented as seconds since the epoch. But few people can look at the date `946684800' and casually note "Oh, that's the first second of the year 2000 in Greenwich, England." date --date='2000-01-01 UTC' +%s 946684800 An alternative is to use the `--utc' (`-u') option. Then you may omit `UTC' from the date string. Although this produces the same result for `%s' and many other format sequences, with a time zone offset different from zero, it would give a different result for zone-dependent formats like `%z'. date -u --date=2000-01-01 +%s 946684800 To convert such an unwieldy number of seconds back to a more readable form, use a command like this: # local time zone used date -d '1970-01-01 UTC 946684800 seconds' +"%Y-%m-%d %T %z" 1999-12-31 19:00:00 -0500 Or if you do not mind depending on the `@' feature present since coreutils 5.3.0, you could shorten this to: date -d @946684800 +"%F %T %z" 1999-12-31 19:00:00 -0500 Often it is better to output UTC-relative date and time: date -u -d '1970-01-01 946684800 seconds' +"%Y-%m-%d %T %z" 2000-01-01 00:00:00 +0000 * Typically the seconds count omits leap seconds, but some systems are exceptions. Because leap seconds are not predictable, the mapping between the seconds count and a future timestamp is not reliable on the atypical systems that include leap seconds in their counts. Here is how the two kinds of systems handle the leap second at 2012-06-30 23:59:60 UTC: # Typical systems ignore leap seconds: date --date='2012-06-30 23:59:59 +0000' +%s 1341100799 date --date='2012-06-30 23:59:60 +0000' +%s date: invalid date '2012-06-30 23:59:60 +0000' date --date='2012-07-01 00:00:00 +0000' +%s 1341100800 # Atypical systems count leap seconds: date --date='2012-06-30 23:59:59 +0000' +%s 1341100823 date --date='2012-06-30 23:59:60 +0000' +%s 1341100824 date --date='2012-07-01 00:00:00 +0000' +%s 1341100825 21.2 `arch': Print machine hardware name ======================================== `arch' prints the machine hardware name, and is equivalent to `uname -m'. Synopsis: arch [OPTION] The program accepts the *note Common options:: only. An exit status of zero indicates success, and a nonzero value indicates failure. 21.3 `nproc': Print the number of available processors ====================================================== Print the number of processing units available to the current process, which may be less than the number of online processors. If this information is not accessible, then print the number of processors installed. If the `OMP_NUM_THREADS' environment variable is set, then it will determine the returned value. The result is guaranteed to be greater than zero. Synopsis: nproc [OPTION] The program accepts the following options. Also see *note Common options::. `--all' Print the number of installed processors on the system, which may be greater than the number online or available to the current process. The `OMP_NUM_THREADS' environment variable is not honored in this case. `--ignore=NUMBER' If possible, exclude this NUMBER of processing units. An exit status of zero indicates success, and a nonzero value indicates failure. 21.4 `uname': Print system information ====================================== `uname' prints information about the machine and operating system it is run on. If no options are given, `uname' acts as if the `-s' option were given. Synopsis: uname [OPTION]... If multiple options or `-a' are given, the selected information is printed in this order: KERNEL-NAME NODENAME KERNEL-RELEASE KERNEL-VERSION MACHINE PROCESSOR HARDWARE-PLATFORM OPERATING-SYSTEM The information may contain internal spaces, so such output cannot be parsed reliably. In the following example, RELEASE is `2.2.18ss.e820-bda652a #4 SMP Tue Jun 5 11:24:08 PDT 2001': uname -a => Linux dumdum 2.2.18 #4 SMP Tue Jun 5 11:24:08 PDT 2001 i686 unknown unknown GNU/Linux The program accepts the following options. Also see *note Common options::. `-a' `--all' Print all of the below information, except omit the processor type and the hardware platform name if they are unknown. `-i' `--hardware-platform' Print the hardware platform name (sometimes called the hardware implementation). Print `unknown' if the kernel does not make this information easily available, as is the case with Linux kernels. `-m' `--machine' Print the machine hardware name (sometimes called the hardware class or hardware type). `-n' `--nodename' Print the network node hostname. `-p' `--processor' Print the processor type (sometimes called the instruction set architecture or ISA). Print `unknown' if the kernel does not make this information easily available, as is the case with Linux kernels. `-o' `--operating-system' Print the name of the operating system. `-r' `--kernel-release' Print the kernel release. `-s' `--kernel-name' Print the kernel name. POSIX 1003.1-2001 (*note Standards conformance::) calls this "the implementation of the operating system", because the POSIX specification itself has no notion of "kernel". The kernel name might be the same as the operating system name printed by the `-o' or `--operating-system' option, but it might differ. Some operating systems (e.g., FreeBSD, HP-UX) have the same name as their underlying kernels; others (e.g., GNU/Linux, Solaris) do not. `-v' `--kernel-version' Print the kernel version. An exit status of zero indicates success, and a nonzero value indicates failure. 21.5 `hostname': Print or set system name ========================================= With no arguments, `hostname' prints the name of the current host system. With one argument, it sets the current host name to the specified string. You must have appropriate privileges to set the host name. Synopsis: hostname [NAME] The only options are `--help' and `--version'. *Note Common options::. An exit status of zero indicates success, and a nonzero value indicates failure. 21.6 `hostid': Print numeric host identifier ============================================ `hostid' prints the numeric identifier of the current host in hexadecimal. This command accepts no arguments. The only options are `--help' and `--version'. *Note Common options::. For example, here's what it prints on one system I use: $ hostid 1bac013d On that system, the 32-bit quantity happens to be closely related to the system's Internet address, but that isn't always the case. An exit status of zero indicates success, and a nonzero value indicates failure. 21.7 `uptime': Print system uptime and load =========================================== `uptime' prints the current time, the system's uptime, the number of logged-in users and the current load average. If an argument is specified, it is used as the file to be read to discover how many users are logged in. If no argument is specified, a system default is used (`uptime --help' indicates the default setting). The only options are `--help' and `--version'. *Note Common options::. For example, here's what it prints right now on one system I use: $ uptime 14:07 up 3:35, 3 users, load average: 1.39, 1.15, 1.04 The precise method of calculation of load average varies somewhat between systems. Some systems calculate it as the average number of runnable processes over the last 1, 5 and 15 minutes, but some systems also include processes in the uninterruptible sleep state (that is, those processes which are waiting for disk I/O). The Linux kernel includes uninterruptible processes. 22 SELinux context ****************** This section describes commands for operations with SELinux contexts. 22.1 `chcon': Change SELinux context of file ============================================ `chcon' changes the SELinux security context of the selected files. Synopses: chcon [OPTION]... CONTEXT FILE... chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE... chcon [OPTION]... --reference=RFILE FILE... Change the SELinux security context of each FILE to CONTEXT. With `--reference', change the security context of each FILE to that of RFILE. The program accepts the following options. Also see *note Common options::. `--dereference' Do not affect symbolic links but what they refer to; this is the default. `-h' `--no-dereference' Affect the symbolic links themselves instead of any referenced file. `--reference=RFILE' Use RFILE's security context rather than specifying a CONTEXT value. `-R' `--recursive' Operate on files and directories recursively. `--preserve-root' Refuse to operate recursively on the root directory, `/', when used together with the `--recursive' option. *Note Treating / specially::. `--no-preserve-root' Do not treat the root directory, `/', specially when operating recursively; this is the default. *Note Treating / specially::. `-H' If `--recursive' (`-R') is specified and a command line argument is a symbolic link to a directory, traverse it. *Note Traversing symlinks::. `-L' In a recursive traversal, traverse every symbolic link to a directory that is encountered. *Note Traversing symlinks::. `-P' Do not traverse any symbolic links. This is the default if none of `-H', `-L', or `-P' is specified. *Note Traversing symlinks::. `-v' `--verbose' Output a diagnostic for every file processed. `-u USER' `--user=USER' Set user USER in the target security context. `-r ROLE' `--role=ROLE' Set role ROLE in the target security context. `-t TYPE' `--type=TYPE' Set type TYPE in the target security context. `-l RANGE' `--range=RANGE' Set range RANGE in the target security context. An exit status of zero indicates success, and a nonzero value indicates failure. 22.2 `runcon': Run a command in specified SELinux context ========================================================= `runcon' runs file in specified SELinux security context. Synopses: runcon CONTEXT COMMAND [ARGS] runcon [ -c ] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [ARGS] Run COMMAND with completely-specified CONTEXT, or with current or transitioned security context modified by one or more of LEVEL, ROLE, TYPE and USER. If none of `-c', `-t', `-u', `-r', or `-l' is specified, the first argument is used as the complete context. Any additional arguments after COMMAND are interpreted as arguments to the command. With neither CONTEXT nor COMMAND, print the current security context. The program accepts the following options. Also see *note Common options::. `-c' `--compute' Compute process transition context before modifying. `-u USER' `--user=USER' Set user USER in the target security context. `-r ROLE' `--role=ROLE' Set role ROLE in the target security context. `-t TYPE' `--type=TYPE' Set type TYPE in the target security context. `-l RANGE' `--range=RANGE' Set range RANGE in the target security context. Exit status: 126 if COMMAND is found but cannot be invoked 127 if `runcon' itself fails or if COMMAND cannot be found the exit status of COMMAND otherwise 23 Modified command invocation ****************************** This section describes commands that run other commands in some context different than the current one: a modified environment, as a different user, etc. 23.1 `chroot': Run a command with a different root directory ============================================================ `chroot' runs a command with a specified root directory. On many systems, only the super-user can do this.(1) Synopses: chroot OPTION NEWROOT [COMMAND [ARGS]...] chroot OPTION Ordinarily, file names are looked up starting at the root of the directory structure, i.e., `/'. `chroot' changes the root to the directory NEWROOT (which must exist) and then runs COMMAND with optional ARGS. If COMMAND is not specified, the default is the value of the `SHELL' environment variable or `/bin/sh' if not set, invoked with the `-i' option. COMMAND must not be a special built-in utility (*note Special built-in utilities::). The program accepts the following options. Also see *note Common options::. Options must precede operands. `--userspec=USER[:GROUP]' By default, COMMAND is run with the same credentials as the invoking process. Use this option to run it as a different USER and/or with a different primary GROUP. `--groups=GROUPS' Use this option to specify the supplementary GROUPS to be used by the new process. The items in the list (names or numeric IDs) must be separated by commas. Here are a few tips to help avoid common problems in using chroot. To start with a simple example, make COMMAND refer to a statically linked binary. If you were to use a dynamically linked executable, then you'd have to arrange to have the shared libraries in the right place under your new root directory. For example, if you create a statically linked `ls' executable, and put it in `/tmp/empty', you can run this command as root: $ chroot /tmp/empty /ls -Rl / Then you'll see output like this: /: total 1023 -rwxr-xr-x 1 0 0 1041745 Aug 16 11:17 ls If you want to use a dynamically linked executable, say `bash', then first run `ldd bash' to see what shared objects it needs. Then, in addition to copying the actual binary, also copy the listed files to the required positions under your intended new root directory. Finally, if the executable requires any other files (e.g., data, state, device files), copy them into place, too. Exit status: 125 if `chroot' itself fails 126 if COMMAND is found but cannot be invoked 127 if COMMAND cannot be found the exit status of COMMAND otherwise ---------- Footnotes ---------- (1) However, some systems (e.g., FreeBSD) can be configured to allow certain regular users to use the `chroot' system call, and hence to run this program. Also, on Cygwin, anyone can run the `chroot' command, because the underlying function is non-privileged due to lack of support in MS-Windows. 23.2 `env': Run a command in a modified environment =================================================== `env' runs a command with a modified environment. Synopses: env [OPTION]... [NAME=VALUE]... [COMMAND [ARGS]...] env Operands of the form `VARIABLE=VALUE' set the environment variable VARIABLE to value VALUE. VALUE may be empty (`VARIABLE='). Setting a variable to an empty value is different from unsetting it. These operands are evaluated left-to-right, so if two operands mention the same variable the earlier is ignored. Environment variable names can be empty, and can contain any characters other than `=' and ASCII NUL. However, it is wise to limit yourself to names that consist solely of underscores, digits, and ASCII letters, and that begin with a non-digit, as applications like the shell do not work well with other names. The first operand that does not contain the character `=' specifies the program to invoke; it is searched for according to the `PATH' environment variable. Any remaining arguments are passed as arguments to that program. The program should not be a special built-in utility (*note Special built-in utilities::). Modifications to `PATH' take effect prior to searching for COMMAND. Use caution when reducing `PATH'; behavior is not portable when `PATH' is undefined or omits key directories such as `/bin'. In the rare case that a utility contains a `=' in the name, the only way to disambiguate it from a variable assignment is to use an intermediate command for COMMAND, and pass the problematic program name via ARGS. For example, if `./prog=' is an executable in the current `PATH': env prog= true # runs 'true', with prog= in environment env ./prog= true # runs 'true', with ./prog= in environment env -- prog= true # runs 'true', with prog= in environment env sh -c '\prog= true' # runs 'prog=' with argument 'true' env sh -c 'exec "$@"' sh prog= true # also runs 'prog=' If no command name is specified following the environment specifications, the resulting environment is printed. This is like specifying the `printenv' program. For some examples, suppose the environment passed to `env' contains `LOGNAME=rms', `EDITOR=emacs', and `PATH=.:/gnubin:/hacks': * Output the current environment. $ env | LC_ALL=C sort EDITOR=emacs LOGNAME=rms PATH=.:/gnubin:/hacks * Run `foo' with a reduced environment, preserving only the original `PATH' to avoid problems in locating `foo'. env - PATH="$PATH" foo * Run `foo' with the environment containing `LOGNAME=rms', `EDITOR=emacs', and `PATH=.:/gnubin:/hacks', and guarantees that `foo' was found in the file system rather than as a shell built-in. env foo * Run `nemacs' with the environment containing `LOGNAME=foo', `EDITOR=emacs', `PATH=.:/gnubin:/hacks', and `DISPLAY=gnu:0'. env DISPLAY=gnu:0 LOGNAME=foo nemacs * Attempt to run the program `/energy/--' (as that is the only possible path search result); if the command exists, the environment will contain `LOGNAME=rms' and `PATH=/energy', and the arguments will be `e=mc2', `bar', and `baz'. env -u EDITOR PATH=/energy -- e=mc2 bar baz The program accepts the following options. Also see *note Common options::. Options must precede operands. `-0' `--null' Output a zero byte (ASCII NUL) at the end of each line, rather than a newline. This option enables other programs to parse the output of `env' even when that output would contain data with embedded newlines. `-u NAME' `--unset=NAME' Remove variable NAME from the environment, if it was in the environment. `-' `-i' `--ignore-environment' Start with an empty environment, ignoring the inherited environment. Exit status: 0 if no COMMAND is specified and the environment is output 125 if `env' itself fails 126 if COMMAND is found but cannot be invoked 127 if COMMAND cannot be found the exit status of COMMAND otherwise 23.3 `nice': Run a command with modified niceness ================================================= `nice' prints a process's "niceness", or runs a command with modified niceness. "niceness" affects how favorably the process is scheduled in the system. Synopsis: nice [OPTION]... [COMMAND [ARG]...] If no arguments are given, `nice' prints the current niceness. Otherwise, `nice' runs the given COMMAND with its niceness adjusted. By default, its niceness is incremented by 10. Niceness values range at least from -20 (process has high priority and gets more resources, thus slowing down other processes) through 19 (process has lower priority and runs slowly itself, but has less impact on the speed of other running processes). Some systems may have a wider range of niceness values; conversely, other systems may enforce more restrictive limits. An attempt to set the niceness outside the supported range is treated as an attempt to use the minimum or maximum supported value. A niceness should not be confused with a scheduling priority, which lets applications determine the order in which threads are scheduled to run. Unlike a priority, a niceness is merely advice to the scheduler, which the scheduler is free to ignore. Also, as a point of terminology, POSIX defines the behavior of `nice' in terms of a "nice value", which is the nonnegative difference between a niceness and the minimum niceness. Though `nice' conforms to POSIX, its documentation and diagnostics use the term "niceness" for compatibility with historical practice. COMMAND must not be a special built-in utility (*note Special built-in utilities::). Due to shell aliases and built-in `nice' functions, using an unadorned `nice' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env nice ...') to avoid interference from the shell. Note to change the "niceness" of an existing process, one needs to use the `renice' command. The program accepts the following option. Also see *note Common options::. Options must precede operands. `-n ADJUSTMENT' `--adjustment=ADJUSTMENT' Add ADJUSTMENT instead of 10 to the command's niceness. If ADJUSTMENT is negative and you lack appropriate privileges, `nice' issues a warning but otherwise acts as if you specified a zero adjustment. For compatibility `nice' also supports an obsolete option syntax `-ADJUSTMENT'. New scripts should use `-n ADJUSTMENT' instead. Exit status: 0 if no COMMAND is specified and the niceness is output 125 if `nice' itself fails 126 if COMMAND is found but cannot be invoked 127 if COMMAND cannot be found the exit status of COMMAND otherwise It is sometimes useful to run a non-interactive program with reduced niceness. $ nice factor 4611686018427387903 Since `nice' prints the current niceness, you can invoke it through itself to demonstrate how it works. The default behavior is to increase the niceness by `10': $ nice 0 $ nice nice 10 $ nice -n 10 nice 10 The ADJUSTMENT is relative to the current niceness. In the next example, the first `nice' invocation runs the second one with niceness 10, and it in turn runs the final one with a niceness that is 3 more: $ nice nice -n 3 nice 13 Specifying a niceness larger than the supported range is the same as specifying the maximum supported value: $ nice -n 10000000000 nice 19 Only a privileged user may run a process with lower niceness: $ nice -n -1 nice nice: cannot set niceness: Permission denied 0 $ sudo nice -n -1 nice -1 23.4 `nohup': Run a command immune to hangups ============================================= `nohup' runs the given COMMAND with hangup signals ignored, so that the command can continue running in the background after you log out. Synopsis: nohup COMMAND [ARG]... If standard input is a terminal, it is redirected from `/dev/null' so that terminal sessions do not mistakenly consider the terminal to be used by the command. This is a GNU extension; programs intended to be portable to non-GNU hosts should use `nohup COMMAND [ARG]... make.log `nohup' does not automatically put the command it runs in the background; you must do that explicitly, by ending the command line with an `&'. Also, `nohup' does not alter the niceness of COMMAND; use `nice' for that, e.g., `nohup nice COMMAND'. COMMAND must not be a special built-in utility (*note Special built-in utilities::). The only options are `--help' and `--version'. *Note Common options::. Options must precede operands. Exit status: 125 if `nohup' itself fails, and `POSIXLY_CORRECT' is not set 126 if COMMAND is found but cannot be invoked 127 if COMMAND cannot be found the exit status of COMMAND otherwise If `POSIXLY_CORRECT' is set, internal failures give status 127 instead of 125. 23.5 `stdbuf': Run a command with modified I/O stream buffering =============================================================== `stdbuf' allows one to modify the buffering operations of the three standard I/O streams associated with a program. Synopsis: stdbuf OPTION... COMMAND COMMAND must start with the name of a program that 1. uses the ISO C `FILE' streams for input/output (note the programs `dd' and `cat' don't do that), 2. does not adjust the buffering of its standard streams (note the program `tee' is not in this category). Any additional ARGs are passed as additional arguments to the COMMAND. The program accepts the following options. Also see *note Common options::. `-i MODE' `--input=MODE' Adjust the standard input stream buffering. `-o MODE' `--output=MODE' Adjust the standard output stream buffering. `-e MODE' `--error=MODE' Adjust the standard error stream buffering. The MODE can be specified as follows: `L' Set the stream to line buffered mode. In this mode data is coalesced until a newline is output or input is read from any stream attached to a terminal device. This option is invalid with standard input. `0' Disable buffering of the selected stream. In this mode, data is output immediately and only the amount of data requested is read from input. Note the difference in function for input and output. Disabling buffering for input will not influence the responsiveness or blocking behavior of the stream input functions. For example `fread' will still block until `EOF' or error, even if the underlying `read' returns less data than requested. `SIZE' Specify the size of the buffer to use in fully buffered mode. SIZE may be, or may be an integer optionally followed by, one of the following multiplicative suffixes: `KB' => 1000 (KiloBytes) `K' => 1024 (KibiBytes) `MB' => 1000*1000 (MegaBytes) `M' => 1024*1024 (MebiBytes) `GB' => 1000*1000*1000 (GigaBytes) `G' => 1024*1024*1024 (GibiBytes) and so on for `T', `P', `E', `Z', and `Y'. Exit status: 125 if `stdbuf' itself fails 126 if COMMAND is found but cannot be invoked 127 if COMMAND cannot be found the exit status of COMMAND otherwise 23.6 `timeout': Run a command with a time limit =============================================== `timeout' runs the given COMMAND and kills it if it is still running after the specified time interval. Synopsis: timeout [OPTION] DURATION COMMAND [ARG]... COMMAND must not be a special built-in utility (*note Special built-in utilities::). The program accepts the following options. Also see *note Common options::. Options must precede operands. `--preserve-status' Return the exit status of the managed COMMAND on timeout, rather than a specific exit status indicating a timeout. This is useful if the managed COMMAND supports running for an indeterminite amount of time. `--foreground' Don't create a separate background program group, so that the managed COMMAND can use the foreground TTY normally. This is needed to support timing out commands not started directly from an interactive shell, in two situations. 1. COMMAND is interactive and needs to read from the terminal for example 2. the user wants to support sending signals directly to COMMAND from the terminal (like Ctrl-C for example) Note in this mode of operation, any children of COMMAND will not be timed out. `-k DURATION' `--kill-after=DURATION' Ensure the monitored COMMAND is killed by also sending a `KILL' signal, after the specified DURATION. Without this option, if the selected signal proves not to be fatal, `timeout' does not kill the COMMAND. `-s SIGNAL' `--signal=SIGNAL' Send this SIGNAL to COMMAND on timeout, rather than the default `TERM' signal. SIGNAL may be a name like `HUP' or a number. *Note Signal specifications::. DURATION is a floating point number followed by an optional unit: `s' for seconds (the default) `m' for minutes `h' for hours `d' for days A duration of 0 disables the associated timeout. Note that the actual timeout duration is dependent on system conditions, which should be especially considered when specifying sub-second timeouts. Exit status: 124 if COMMAND times out 125 if `timeout' itself fails 126 if COMMAND is found but cannot be invoked 127 if COMMAND cannot be found 137 if COMMAND is sent the KILL(9) signal (128+9) the exit status of COMMAND otherwise 24 Process control ****************** 24.1 `kill': Send a signal to processes ======================================= The `kill' command sends a signal to processes, causing them to terminate or otherwise act upon receiving the signal in some way. Alternatively, it lists information about signals. Synopses: kill [-s SIGNAL | --signal SIGNAL | -SIGNAL] PID... kill [-l | --list | -t | --table] [SIGNAL]... Due to shell aliases and built-in `kill' functions, using an unadorned `kill' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env kill ...') to avoid interference from the shell. The first form of the `kill' command sends a signal to all PID arguments. The default signal to send if none is specified is `TERM'. The special signal number `0' does not denote a valid signal, but can be used to test whether the PID arguments specify processes to which a signal could be sent. If PID is positive, the signal is sent to the process with the process ID PID. If PID is zero, the signal is sent to all processes in the process group of the current process. If PID is -1, the signal is sent to all processes for which the user has permission to send a signal. If PID is less than -1, the signal is sent to all processes in the process group that equals the absolute value of PID. If PID is not positive, a system-dependent set of system processes is excluded from the list of processes to which the signal is sent. If a negative PID argument is desired as the first one, it should be preceded by `--'. However, as a common extension to POSIX, `--' is not required with `kill -SIGNAL -PID'. The following commands are equivalent: kill -15 -1 kill -TERM -1 kill -s TERM -- -1 kill -- -1 The first form of the `kill' command succeeds if every PID argument specifies at least one process that the signal was sent to. The second form of the `kill' command lists signal information. Either the `-l' or `--list' option, or the `-t' or `--table' option must be specified. Without any SIGNAL argument, all supported signals are listed. The output of `-l' or `--list' is a list of the signal names, one per line; if SIGNAL is already a name, the signal number is printed instead. The output of `-t' or `--table' is a table of signal numbers, names, and descriptions. This form of the `kill' command succeeds if all SIGNAL arguments are valid and if there is no output error. The `kill' command also supports the `--help' and `--version' options. *Note Common options::. A SIGNAL may be a signal name like `HUP', or a signal number like `1', or an exit status of a process terminated by the signal. A signal name can be given in canonical form or prefixed by `SIG'. The case of the letters is ignored, except for the `-SIGNAL' option which must use upper case to avoid ambiguity with lower case option letters. *Note Signal specifications::, for a list of supported signal names and numbers. 25 Delaying *********** 25.1 `sleep': Delay for a specified time ======================================== `sleep' pauses for an amount of time specified by the sum of the values of the command line arguments. Synopsis: sleep NUMBER[smhd]... Each argument is a number followed by an optional unit; the default is seconds. The units are: `s' seconds `m' minutes `h' hours `d' days Historical implementations of `sleep' have required that NUMBER be an integer, and only accepted a single argument without a suffix. However, GNU `sleep' accepts arbitrary floating point numbers. *Note Floating point::. The only options are `--help' and `--version'. *Note Common options::. Due to shell aliases and built-in `sleep' functions, using an unadorned `sleep' interactively or in a script may get you different functionality than that described here. Invoke it via `env' (i.e., `env sleep ...') to avoid interference from the shell. An exit status of zero indicates success, and a nonzero value indicates failure. 26 Numeric operations ********************* These programs do numerically-related operations. 26.1 `factor': Print prime factors ================================== `factor' prints prime factors. Synopses: factor [NUMBER]... factor OPTION If no NUMBER is specified on the command line, `factor' reads numbers from standard input, delimited by newlines, tabs, or spaces. The `factor' command supports only a small number of options: `--help' Print a short help on standard output, then exit without further processing. `--version' Print the program version on standard output, then exit without further processing. Factoring the product of the eighth and ninth Mersenne primes takes about 30 milliseconds of CPU time on a 2.2 GHz Athlon. M8=$(echo 2^31-1|bc) M9=$(echo 2^61-1|bc) n=$(echo "$M8 * $M9" | bc) /usr/bin/time -f %U factor $n 4951760154835678088235319297: 2147483647 2305843009213693951 0.03 Similarly, factoring the eighth Fermat number 2^256+1 takes about 20 seconds on the same machine. Factoring large numbers is, in general, hard. The Pollard Rho algorithm used by `factor' is particularly effective for numbers with relatively small factors. If you wish to factor large numbers which do not have small factors (for example, numbers which are the product of two large primes), other methods are far better. If `factor' is built without using GNU MP, only single-precision arithmetic is available, and so large numbers (typically 2^64 and above) will not be supported. The single-precision code uses an algorithm which is designed for factoring smaller numbers. An exit status of zero indicates success, and a nonzero value indicates failure. 26.2 `seq': Print numeric sequences =================================== `seq' prints a sequence of numbers to standard output. Synopses: seq [OPTION]... LAST seq [OPTION]... FIRST LAST seq [OPTION]... FIRST INCREMENT LAST `seq' prints the numbers from FIRST to LAST by INCREMENT. By default, each number is printed on a separate line. When INCREMENT is not specified, it defaults to `1', even when FIRST is larger than LAST. FIRST also defaults to `1'. So `seq 1' prints `1', but `seq 0' and `seq 10 5' produce no output. Floating-point numbers may be specified. *Note Floating point::. The program accepts the following options. Also see *note Common options::. Options must precede operands. `-f FORMAT' `--format=FORMAT' Print all numbers using FORMAT. FORMAT must contain exactly one of the `printf'-style floating point conversion specifications `%a', `%e', `%f', `%g', `%A', `%E', `%F', `%G'. The `%' may be followed by zero or more flags taken from the set `-+#0 '', then an optional width containing one or more digits, then an optional precision consisting of a `.' followed by zero or more digits. FORMAT may also contain any number of `%%' conversion specifications. All conversion specifications have the same meaning as with `printf'. The default format is derived from FIRST, STEP, and LAST. If these all use a fixed point decimal representation, the default format is `%.Pf', where P is the minimum precision that can represent the output numbers exactly. Otherwise, the default format is `%g'. `-s STRING' `--separator=STRING' Separate numbers with STRING; default is a newline. The output always terminates with a newline. `-w' `--equal-width' Print all numbers with the same width, by padding with leading zeros. FIRST, STEP, and LAST should all use a fixed point decimal representation. (To have other kinds of padding, use `--format'). You can get finer-grained control over output with `-f': $ seq -f '(%9.2E)' -9e5 1.1e6 1.3e6 (-9.00E+05) ( 2.00E+05) ( 1.30E+06) If you want hexadecimal integer output, you can use `printf' to perform the conversion: $ printf '%x\n' $(seq 1048575 1024 1050623) fffff 1003ff 1007ff For very long lists of numbers, use xargs to avoid system limitations on the length of an argument list: $ seq 1000000 | xargs printf '%x\n' | tail -n 3 f423e f423f f4240 To generate octal output, use the printf `%o' format instead of `%x'. On most systems, seq can produce whole-number output for values up to at least 2^53. Larger integers are approximated. The details differ depending on your floating-point implementation. *Note Floating point::. A common case is that `seq' works with integers through 2^64, and larger integers may not be numerically correct: $ seq 50000000000000000000 2 50000000000000000004 50000000000000000000 50000000000000000000 50000000000000000004 However, note that when limited to non-negative whole numbers, an increment of 1 and no format-specifying option, seq can print arbitrarily large numbers. Be careful when using `seq' with outlandish values: otherwise you may see surprising results, as `seq' uses floating point internally. For example, on the x86 platform, where the internal representation uses a 64-bit fraction, the command: seq 1 0.0000000000000000001 1.0000000000000000009 outputs 1.0000000000000000007 twice and skips 1.0000000000000000008. An exit status of zero indicates success, and a nonzero value indicates failure. 27 File permissions ******************* Each file has a set of "file mode bits" that control the kinds of access that users have to that file. They can be represented either in symbolic form or as an octal number. 27.1 Structure of File Mode Bits ================================ The file mode bits have two parts: the "file permission bits", which control ordinary access to the file, and "special mode bits", which affect only some files. There are three kinds of permissions that a user can have for a file: 1. permission to read the file. For directories, this means permission to list the contents of the directory. 2. permission to write to (change) the file. For directories, this means permission to create and remove files in the directory. 3. permission to execute the file (run it as a program). For directories, this means permission to access files in the directory. There are three categories of users who may have different permissions to perform any of the above operations on a file: 1. the file's owner; 2. other users who are in the file's group; 3. everyone else. Files are given an owner and group when they are created. Usually the owner is the current user and the group is the group of the directory the file is in, but this varies with the operating system, the file system the file is created on, and the way the file is created. You can change the owner and group of a file by using the `chown' and `chgrp' commands. In addition to the three sets of three permissions listed above, the file mode bits have three special components, which affect only executable files (programs) and, on most systems, directories: 1. Set the process's effective user ID to that of the file upon execution (called the "set-user-ID bit", or sometimes the "setuid bit"). For directories on a few systems, give files created in the directory the same owner as the directory, no matter who creates them, and set the set-user-ID bit of newly-created subdirectories. 2. Set the process's effective group ID to that of the file upon execution (called the "set-group-ID bit", or sometimes the "setgid bit"). For directories on most systems, give files created in the directory the same group as the directory, no matter what group the user who creates them is in, and set the set-group-ID bit of newly-created subdirectories. 3. Prevent unprivileged users from removing or renaming a file in a directory unless they own the file or the directory; this is called the "restricted deletion flag" for the directory, and is commonly found on world-writable directories like `/tmp'. For regular files on some older systems, save the program's text image on the swap device so it will load more quickly when run; this is called the "sticky bit". In addition to the file mode bits listed above, there may be file attributes specific to the file system, e.g., access control lists (ACLs), whether a file is compressed, whether a file can be modified (immutability), and whether a file can be dumped. These are usually set using programs specific to the file system. For example: ext2 On GNU and GNU/Linux the file attributes specific to the ext2 file system are set using `chattr'. FFS On FreeBSD the file flags specific to the FFS file system are set using `chflags'. Even if a file's mode bits allow an operation on that file, that operation may still fail, because: * the file-system-specific attributes or flags do not permit it; or * the file system is mounted as read-only. For example, if the immutable attribute is set on a file, it cannot be modified, regardless of the fact that you may have just run `chmod a+w FILE'. 27.2 Symbolic Modes =================== "Symbolic modes" represent changes to files' mode bits as operations on single-character symbols. They allow you to modify either all or selected parts of files' mode bits, optionally based on their previous values, and perhaps on the current `umask' as well (*note Umask and Protection::). The format of symbolic modes is: [ugoa...][+-=]PERMS...[,...] where PERMS is either zero or more letters from the set `rwxXst', or a single letter from the set `ugo'. The following sections describe the operators and other details of symbolic modes. 27.2.1 Setting Permissions -------------------------- The basic symbolic operations on a file's permissions are adding, removing, and setting the permission that certain users have to read, write, and execute or search the file. These operations have the following format: USERS OPERATION PERMISSIONS The spaces between the three parts above are shown for readability only; symbolic modes cannot contain spaces. The USERS part tells which users' access to the file is changed. It consists of one or more of the following letters (or it can be empty; *note Umask and Protection::, for a description of what happens then). When more than one of these letters is given, the order that they are in does not matter. `u' the user who owns the file; `g' other users who are in the file's group; `o' all other users; `a' all users; the same as `ugo'. The OPERATION part tells how to change the affected users' access to the file, and is one of the following symbols: `+' to add the PERMISSIONS to whatever permissions the USERS already have for the file; `-' to remove the PERMISSIONS from whatever permissions the USERS already have for the file; `=' to make the PERMISSIONS the only permissions that the USERS have for the file. The PERMISSIONS part tells what kind of access to the file should be changed; it is normally zero or more of the following letters. As with the USERS part, the order does not matter when more than one letter is given. Omitting the PERMISSIONS part is useful only with the `=' operation, where it gives the specified USERS no access at all to the file. `r' the permission the USERS have to read the file; `w' the permission the USERS have to write to the file; `x' the permission the USERS have to execute the file, or search it if it is a directory. For example, to give everyone permission to read and write a regular file, but not to execute it, use: a=rw To remove write permission for all users other than the file's owner, use: go-w The above command does not affect the access that the owner of the file has to it, nor does it affect whether other users can read or execute the file. To give everyone except a file's owner no permission to do anything with that file, use the mode below. Other users could still remove the file, if they have write permission on the directory it is in. go= Another way to specify the same thing is: og-rwx 27.2.2 Copying Existing Permissions ----------------------------------- You can base a file's permissions on its existing permissions. To do this, instead of using a series of `r', `w', or `x' letters after the operator, you use the letter `u', `g', or `o'. For example, the mode o+g adds the permissions for users who are in a file's group to the permissions that other users have for the file. Thus, if the file started out as mode 664 (`rw-rw-r--'), the above mode would change it to mode 666 (`rw-rw-rw-'). If the file had started out as mode 741 (`rwxr----x'), the above mode would change it to mode 745 (`rwxr--r-x'). The `-' and `=' operations work analogously. 27.2.3 Changing Special Mode Bits --------------------------------- In addition to changing a file's read, write, and execute/search permissions, you can change its special mode bits. *Note Mode Structure::, for a summary of these special mode bits. To change the file mode bits to set the user ID on execution, use `u' in the USERS part of the symbolic mode and `s' in the PERMISSIONS part. To change the file mode bits to set the group ID on execution, use `g' in the USERS part of the symbolic mode and `s' in the PERMISSIONS part. To set both user and group ID on execution, omit the USERS part of the symbolic mode (or use `a') and use `s' in the PERMISSIONS part. To change the file mode bits to set the restricted deletion flag or sticky bit, omit the USERS part of the symbolic mode (or use `a') and use `t' in the PERMISSIONS part. For example, to set the set-user-ID mode bit of a program, you can use the mode: u+s To remove both set-user-ID and set-group-ID mode bits from it, you can use the mode: a-s To set the restricted deletion flag or sticky bit, you can use the mode: +t The combination `o+s' has no effect. On GNU systems the combinations `u+t' and `g+t' have no effect, and `o+t' acts like plain `+t'. The `=' operator is not very useful with special mode bits. For example, the mode: o=t does set the restricted deletion flag or sticky bit, but it also removes all read, write, and execute/search permissions that users not in the file's group might have had for it. *Note Directory Setuid and Setgid::, for additional rules concerning set-user-ID and set-group-ID bits and directories. 27.2.4 Conditional Executability -------------------------------- There is one more special type of symbolic permission: if you use `X' instead of `x', execute/search permission is affected only if the file is a directory or already had execute permission. For example, this mode: a+X gives all users permission to search directories, or to execute files if anyone could execute them before. 27.2.5 Making Multiple Changes ------------------------------ The format of symbolic modes is actually more complex than described above (*note Setting Permissions::). It provides two ways to make multiple changes to files' mode bits. The first way is to specify multiple OPERATION and PERMISSIONS parts after a USERS part in the symbolic mode. For example, the mode: og+rX-w gives users other than the owner of the file read permission and, if it is a directory or if someone already had execute permission to it, gives them execute/search permission; and it also denies them write permission to the file. It does not affect the permission that the owner of the file has for it. The above mode is equivalent to the two modes: og+rX og-w The second way to make multiple changes is to specify more than one simple symbolic mode, separated by commas. For example, the mode: a+r,go-w gives everyone permission to read the file and removes write permission on it for all users except its owner. Another example: u=rwx,g=rx,o= sets all of the permission bits for the file explicitly. (It gives users who are not in the file's group no permission at all for it.) The two methods can be combined. The mode: a+r,g+x-w gives all users permission to read the file, and gives users who are in the file's group permission to execute/search it as well, but not permission to write to it. The above mode could be written in several different ways; another is: u+r,g+rx,o+r,g-w 27.2.6 The Umask and Protection ------------------------------- If the USERS part of a symbolic mode is omitted, it defaults to `a' (affect all users), except that any permissions that are _set_ in the system variable `umask' are _not affected_. The value of `umask' can be set using the `umask' command. Its default value varies from system to system. Omitting the USERS part of a symbolic mode is generally not useful with operations other than `+'. It is useful with `+' because it allows you to use `umask' as an easily customizable protection against giving away more permission to files than you intended to. As an example, if `umask' has the value 2, which removes write permission for users who are not in the file's group, then the mode: +w adds permission to write to the file to its owner and to other users who are in the file's group, but _not_ to other users. In contrast, the mode: a+w ignores `umask', and _does_ give write permission for the file to all users. 27.3 Numeric Modes ================== As an alternative to giving a symbolic mode, you can give an octal (base 8) number that represents the mode. This number is always interpreted in octal; you do not have to add a leading `0', as you do in C. Mode `0055' is the same as mode `55'. (However, modes of five digits or more, such as `00055', are sometimes special. *Note Directory Setuid and Setgid::.) A numeric mode is usually shorter than the corresponding symbolic mode, but it is limited in that normally it cannot take into account the previous file mode bits; it can only set them absolutely. The set-user-ID and set-group-ID bits of directories are an exception to this general limitation. *Note Directory Setuid and Setgid::. Also, operator numeric modes can take previous file mode bits into account. *Note Operator Numeric Modes::. The permissions granted to the user, to other users in the file's group, and to other users not in the file's group each require three bits, which are represented as one octal digit. The three special mode bits also require one bit each, and they are as a group represented as another octal digit. Here is how the bits are arranged, starting with the lowest valued bit: Value in Corresponding Mode Mode Bit Other users not in the file's group: 1 Execute/search 2 Write 4 Read Other users in the file's group: 10 Execute/search 20 Write 40 Read The file's owner: 100 Execute/search 200 Write 400 Read Special mode bits: 1000 Restricted deletion flag or sticky bit 2000 Set group ID on execution 4000 Set user ID on execution For example, numeric mode `4755' corresponds to symbolic mode `u=rwxs,go=rx', and numeric mode `664' corresponds to symbolic mode `ug=rw,o=r'. Numeric mode `0' corresponds to symbolic mode `a='. 27.4 Operator Numeric Modes =========================== An operator numeric mode is a numeric mode that is prefixed by a `-', `+', or `=' operator, which has the same interpretation as in symbolic modes. For example, `+440' enables read permission for the file's owner and group, `-1' disables execute permission for other users, and `=600' clears all permissions except for enabling read-write permissions for the file's owner. Operator numeric modes can be combined with symbolic modes by separating them with a comma; for example, `=0,u+r' clears all permissions except for enabling read permission for the file's owner. The commands `chmod =755 DIR' and `chmod 755 DIR' differ in that the former clears the directory DIR's setuid and setgid bits, whereas the latter preserves them. *Note Directory Setuid and Setgid::. Operator numeric modes are a GNU extension. 27.5 Directories and the Set-User-ID and Set-Group-ID Bits ========================================================== On most systems, if a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. On a few systems, a directory's set-user-ID bit has a similar effect on the ownership of new subfiles and the set-user-ID bits of new subdirectories. These mechanisms let users share files more easily, by lessening the need to use `chmod' or `chown' to share new files. These convenience mechanisms rely on the set-user-ID and set-group-ID bits of directories. If commands like `chmod' and `mkdir' routinely cleared these bits on directories, the mechanisms would be less convenient and it would be harder to share files. Therefore, a command like `chmod' does not affect the set-user-ID or set-group-ID bits of a directory unless the user specifically mentions them in a symbolic mode, or uses an operator numeric mode such as `=755', or sets them in a numeric mode, or clears them in a numeric mode that has five or more octal digits. For example, on systems that support set-group-ID inheritance: # These commands leave the set-user-ID and # set-group-ID bits of the subdirectories alone, # so that they retain their default values. mkdir A B C chmod 755 A chmod 0755 B chmod u=rwx,go=rx C mkdir -m 755 D mkdir -m 0755 E mkdir -m u=rwx,go=rx F If you want to try to set these bits, you must mention them explicitly in the symbolic or numeric modes, e.g.: # These commands try to set the set-user-ID # and set-group-ID bits of the subdirectories. mkdir G chmod 6755 G chmod +6000 G chmod u=rwx,go=rx,a+s G mkdir -m 6755 H mkdir -m +6000 I mkdir -m u=rwx,go=rx,a+s J If you want to try to clear these bits, you must mention them explicitly in a symbolic mode, or use an operator numeric mode, or specify a numeric mode with five or more octal digits, e.g.: # These commands try to clear the set-user-ID # and set-group-ID bits of the directory D. chmod a-s D chmod -6000 D chmod =755 D chmod 00755 D This behavior is a GNU extension. Portable scripts should not rely on requests to set or clear these bits on directories, as POSIX allows implementations to ignore these requests. The GNU behavior with numeric modes of four or fewer digits is intended for scripts portable to systems that preserve these bits; the behavior with numeric modes of five or more digits is for scripts portable to systems that do not preserve the bits. 28 Date input formats ********************* First, a quote: Our units of temporal measurement, from seconds on up to months, are so complicated, asymmetrical and disjunctive so as to make coherent mental reckoning in time all but impossible. Indeed, had some tyrannical god contrived to enslave our minds to time, to make it all but impossible for us to escape subjection to sodden routines and unpleasant surprises, he could hardly have done better than handing down our present system. It is like a set of trapezoidal building blocks, with no vertical or horizontal surfaces, like a language in which the simplest thought demands ornate constructions, useless particles and lengthy circumlocutions. Unlike the more successful patterns of language and science, which enable us to face experience boldly or at least level-headedly, our system of temporal calculation silently and persistently encourages our terror of time. ... It is as though architects had to measure length in feet, width in meters and height in ells; as though basic instruction manuals demanded a knowledge of five different languages. It is no wonder then that we often look into our own immediate past or future, last Tuesday or a week from Sunday, with feelings of helpless confusion. ... --Robert Grudin, `Time and the Art of Living'. This section describes the textual date representations that GNU programs accept. These are the strings you, as a user, can supply as arguments to the various programs. The C interface (via the `parse_datetime' function) is not described here. 28.1 General date syntax ======================== A "date" is a string, possibly empty, containing many items separated by whitespace. The whitespace may be omitted when no ambiguity arises. The empty string means the beginning of today (i.e., midnight). Order of the items is immaterial. A date string may contain many flavors of items: * calendar date items * time of day items * time zone items * combined date and time of day items * day of the week items * relative items * pure numbers. We describe each of these item types in turn, below. A few ordinal numbers may be written out in words in some contexts. This is most useful for specifying day of the week items or relative items (see below). Among the most commonly used ordinal numbers, the word `last' stands for -1, `this' stands for 0, and `first' and `next' both stand for 1. Because the word `second' stands for the unit of time there is no way to write the ordinal number 2, but for convenience `third' stands for 3, `fourth' for 4, `fifth' for 5, `sixth' for 6, `seventh' for 7, `eighth' for 8, `ninth' for 9, `tenth' for 10, `eleventh' for 11 and `twelfth' for 12. When a month is written this way, it is still considered to be written numerically, instead of being "spelled in full"; this changes the allowed strings. In the current implementation, only English is supported for words and abbreviations like `AM', `DST', `EST', `first', `January', `Sunday', `tomorrow', and `year'. The output of the `date' command is not always acceptable as a date string, not only because of the language problem, but also because there is no standard meaning for time zone items like `IST'. When using `date' to generate a date string intended to be parsed later, specify a date format that is independent of language and that does not use time zone items other than `UTC' and `Z'. Here are some ways to do this: $ LC_ALL=C TZ=UTC0 date Mon Mar 1 00:21:42 UTC 2004 $ TZ=UTC0 date +'%Y-%m-%d %H:%M:%SZ' 2004-03-01 00:21:42Z $ date --rfc-3339=ns # --rfc-3339 is a GNU extension. 2004-02-29 16:21:42.692722128-08:00 $ date --rfc-2822 # a GNU extension Sun, 29 Feb 2004 16:21:42 -0800 $ date +'%Y-%m-%d %H:%M:%S %z' # %z is a GNU extension. 2004-02-29 16:21:42 -0800 $ date +'@%s.%N' # %s and %N are GNU extensions. @1078100502.692722128 Alphabetic case is completely ignored in dates. Comments may be introduced between round parentheses, as long as included parentheses are properly nested. Hyphens not followed by a digit are currently ignored. Leading zeros on numbers are ignored. Invalid dates like `2005-02-29' or times like `24:00' are rejected. In the typical case of a host that does not support leap seconds, a time like `23:59:60' is rejected even if it corresponds to a valid leap second. 28.2 Calendar date items ======================== A "calendar date item" specifies a day of the year. It is specified differently, depending on whether the month is specified numerically or literally. All these strings specify the same calendar date: 1972-09-24 # ISO 8601. 72-9-24 # Assume 19xx for 69 through 99, # 20xx for 00 through 68. 72-09-24 # Leading zeros are ignored. 9/24/72 # Common U.S. writing. 24 September 1972 24 Sept 72 # September has a special abbreviation. 24 Sep 72 # Three-letter abbreviations always allowed. Sep 24, 1972 24-sep-72 24sep72 The year can also be omitted. In this case, the last specified year is used, or the current year if none. For example: 9/24 sep 24 Here are the rules. For numeric months, the ISO 8601 format `YEAR-MONTH-DAY' is allowed, where YEAR is any positive number, MONTH is a number between 01 and 12, and DAY is a number between 01 and 31. A leading zero must be present if a number is less than ten. If YEAR is 68 or smaller, then 2000 is added to it; otherwise, if YEAR is less than 100, then 1900 is added to it. The construct `MONTH/DAY/YEAR', popular in the United States, is accepted. Also `MONTH/DAY', omitting the year. Literal months may be spelled out in full: `January', `February', `March', `April', `May', `June', `July', `August', `September', `October', `November' or `December'. Literal months may be abbreviated to their first three letters, possibly followed by an abbreviating dot. It is also permitted to write `Sept' instead of `September'. When months are written literally, the calendar date may be given as any of the following: DAY MONTH YEAR DAY MONTH MONTH DAY YEAR DAY-MONTH-YEAR Or, omitting the year: MONTH DAY 28.3 Time of day items ====================== A "time of day item" in date strings specifies the time on a given day. Here are some examples, all of which represent the same time: 20:02:00.000000 20:02 8:02pm 20:02-0500 # In EST (U.S. Eastern Standard Time). More generally, the time of day may be given as `HOUR:MINUTE:SECOND', where HOUR is a number between 0 and 23, MINUTE is a number between 0 and 59, and SECOND is a number between 0 and 59 possibly followed by `.' or `,' and a fraction containing one or more digits. Alternatively, `:SECOND' can be omitted, in which case it is taken to be zero. On the rare hosts that support leap seconds, SECOND may be 60. If the time is followed by `am' or `pm' (or `a.m.' or `p.m.'), HOUR is restricted to run from 1 to 12, and `:MINUTE' may be omitted (taken to be zero). `am' indicates the first half of the day, `pm' indicates the second half of the day. In this notation, 12 is the predecessor of 1: midnight is `12am' while noon is `12pm'. (This is the zero-oriented interpretation of `12am' and `12pm', as opposed to the old tradition derived from Latin which uses `12m' for noon and `12pm' for midnight.) The time may alternatively be followed by a time zone correction, expressed as `SHHMM', where S is `+' or `-', HH is a number of zone hours and MM is a number of zone minutes. The zone minutes term, MM, may be omitted, in which case the one- or two-digit correction is interpreted as a number of hours. You can also separate HH from MM with a colon. When a time zone correction is given this way, it forces interpretation of the time relative to Coordinated Universal Time (UTC), overriding any previous specification for the time zone or the local time zone. For example, `+0530' and `+05:30' both stand for the time zone 5.5 hours ahead of UTC (e.g., India). This is the best way to specify a time zone correction by fractional parts of an hour. The maximum zone correction is 24 hours. Either `am'/`pm' or a time zone correction may be specified, but not both. 28.4 Time zone items ==================== A "time zone item" specifies an international time zone, indicated by a small set of letters, e.g., `UTC' or `Z' for Coordinated Universal Time. Any included periods are ignored. By following a non-daylight-saving time zone by the string `DST' in a separate word (that is, separated by some white space), the corresponding daylight saving time zone may be specified. Alternatively, a non-daylight-saving time zone can be followed by a time zone correction, to add the two values. This is normally done only for `UTC'; for example, `UTC+05:30' is equivalent to `+05:30'. Time zone items other than `UTC' and `Z' are obsolescent and are not recommended, because they are ambiguous; for example, `EST' has a different meaning in Australia than in the United States. Instead, it's better to use unambiguous numeric time zone corrections like `-0500', as described in the previous section. If neither a time zone item nor a time zone correction is supplied, time stamps are interpreted using the rules of the default time zone (*note Specifying time zone rules::). 28.5 Combined date and time of day items ======================================== The ISO 8601 date and time of day extended format consists of an ISO 8601 date, a `T' character separator, and an ISO 8601 time of day. This format is also recognized if the `T' is replaced by a space. In this format, the time of day should use 24-hour notation. Fractional seconds are allowed, with either comma or period preceding the fraction. ISO 8601 fractional minutes and hours are not supported. Typically, hosts support nanosecond timestamp resolution; excess precision is silently discarded. Here are some examples: 2012-09-24T20:02:00.052-0500 2012-12-31T23:59:59,999999999+1100 1970-01-01 00:00Z 28.6 Day of week items ====================== The explicit mention of a day of the week will forward the date (only if necessary) to reach that day of the week in the future. Days of the week may be spelled out in full: `Sunday', `Monday', `Tuesday', `Wednesday', `Thursday', `Friday' or `Saturday'. Days may be abbreviated to their first three letters, optionally followed by a period. The special abbreviations `Tues' for `Tuesday', `Wednes' for `Wednesday' and `Thur' or `Thurs' for `Thursday' are also allowed. A number may precede a day of the week item to move forward supplementary weeks. It is best used in expression like `third monday'. In this context, `last DAY' or `next DAY' is also acceptable; they move one week before or after the day that DAY by itself would represent. A comma following a day of the week item is ignored. 28.7 Relative items in date strings =================================== "Relative items" adjust a date (or the current date if none) forward or backward. The effects of relative items accumulate. Here are some examples: 1 year 1 year ago 3 years 2 days The unit of time displacement may be selected by the string `year' or `month' for moving by whole years or months. These are fuzzy units, as years and months are not all of equal duration. More precise units are `fortnight' which is worth 14 days, `week' worth 7 days, `day' worth 24 hours, `hour' worth 60 minutes, `minute' or `min' worth 60 seconds, and `second' or `sec' worth one second. An `s' suffix on these units is accepted and ignored. The unit of time may be preceded by a multiplier, given as an optionally signed number. Unsigned numbers are taken as positively signed. No number at all implies 1 for a multiplier. Following a relative item by the string `ago' is equivalent to preceding the unit by a multiplier with value -1. The string `tomorrow' is worth one day in the future (equivalent to `day'), the string `yesterday' is worth one day in the past (equivalent to `day ago'). The strings `now' or `today' are relative items corresponding to zero-valued time displacement, these strings come from the fact a zero-valued time displacement represents the current time when not otherwise changed by previous items. They may be used to stress other items, like in `12:00 today'. The string `this' also has the meaning of a zero-valued time displacement, but is preferred in date strings like `this thursday'. When a relative item causes the resulting date to cross a boundary where the clocks were adjusted, typically for daylight saving time, the resulting date and time are adjusted accordingly. The fuzz in units can cause problems with relative items. For example, `2003-07-31 -1 month' might evaluate to 2003-07-01, because 2003-06-31 is an invalid date. To determine the previous month more reliably, you can ask for the month before the 15th of the current month. For example: $ date -R Thu, 31 Jul 2003 13:02:39 -0700 $ date --date='-1 month' +'Last month was %B?' Last month was July? $ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!' Last month was June! Also, take care when manipulating dates around clock changes such as daylight saving leaps. In a few cases these have added or subtracted as much as 24 hours from the clock, so it is often wise to adopt universal time by setting the `TZ' environment variable to `UTC0' before embarking on calendrical calculations. 28.8 Pure numbers in date strings ================================= The precise interpretation of a pure decimal number depends on the context in the date string. If the decimal number is of the form YYYYMMDD and no other calendar date item (*note Calendar date items::) appears before it in the date string, then YYYY is read as the year, MM as the month number and DD as the day of the month, for the specified calendar date. If the decimal number is of the form HHMM and no other time of day item appears before it in the date string, then HH is read as the hour of the day and MM as the minute of the hour, for the specified time of day. MM can also be omitted. If both a calendar date and a time of day appear to the left of a number in the date string, but no relative item, then the number overrides the year. 28.9 Seconds since the Epoch ============================ If you precede a number with `@', it represents an internal time stamp as a count of seconds. The number can contain an internal decimal point (either `.' or `,'); any excess precision not supported by the internal representation is truncated toward minus infinity. Such a number cannot be combined with any other date item, as it specifies a complete time stamp. Internally, computer times are represented as a count of seconds since an epoch--a well-defined point of time. On GNU and POSIX systems, the epoch is 1970-01-01 00:00:00 UTC, so `@0' represents this time, `@1' represents 1970-01-01 00:00:01 UTC, and so forth. GNU and most other POSIX-compliant systems support such times as an extension to POSIX, using negative counts, so that `@-1' represents 1969-12-31 23:59:59 UTC. Traditional Unix systems count seconds with 32-bit two's-complement integers and can represent times from 1901-12-13 20:45:52 through 2038-01-19 03:14:07 UTC. More modern systems use 64-bit counts of seconds with nanosecond subcounts, and can represent all the times in the known lifetime of the universe to a resolution of 1 nanosecond. On most hosts, these counts ignore the presence of leap seconds. For example, on most hosts `@915148799' represents 1998-12-31 23:59:59 UTC, `@915148800' represents 1999-01-01 00:00:00 UTC, and there is no way to represent the intervening leap second 1998-12-31 23:59:60 UTC. 28.10 Specifying time zone rules ================================ Normally, dates are interpreted using the rules of the current time zone, which in turn are specified by the `TZ' environment variable, or by a system default if `TZ' is not set. To specify a different set of default time zone rules that apply just to one date, start the date with a string of the form `TZ="RULE"'. The two quote characters (`"') must be present in the date, and any quotes or backslashes within RULE must be escaped by a backslash. For example, with the GNU `date' command you can answer the question "What time is it in New York when a Paris clock shows 6:30am on October 31, 2004?" by using a date beginning with `TZ="Europe/Paris"' as shown in the following shell transcript: $ export TZ="America/New_York" $ date --date='TZ="Europe/Paris" 2004-10-31 06:30' Sun Oct 31 01:30:00 EDT 2004 In this example, the `--date' operand begins with its own `TZ' setting, so the rest of that operand is processed according to `Europe/Paris' rules, treating the string `2004-10-31 06:30' as if it were in Paris. However, since the output of the `date' command is processed according to the overall time zone rules, it uses New York time. (Paris was normally six hours ahead of New York in 2004, but this example refers to a brief Halloween period when the gap was five hours.) A `TZ' value is a rule that typically names a location in the `tz' database (http://www.twinsun.com/tz/tz-link.htm). A recent catalog of location names appears in the TWiki Date and Time Gateway (http://twiki.org/cgi-bin/xtra/tzdate). A few non-GNU hosts require a colon before a location name in a `TZ' setting, e.g., `TZ=":America/New_York"'. The `tz' database includes a wide variety of locations ranging from `Arctic/Longyearbyen' to `Antarctica/South_Pole', but if you are at sea and have your own private time zone, or if you are using a non-GNU host that does not support the `tz' database, you may need to use a POSIX rule instead. Simple POSIX rules like `UTC0' specify a time zone without daylight saving time; other rules can specify simple daylight saving regimes. *Note Specifying the Time Zone with `TZ': (libc)TZ Variable. 28.11 Authors of `parse_datetime' ================================= `parse_datetime' started life as `getdate', as originally implemented by Steven M. Bellovin () while at the University of North Carolina at Chapel Hill. The code was later tweaked by a couple of people on Usenet, then completely overhauled by Rich $alz () and Jim Berets () in August, 1990. Various revisions for the GNU system were made by David MacKenzie, Jim Meyering, Paul Eggert and others, including renaming it to `get_date' to avoid a conflict with the alternative Posix function `getdate', and a later rename to `parse_datetime'. The Posix function `getdate' can parse more locale-specific dates using `strptime', but relies on an environment variable and external file, and lacks the thread-safety of `parse_datetime'. This chapter was originally produced by Franc,ois Pinard () from the `parse_datetime.y' source code, and then edited by K. Berry (). 29 Opening the Software Toolbox ******************************* An earlier version of this chapter appeared in the `What's GNU?' column of the June 1994 `Linux Journal' (http://www.linuxjournal.com/article.php?sid=2762). It was written by Arnold Robbins. Toolbox Introduction ==================== This month's column is only peripherally related to the GNU Project, in that it describes a number of the GNU tools on your GNU/Linux system and how they might be used. What it's really about is the "Software Tools" philosophy of program development and usage. The software tools philosophy was an important and integral concept in the initial design and development of Unix (of which Linux and GNU are essentially clones). Unfortunately, in the modern day press of Internetworking and flashy GUIs, it seems to have fallen by the wayside. This is a shame, since it provides a powerful mental model for solving many kinds of problems. Many people carry a Swiss Army knife around in their pants pockets (or purse). A Swiss Army knife is a handy tool to have: it has several knife blades, a screwdriver, tweezers, toothpick, nail file, corkscrew, and perhaps a number of other things on it. For the everyday, small miscellaneous jobs where you need a simple, general purpose tool, it's just the thing. On the other hand, an experienced carpenter doesn't build a house using a Swiss Army knife. Instead, he has a toolbox chock full of specialized tools--a saw, a hammer, a screwdriver, a plane, and so on. And he knows exactly when and where to use each tool; you won't catch him hammering nails with the handle of his screwdriver. The Unix developers at Bell Labs were all professional programmers and trained computer scientists. They had found that while a one-size-fits-all program might appeal to a user because there's only one program to use, in practice such programs are a. difficult to write, b. difficult to maintain and debug, and c. difficult to extend to meet new situations. Instead, they felt that programs should be specialized tools. In short, each program "should do one thing well." No more and no less. Such programs are simpler to design, write, and get right--they only do one thing. Furthermore, they found that with the right machinery for hooking programs together, that the whole was greater than the sum of the parts. By combining several special purpose programs, you could accomplish a specific task that none of the programs was designed for, and accomplish it much more quickly and easily than if you had to write a special purpose program. We will see some (classic) examples of this further on in the column. (An important additional point was that, if necessary, take a detour and build any software tools you may need first, if you don't already have something appropriate in the toolbox.) I/O Redirection =============== Hopefully, you are familiar with the basics of I/O redirection in the shell, in particular the concepts of "standard input," "standard output," and "standard error". Briefly, "standard input" is a data source, where data comes from. A program should not need to either know or care if the data source is a disk file, a keyboard, a magnetic tape, or even a punched card reader. Similarly, "standard output" is a data sink, where data goes to. The program should neither know nor care where this might be. Programs that only read their standard input, do something to the data, and then send it on, are called "filters", by analogy to filters in a water pipeline. With the Unix shell, it's very easy to set up data pipelines: program_to_create_data | filter1 | ... | filterN > final.pretty.data We start out by creating the raw data; each filter applies some successive transformation to the data, until by the time it comes out of the pipeline, it is in the desired form. This is fine and good for standard input and standard output. Where does the standard error come in to play? Well, think about `filter1' in the pipeline above. What happens if it encounters an error in the data it sees? If it writes an error message to standard output, it will just disappear down the pipeline into `filter2''s input, and the user will probably never see it. So programs need a place where they can send error messages so that the user will notice them. This is standard error, and it is usually connected to your console or window, even if you have redirected standard output of your program away from your screen. For filter programs to work together, the format of the data has to be agreed upon. The most straightforward and easiest format to use is simply lines of text. Unix data files are generally just streams of bytes, with lines delimited by the ASCII LF (Line Feed) character, conventionally called a "newline" in the Unix literature. (This is `'\n'' if you're a C programmer.) This is the format used by all the traditional filtering programs. (Many earlier operating systems had elaborate facilities and special purpose programs for managing binary data. Unix has always shied away from such things, under the philosophy that it's easiest to simply be able to view and edit your data with a text editor.) OK, enough introduction. Let's take a look at some of the tools, and then we'll see how to hook them together in interesting ways. In the following discussion, we will only present those command line options that interest us. As you should always do, double check your system documentation for the full story. The `who' Command ================= The first program is the `who' command. By itself, it generates a list of the users who are currently logged in. Although I'm writing this on a single-user system, we'll pretend that several people are logged in: $ who -| arnold console Jan 22 19:57 -| miriam ttyp0 Jan 23 14:19(:0.0) -| bill ttyp1 Jan 21 09:32(:0.0) -| arnold ttyp2 Jan 23 20:48(:0.0) Here, the `$' is the usual shell prompt, at which I typed `who'. There are three people logged in, and I am logged in twice. On traditional Unix systems, user names are never more than eight characters long. This little bit of trivia will be useful later. The output of `who' is nice, but the data is not all that exciting. The `cut' Command ================= The next program we'll look at is the `cut' command. This program cuts out columns or fields of input data. For example, we can tell it to print just the login name and full name from the `/etc/passwd' file. The `/etc/passwd' file has seven fields, separated by colons: arnold:xyzzy:2076:10:Arnold D. Robbins:/home/arnold:/bin/bash To get the first and fifth fields, we would use `cut' like this: $ cut -d: -f1,5 /etc/passwd -| root:Operator ... -| arnold:Arnold D. Robbins -| miriam:Miriam A. Robbins ... With the `-c' option, `cut' will cut out specific characters (i.e., columns) in the input lines. This is useful for input data that has fixed width fields, and does not have a field separator. For example, list the Monday dates for the current month: $ cal | cut -c 3-5 -|Mo -| -| 6 -| 13 -| 20 -| 27 The `sort' Command ================== Next we'll look at the `sort' command. This is one of the most powerful commands on a Unix-style system; one that you will often find yourself using when setting up fancy data plumbing. The `sort' command reads and sorts each file named on the command line. It then merges the sorted data and writes it to standard output. It will read standard input if no files are given on the command line (thus making it into a filter). The sort is based on the character collating sequence or based on user-supplied ordering criteria. The `uniq' Command ================== Finally (at least for now), we'll look at the `uniq' program. When sorting data, you will often end up with duplicate lines, lines that are identical. Usually, all you need is one instance of each line. This is where `uniq' comes in. The `uniq' program reads its standard input. It prints only one copy of each repeated line. It does have several options. Later on, we'll use the `-c' option, which prints each unique line, preceded by a count of the number of times that line occurred in the input. Putting the Tools Together ========================== Now, let's suppose this is a large ISP server system with dozens of users logged in. The management wants the system administrator to write a program that will generate a sorted list of logged in users. Furthermore, even if a user is logged in multiple times, his or her name should only show up in the output once. The administrator could sit down with the system documentation and write a C program that did this. It would take perhaps a couple of hundred lines of code and about two hours to write it, test it, and debug it. However, knowing the software toolbox, the administrator can instead start out by generating just a list of logged on users: $ who | cut -c1-8 -| arnold -| miriam -| bill -| arnold Next, sort the list: $ who | cut -c1-8 | sort -| arnold -| arnold -| bill -| miriam Finally, run the sorted list through `uniq', to weed out duplicates: $ who | cut -c1-8 | sort | uniq -| arnold -| bill -| miriam The `sort' command actually has a `-u' option that does what `uniq' does. However, `uniq' has other uses for which one cannot substitute `sort -u'. The administrator puts this pipeline into a shell script, and makes it available for all the users on the system (`#' is the system administrator, or `root', prompt): # cat > /usr/local/bin/listusers who | cut -c1-8 | sort | uniq ^D # chmod +x /usr/local/bin/listusers There are four major points to note here. First, with just four programs, on one command line, the administrator was able to save about two hours worth of work. Furthermore, the shell pipeline is just about as efficient as the C program would be, and it is much more efficient in terms of programmer time. People time is much more expensive than computer time, and in our modern "there's never enough time to do everything" society, saving two hours of programmer time is no mean feat. Second, it is also important to emphasize that with the _combination_ of the tools, it is possible to do a special purpose job never imagined by the authors of the individual programs. Third, it is also valuable to build up your pipeline in stages, as we did here. This allows you to view the data at each stage in the pipeline, which helps you acquire the confidence that you are indeed using these tools correctly. Finally, by bundling the pipeline in a shell script, other users can use your command, without having to remember the fancy plumbing you set up for them. In terms of how you run them, shell scripts and compiled programs are indistinguishable. After the previous warm-up exercise, we'll look at two additional, more complicated pipelines. For them, we need to introduce two more tools. The first is the `tr' command, which stands for "transliterate." The `tr' command works on a character-by-character basis, changing characters. Normally it is used for things like mapping upper case to lower case: $ echo ThIs ExAmPlE HaS MIXED case! | tr '[:upper:]' '[:lower:]' -| this example has mixed case! There are several options of interest: `-c' work on the complement of the listed characters, i.e., operations apply to characters not in the given set `-d' delete characters in the first set from the output `-s' squeeze repeated characters in the output into just one character. We will be using all three options in a moment. The other command we'll look at is `comm'. The `comm' command takes two sorted input files as input data, and prints out the files' lines in three columns. The output columns are the data lines unique to the first file, the data lines unique to the second file, and the data lines that are common to both. The `-1', `-2', and `-3' command line options _omit_ the respective columns. (This is non-intuitive and takes a little getting used to.) For example: $ cat f1 -| 11111 -| 22222 -| 33333 -| 44444 $ cat f2 -| 00000 -| 22222 -| 33333 -| 55555 $ comm f1 f2 -| 00000 -| 11111 -| 22222 -| 33333 -| 44444 -| 55555 The file name `-' tells `comm' to read standard input instead of a regular file. Now we're ready to build a fancy pipeline. The first application is a word frequency counter. This helps an author determine if he or she is over-using certain words. The first step is to change the case of all the letters in our input file to one case. "The" and "the" are the same word when doing counting. $ tr '[:upper:]' '[:lower:]' < whats.gnu | ... The next step is to get rid of punctuation. Quoted words and unquoted words should be treated identically; it's easiest to just get the punctuation out of the way. $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | ... The second `tr' command operates on the complement of the listed characters, which are all the letters, the digits, the underscore, and the blank. The `\n' represents the newline character; it has to be left alone. (The ASCII tab character should also be included for good measure in a production script.) At this point, we have data consisting of words separated by blank space. The words only contain alphanumeric characters (and the underscore). The next step is break the data apart so that we have one word per line. This makes the counting operation much easier, as we will see shortly. $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | > tr -s ' ' '\n' | ... This command turns blanks into newlines. The `-s' option squeezes multiple newline characters in the output into just one. This helps us avoid blank lines. (The `>' is the shell's "secondary prompt." This is what the shell prints when it notices you haven't finished typing in all of a command.) We now have data consisting of one word per line, no punctuation, all one case. We're ready to count each word: $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | > tr -s ' ' '\n' | sort | uniq -c | ... At this point, the data might look something like this: 60 a 2 able 6 about 1 above 2 accomplish 1 acquire 1 actually 2 additional The output is sorted by word, not by count! What we want is the most frequently used words first. Fortunately, this is easy to accomplish, with the help of two more `sort' options: `-n' do a numeric sort, not a textual one `-r' reverse the order of the sort The final pipeline looks like this: $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | > tr -s ' ' '\n' | sort | uniq -c | sort -n -r -| 156 the -| 60 a -| 58 to -| 51 of -| 51 and ... Whew! That's a lot to digest. Yet, the same principles apply. With six commands, on two lines (really one long one split for convenience), we've created a program that does something interesting and useful, in much less time than we could have written a C program to do the same thing. A minor modification to the above pipeline can give us a simple spelling checker! To determine if you've spelled a word correctly, all you have to do is look it up in a dictionary. If it is not there, then chances are that your spelling is incorrect. So, we need a dictionary. The conventional location for a dictionary is `/usr/dict/words'. On my GNU/Linux system,(1) this is a sorted, 45,402 word dictionary. Now, how to compare our file with the dictionary? As before, we generate a sorted list of words, one per line: $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | > tr -s ' ' '\n' | sort -u | ... Now, all we need is a list of words that are _not_ in the dictionary. Here is where the `comm' command comes in. $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | > tr -s ' ' '\n' | sort -u | > comm -23 - /usr/dict/words The `-2' and `-3' options eliminate lines that are only in the dictionary (the second file), and lines that are in both files. Lines only in the first file (standard input, our stream of words), are words that are not in the dictionary. These are likely candidates for spelling errors. This pipeline was the first cut at a production spelling checker on Unix. There are some other tools that deserve brief mention. `grep' search files for text that matches a regular expression `wc' count lines, words, characters `tee' a T-fitting for data pipes, copies data to files and to standard output `sed' the stream editor, an advanced tool `awk' a data manipulation language, another advanced tool The software tools philosophy also espoused the following bit of advice: "Let someone else do the hard part." This means, take something that gives you most of what you need, and then massage it the rest of the way until it's in the form that you want. To summarize: 1. Each program should do one thing well. No more, no less. 2. Combining programs with appropriate plumbing leads to results where the whole is greater than the sum of the parts. It also leads to novel uses of programs that the authors might never have imagined. 3. Programs should never print extraneous header or trailer data, since these could get sent on down a pipeline. (A point we didn't mention earlier.) 4. Let someone else do the hard part. 5. Know your toolbox! Use each program appropriately. If you don't have an appropriate tool, build one. As of this writing, all the programs we've discussed are available via anonymous `ftp' from: `ftp://gnudist.gnu.org/textutils/textutils-1.22.tar.gz'. (There may be more recent versions available now.) None of what I have presented in this column is new. The Software Tools philosophy was first introduced in the book `Software Tools', by Brian Kernighan and P.J. Plauger (Addison-Wesley, ISBN 0-201-03669-X). This book showed how to write and use software tools. It was written in 1976, using a preprocessor for FORTRAN named `ratfor' (RATional FORtran). At the time, C was not as ubiquitous as it is now; FORTRAN was. The last chapter presented a `ratfor' to FORTRAN processor, written in `ratfor'. `ratfor' looks an awful lot like C; if you know C, you won't have any problem following the code. In 1981, the book was updated and made available as `Software Tools in Pascal' (Addison-Wesley, ISBN 0-201-10342-7). Both books are still in print and are well worth reading if you're a programmer. They certainly made a major change in how I view programming. The programs in both books are available from Brian Kernighan's home page (http://cm.bell-labs.com/who/bwk). For a number of years, there was an active Software Tools Users Group, whose members had ported the original `ratfor' programs to essentially every computer system with a FORTRAN compiler. The popularity of the group waned in the middle 1980s as Unix began to spread beyond universities. With the current proliferation of GNU code and other clones of Unix programs, these programs now receive little attention; modern C versions are much more efficient and do more than these programs do. Nevertheless, as exposition of good programming style, and evangelism for a still-valuable philosophy, these books are unparalleled, and I recommend them highly. Acknowledgment: I would like to express my gratitude to Brian Kernighan of Bell Labs, the original Software Toolsmith, for reviewing this column. ---------- Footnotes ---------- (1) Redhat Linux 6.1, for the November 2000 revision of this article. Appendix A GNU Free Documentation License ***************************************** Version 1.3, 3 November 2008 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. `http://fsf.org/' Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The "publisher" means any person or entity that distributes copies of the Document to the public. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements." 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See `http://www.gnu.org/copyleft/'. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. "Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents ==================================================== To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. Index ***** !: See 16.3.6. (line 9507) !=: See 16.3.4. (line 9471) %: See 16.4.2. (line 9637) %b: See 15.2. (line 9162) &: See 16.4.3. (line 9655) *: See 16.4.2. (line 9637) + <1>: See 16.4.2. (line 9633) +: See 16.4.1. (line 9613) +PAGE_RANGE: See 4.3. (line 1853) - <1>: See 23.2. (line 12052) -: See 16.4.2. (line 9633) - and Unix rm: See 11.5. (line 7054) -, removing files beginning with: See 11.5. (line 7042) --: See 2. (line 344) --across: See 4.3. (line 1877) --additional-suffix: See 5.3. (line 2490) --address-radix: See 3.4. (line 1231) --adjustment: See 23.3. (line 12112) --all <1>: See 21.4. (line 11637) --all <2>: See 21.3. (line 11598) --all <3>: See 20.6. (line 10929) --all <4>: See 19.2. (line 10264) --all <5>: See 14.2. (line 8550) --all <6>: See 14.1. (line 8322) --all <7>: See 10.1.1. (line 5106) --all: See 9.3. (line 5038) --all-repeated: See 7.3. (line 3707) --almost-all: See 10.1.1. (line 5110) --apparent-size: See 14.2. (line 8553) --append: See 17.1. (line 9726) --archive: See 11.1. (line 6019) --attributes-only: See 11.1. (line 6028) --author: See 10.1.2. (line 5194) --backup <1>: See 12.2. (line 7377) --backup <2>: See 11.4. (line 6885) --backup <3>: See 11.3. (line 6731) --backup <4>: See 11.1. (line 6035) --backup: See 2.2. (line 381) --batch-size: See 7.1. (line 3262) --before: See 3.2. (line 1050) --binary: See 6.4. (line 2896) --block-size <1>: See 14.2. (line 8570) --block-size <2>: See 14.1. (line 8328) --block-size: See 2.3. (line 558) --block-size=SIZE: See 2.3. (line 433) --body-numbering: See 3.3. (line 1117) --boot: See 20.6. (line 10933) --bourne-shell: See 10.4. (line 5932) --buffer-size: See 7.1. (line 3312) --bytes <1>: See 14.2. (line 8575) --bytes <2>: See 8.1. (line 4377) --bytes <3>: See 6.1. (line 2757) --bytes <4>: See 5.3. (line 2409) --bytes <5>: See 5.2. (line 2205) --bytes <6>: See 5.1. (line 2135) --bytes: See 4.4. (line 2088) --c-shell: See 10.4. (line 5938) --canonicalize: See 12.6. (line 7677) --canonicalize-existing <1>: See 18.5. (line 10132) --canonicalize-existing: See 12.6. (line 7684) --canonicalize-missing <1>: See 18.5. (line 10140) --canonicalize-missing: See 12.6. (line 7691) --changes <1>: See 13.3. (line 8088) --changes <2>: See 13.2. (line 7978) --changes: See 13.1. (line 7861) --characters: See 8.1. (line 4385) --chars: See 6.1. (line 2761) --check: See 7.1. (line 3021) --check-chars: See 7.3. (line 3744) --classify: See 10.1.5. (line 5612) --color: See 10.1.5. (line 5585) --columns: See 4.3. (line 1863) --compare: See 11.3. (line 6736) --complement: See 8.1. (line 4434) --compute: See 22.2. (line 11857) --context <1>: See 20.1. (line 10808) --context <2>: See 12.5. (line 7644) --context <3>: See 12.4. (line 7586) --context <4>: See 12.3. (line 7554) --context <5>: See 11.3. (line 6822) --context: See 10.1.2. (line 5452) --count <1>: See 20.6. (line 10963) --count: See 7.3. (line 3693) --count-links: See 14.2. (line 8632) --crown-margin: See 4.1. (line 1492) --csh: See 10.4. (line 5938) --date <1>: See 21.1.6. (line 11334) --date: See 13.4. (line 8207) --dead: See 20.6. (line 10937) --debug: See 4.2.1. (line 1563) --decode: See 3.5. (line 1443) --delimiter <1>: See 8.1. (line 4414) --delimiter: See 4.2.1. (line 1568) --delimiters: See 8.2. (line 4485) --dereference <1>: See 22.1. (line 11771) --dereference <2>: See 14.3. (line 8791) --dereference <3>: See 14.2. (line 8626) --dereference <4>: See 13.2. (line 7988) --dereference <5>: See 13.1. (line 7894) --dereference <6>: See 11.1. (line 6105) --dereference: See 10.1.1. (line 5177) --dereference-args: See 14.2. (line 8585) --dereference-command-line: See 10.1.1. (line 5129) --dereference-command-line-symlink-to-dir: See 10.1.1. (line 5134) --dictionary-order: See 7.1. (line 3090) --digits: See 5.4. (line 2644) --dir: See 11.5. (line 6975) --directory <1>: See 18.4. (line 10069) --directory <2>: See 12.2. (line 7383) --directory <3>: See 11.3. (line 6751) --directory: See 10.1.1. (line 5121) --dired: See 10.1.2. (line 5200) --double-space: See 4.3. (line 1889) --dry-run: See 18.4. (line 10081) --echo: See 7.2. (line 3562) --elide-empty-files <1>: See 5.4. (line 2653) --elide-empty-files: See 5.3. (line 2495) --error: See 23.5. (line 12252) --escape: See 10.1.7. (line 5814) --exact: See 11.6. (line 7191) --exclude-from=FILE: See 14.2. (line 8748) --exclude-type: See 14.1. (line 8501) --exclude=PATTERN: See 14.2. (line 8753) --expand-tabs: See 4.3. (line 1913) --field: See 4.2.1. (line 1572) --field-separator: See 7.1. (line 3328) --fields: See 8.1. (line 4395) --file <1>: See 21.1.6. (line 11349) --file: See 19.2. (line 10269) --file-system: See 14.3. (line 8797) --file-type: See 10.1.5. (line 5623) --files0-from=FILE <1>: See 14.2. (line 8597) --files0-from=FILE <2>: See 7.1. (line 3224) --files0-from=FILE: See 6.1. (line 2776) --filter: See 5.3. (line 2429) --first-line-number: See 4.3. (line 1989) --follow: See 5.2. (line 2221) --footer-numbering: See 3.3. (line 1145) --force <1>: See 12.2. (line 7389) --force <2>: See 11.6. (line 7158) --force <3>: See 11.5. (line 6979) --force <4>: See 11.4. (line 6890) --force: See 11.1. (line 6072) --foreground: See 23.6. (line 12313) --form-feed: See 4.3. (line 1921) --format <1>: See 10.1.5. (line 5574) --format <2>: See 10.1.2. (line 5315) --format <3>: See 4.2.1. (line 1575) --format: See 3.4. (line 1280) --format=FORMAT <1>: See 26.2. (line 12541) --format=FORMAT: See 14.3. (line 8803) --from <1>: See 13.1. (line 7871) --from: See 4.2.1. (line 1582) --from-unit: See 4.2.1. (line 1587) --full-time: See 10.1.2. (line 5284) --general-numeric-sort: See 7.1. (line 3108) --goal: See 4.1. (line 1522) --group <1>: See 20.1. (line 10786) --group: See 11.3. (line 6757) --group-directories-first: See 10.1.1. (line 5143) --grouping: See 4.2.1. (line 1593) --groups <1>: See 23.1. (line 11915) --groups: See 20.1. (line 10790) --hardware-platform: See 21.4. (line 11642) --head-count: See 7.2. (line 3575) --header <1>: See 8.3. (line 4585) --header <2>: See 4.3. (line 1926) --header: See 4.2.1. (line 1599) --header-numbering: See 3.3. (line 1149) --header=N: See 4.2.1. (line 1599) --heading: See 20.6. (line 10941) --help: See 2. (line 337) --hide-control-chars: See 10.1.7. (line 5826) --hide=PATTERN: See 10.1.1. (line 5150) --human-numeric-sort: See 7.1. (line 3133) --human-readable <1>: See 14.2. (line 8614) --human-readable <2>: See 14.1. (line 8343) --human-readable <3>: See 10.1.2. (line 5300) --human-readable: See 2.3. (line 558) --ignore: See 21.3. (line 11604) --ignore-backups: See 10.1.1. (line 5116) --ignore-case <1>: See 8.3. (line 4595) --ignore-case <2>: See 7.3. (line 3697) --ignore-case: See 7.1. (line 3097) --ignore-environment: See 23.2. (line 12052) --ignore-fail-on-non-empty: See 12.7. (line 7736) --ignore-garbage: See 3.5. (line 1449) --ignore-interrupts: See 17.1. (line 9731) --ignore-leading-blanks: See 7.1. (line 3082) --ignore-nonprinting: See 7.1. (line 3148) --ignore=PATTERN: See 10.1.1. (line 5163) --indent: See 4.3. (line 1995) --indicator-style: See 10.1.5. (line 5612) --initial: See 9.2. (line 4997) --inode: See 10.1.2. (line 5307) --inodes: See 14.1. (line 8353) --input: See 23.5. (line 12244) --input-range: See 7.2. (line 3566) --interactive <1>: See 12.2. (line 7393) --interactive <2>: See 11.5. (line 6994) --interactive <3>: See 11.4. (line 6896) --interactive: See 11.1. (line 6095) --invalid: See 4.2.1. (line 1602) --io-blocks: See 14.5. (line 9001) --iso-8601[=TIMESPEC]: See 21.1.6. (line 11357) --iterations=NUMBER: See 11.6. (line 7163) --join-blank-lines: See 3.3. (line 1157) --join-lines: See 4.3. (line 1939) --keep-files: See 5.4. (line 2649) --kernel-name: See 21.4. (line 11672) --kernel-release: See 21.4. (line 11668) --kernel-version: See 21.4. (line 11683) --key: See 7.1. (line 3237) --kibibytes: See 10.1.5. (line 5649) --kill-after: See 23.6. (line 12328) --length: See 4.3. (line 1948) --line-bytes: See 5.3. (line 2423) --line-increment: See 3.3. (line 1153) --lines <1>: See 6.1. (line 2769) --lines <2>: See 5.3. (line 2402) --lines <3>: See 5.2. (line 2325) --lines: See 5.1. (line 2150) --link: See 11.1. (line 6101) --literal: See 10.1.7. (line 5820) --local: See 14.1. (line 8364) --logical <1>: See 19.1. (line 10218) --logical <2>: See 18.5. (line 10145) --logical: See 12.2. (line 7397) --login: See 20.6. (line 10945) --lookup: See 20.6. (line 10950) --machine: See 21.4. (line 11648) --max-depth=DEPTH: See 14.2. (line 8592) --max-line-length: See 6.1. (line 2773) --max-unchanged-stats: See 5.2. (line 2313) --merge <1>: See 7.1. (line 3035) --merge: See 4.3. (line 1955) --mesg: See 20.6. (line 10988) --message: See 20.6. (line 10988) --mode <1>: See 12.5. (line 7638) --mode <2>: See 12.4. (line 7579) --mode <3>: See 12.3. (line 7517) --mode: See 11.3. (line 6763) --month-sort: See 7.1. (line 3155) --multiple: See 18.1. (line 9858) --name: See 20.1. (line 10794) --no-clobber <1>: See 11.4. (line 6903) --no-clobber: See 11.1. (line 6112) --no-create <1>: See 14.5. (line 8997) --no-create: See 13.4. (line 8203) --no-dereference <1>: See 22.1. (line 11776) --no-dereference <2>: See 14.2. (line 8642) --no-dereference <3>: See 13.4. (line 8221) --no-dereference <4>: See 13.2. (line 7993) --no-dereference <5>: See 13.1. (line 7899) --no-dereference <6>: See 12.2. (line 7403) --no-dereference: See 11.1. (line 6118) --no-file-warnings: See 4.3. (line 2002) --no-group: See 10.1.2. (line 5294) --no-newline: See 12.6. (line 7696) --no-preserve-root <1>: See 22.1. (line 11793) --no-preserve-root <2>: See 13.3. (line 8103) --no-preserve-root <3>: See 13.2. (line 8006) --no-preserve-root <4>: See 13.1. (line 7912) --no-preserve-root: See 11.5. (line 7028) --no-renumber: See 3.3. (line 1178) --no-symlinks: See 18.5. (line 10161) --no-sync: See 14.1. (line 8368) --no-target-directory <1>: See 12.2. (line 7458) --no-target-directory <2>: See 11.4. (line 6936) --no-target-directory <3>: See 11.3. (line 6813) --no-target-directory <4>: See 11.1. (line 6310) --no-target-directory: See 2.8. (line 767) --nodename: See 21.4. (line 11653) --null <1>: See 23.2. (line 12039) --null <2>: See 19.3. (line 10720) --null: See 14.2. (line 8543) --number <1>: See 5.3. (line 2446) --number: See 3.1. (line 989) --number-format: See 3.3. (line 1165) --number-lines: See 4.3. (line 1968) --number-nonblank: See 3.1. (line 978) --number-separator: See 3.3. (line 1182) --number-width: See 3.3. (line 1192) --numeric-sort: See 7.1. (line 3165) --numeric-suffixes: See 5.3. (line 2483) --numeric-uid-gid: See 10.1.2. (line 5418) --omit-header: See 4.3. (line 2025) --omit-pagination: See 4.3. (line 2036) --one-file-system <1>: See 14.2. (line 8759) --one-file-system <2>: See 11.5. (line 7007) --one-file-system: See 11.1. (line 6333) --only-delimited: See 8.1. (line 4422) --operating-system: See 21.4. (line 11664) --output <1>: See 23.5. (line 12248) --output <2>: See 14.1. (line 8375) --output <3>: See 7.2. (line 3580) --output: See 7.1. (line 3288) --output-delimiter: See 8.1. (line 4427) --output-duplicates: See 3.4. (line 1350) --output-tabs: See 4.3. (line 1932) --owner: See 11.3. (line 6775) --padding: See 4.2.1. (line 1610) --page_width: See 4.3. (line 2054) --pages=PAGE_RANGE: See 4.3. (line 1853) --parallel: See 7.1. (line 3356) --parents <1>: See 12.7. (line 7741) --parents <2>: See 12.3. (line 7532) --parents: See 11.1. (line 6198) --physical <1>: See 19.1. (line 10225) --physical <2>: See 18.5. (line 10150) --physical: See 12.2. (line 7422) --pid: See 5.2. (line 2293) --portability <1>: See 18.3. (line 9977) --portability: See 14.1. (line 8437) --prefix: See 5.4. (line 2625) --preserve: See 11.1. (line 6125) --preserve-context: See 11.3. (line 6780) --preserve-root <1>: See 22.1. (line 11788) --preserve-root <2>: See 13.3. (line 8098) --preserve-root <3>: See 13.2. (line 8001) --preserve-root <4>: See 13.1. (line 7907) --preserve-root: See 11.5. (line 7023) --preserve-status: See 23.6. (line 12307) --preserve-timestamps: See 11.3. (line 6787) --print-database: See 10.4. (line 5943) --print-type: See 14.1. (line 8476) --printf=FORMAT: See 14.3. (line 8812) --process: See 20.6. (line 10959) --processor: See 21.4. (line 11657) --quiet <1>: See 19.4. (line 10747) --quiet <2>: See 18.5. (line 10156) --quiet <3>: See 18.4. (line 10076) --quiet <4>: See 13.3. (line 8094) --quiet <5>: See 13.2. (line 7984) --quiet <6>: See 13.1. (line 7867) --quiet <7>: See 12.6. (line 7703) --quiet <8>: See 6.4. (line 2927) --quiet <9>: See 5.4. (line 2664) --quiet <10>: See 5.2. (line 2333) --quiet: See 5.1. (line 2157) --quote-name: See 10.1.7. (line 5833) --quoting-style: See 10.1.7. (line 5814) --random-sort: See 7.1. (line 3194) --random-source <1>: See 11.6. (line 7169) --random-source <2>: See 7.2. (line 3586) --random-source: See 7.1. (line 3301) --range <1>: See 22.2. (line 11873) --range: See 22.1. (line 11827) --read-bytes: See 3.4. (line 1266) --real: See 20.1. (line 10799) --recursive <1>: See 22.1. (line 11785) --recursive <2>: See 13.3. (line 8118) --recursive <3>: See 13.2. (line 8024) --recursive <4>: See 13.1. (line 7931) --recursive <5>: See 11.5. (line 7035) --recursive <6>: See 11.1. (line 6211) --recursive: See 10.1.1. (line 5184) --reference <1>: See 22.1. (line 11780) --reference <2>: See 21.1.6. (line 11382) --reference <3>: See 14.5. (line 9005) --reference <4>: See 13.4. (line 8240) --reference <5>: See 13.3. (line 8111) --reference <6>: See 13.2. (line 8010) --reference: See 13.1. (line 7916) --reflink[=WHEN]: See 11.1. (line 6224) --regex: See 3.2. (line 1055) --relative: See 12.2. (line 7431) --relative-base: See 18.5. (line 10176) --relative-to: See 18.5. (line 10171) --remove: See 11.6. (line 7180) --remove-destination: See 11.1. (line 6250) --repeated: See 7.3. (line 3701) --retry: See 5.2. (line 2277) --reverse <1>: See 10.1.3. (line 5481) --reverse: See 7.1. (line 3188) --rfc-2822: See 21.1.6. (line 11388) --rfc-3339=TIMESPEC: See 21.1.6. (line 11400) --rfc-822: See 21.1.6. (line 11388) --role <1>: See 22.2. (line 11865) --role: See 22.1. (line 11819) --round: See 4.2.1. (line 1617) --round=down: See 4.2.1. (line 1617) --round=from-zero: See 4.2.1. (line 1617) --round=nearest: See 4.2.1. (line 1617) --round=towards-zero: See 4.2.1. (line 1617) --round=up: See 4.2.1. (line 1617) --runlevel: See 20.6. (line 10968) --save: See 19.2. (line 10279) --section-delimiter: See 3.3. (line 1138) --sep-string: See 4.3. (line 2016) --separate-dirs: See 14.2. (line 8647) --separator <1>: See 4.3. (line 2007) --separator: See 3.2. (line 1059) --serial: See 8.2. (line 4476) --set: See 21.1.6. (line 11430) --sh: See 10.4. (line 5932) --show-all: See 3.1. (line 974) --show-control-chars <1>: See 10.1.7. (line 5881) --show-control-chars: See 4.3. (line 1883) --show-ends: See 3.1. (line 985) --show-nonprinting <1>: See 4.3. (line 2041) --show-nonprinting: See 3.1. (line 1009) --show-tabs: See 3.1. (line 1002) --si <1>: See 14.2. (line 8655) --si <2>: See 14.1. (line 8456) --si <3>: See 10.1.2. (line 5444) --si: See 2.3. (line 558) --signal: See 23.6. (line 12335) --silent <1>: See 19.4. (line 10747) --silent <2>: See 13.3. (line 8094) --silent <3>: See 13.2. (line 7984) --silent <4>: See 13.1. (line 7867) --silent <5>: See 12.6. (line 7703) --silent <6>: See 5.4. (line 2664) --silent <7>: See 5.2. (line 2333) --silent: See 5.1. (line 2157) --size <1>: See 14.5. (line 9009) --size: See 10.1.2. (line 5428) --size=BYTES: See 11.6. (line 7174) --skip-bytes: See 3.4. (line 1250) --skip-chars: See 7.3. (line 3679) --skip-fields: See 7.3. (line 3669) --sleep-interval: See 5.2. (line 2283) --sort <1>: See 10.1.3. (line 5486) --sort: See 7.1. (line 3108) --spaces: See 4.4. (line 2094) --sparse=WHEN: See 11.1. (line 6254) --split-only: See 4.1. (line 1505) --squeeze-blank: See 3.1. (line 994) --stable: See 7.1. (line 3306) --starting-line-number: See 3.3. (line 1187) --status: See 6.4. (line 2935) --strict: See 6.4. (line 2968) --strings: See 3.4. (line 1271) --strip <1>: See 18.5. (line 10161) --strip: See 11.3. (line 6797) --strip-program: See 11.3. (line 6800) --strip-trailing-slashes <1>: See 11.4. (line 6922) --strip-trailing-slashes: See 11.1. (line 6288) --suffix <1>: See 18.4. (line 10097) --suffix <2>: See 18.1. (line 9864) --suffix <3>: See 12.2. (line 7449) --suffix <4>: See 11.4. (line 6927) --suffix <5>: See 11.3. (line 6804) --suffix <6>: See 11.1. (line 6301) --suffix <7>: See 5.4. (line 2629) --suffix <8>: See 4.2.1. (line 1622) --suffix: See 2.2. (line 418) --suffix-length: See 5.3. (line 2475) --summarize: See 14.2. (line 8663) --symbolic: See 12.2. (line 7443) --symbolic-link: See 11.1. (line 6293) --sync: See 14.1. (line 8463) --sysv: See 6.2. (line 2825) --tabs <1>: See 9.3. (line 5025) --tabs: See 9.2. (line 4985) --tabsize: See 10.1.5. (line 5675) --tag: See 6.4. (line 2944) --tagged-paragraph: See 4.1. (line 1498) --target-directory <1>: See 12.2. (line 7454) --target-directory <2>: See 11.4. (line 6932) --target-directory <3>: See 11.3. (line 6809) --target-directory <4>: See 11.1. (line 6306) --target-directory: See 2.8. (line 783) --temporary-directory: See 7.1. (line 3348) --terse: See 14.3. (line 8823) --text: See 6.4. (line 2954) --threshold: See 14.2. (line 8667) --time <1>: See 20.6. (line 10976) --time <2>: See 14.2. (line 8695) --time <3>: See 13.4. (line 8199) --time: See 10.1.3. (line 5467) --time-style <1>: See 14.2. (line 8710) --time-style: See 10.1.6. (line 5716) --tmpdir: See 18.4. (line 10089) --to: See 4.2.1. (line 1626) --to-unit: See 4.2.1. (line 1631) --total <1>: See 14.2. (line 8579) --total: See 14.1. (line 8332) --traditional: See 3.4. (line 1401) --type <1>: See 22.2. (line 11869) --type <2>: See 22.1. (line 11823) --type: See 14.1. (line 8470) --unbuffered: See 5.3. (line 2503) --uniform-spacing: See 4.1. (line 1511) --unique <1>: See 7.3. (line 3739) --unique: See 7.1. (line 3364) --universal: See 21.1.6. (line 11436) --unset: See 23.2. (line 12046) --update <1>: See 11.4. (line 6909) --update: See 11.1. (line 6315) --user <1>: See 22.2. (line 11861) --user <2>: See 22.1. (line 11815) --user: See 20.1. (line 10804) --userspec: See 23.1. (line 11910) --utc: See 21.1.6. (line 11436) --verbose <1>: See 22.1. (line 11811) --verbose <2>: See 13.3. (line 8108) --verbose <3>: See 13.2. (line 8016) --verbose <4>: See 13.1. (line 7923) --verbose <5>: See 12.7. (line 7750) --verbose <6>: See 12.6. (line 7707) --verbose <7>: See 12.3. (line 7549) --verbose <8>: See 12.2. (line 7463) --verbose <9>: See 11.6. (line 7186) --verbose <10>: See 11.5. (line 7039) --verbose <11>: See 11.4. (line 6919) --verbose <12>: See 11.3. (line 6818) --verbose <13>: See 11.1. (line 6329) --verbose <14>: See 5.3. (line 2507) --verbose <15>: See 5.2. (line 2337) --verbose: See 5.1. (line 2161) --version: See 2. (line 341) --version-sort: See 7.1. (line 3182) --warn: See 6.4. (line 2963) --width <1>: See 10.1.5. (line 5687) --width <2>: See 4.4. (line 2100) --width <3>: See 4.3. (line 2045) --width <4>: See 4.1. (line 1517) --width: See 3.4. (line 1357) --words: See 6.1. (line 2765) --wrap: See 3.5. (line 1435) --writable: See 20.6. (line 10988) --zero <1>: See 18.5. (line 10168) --zero <2>: See 18.2. (line 9916) --zero <3>: See 18.1. (line 9868) --zero <4>: See 12.6. (line 7711) --zero: See 11.6. (line 7201) --zero-terminated <1>: See 7.3. (line 3750) --zero-terminated <2>: See 7.2. (line 3591) --zero-terminated: See 7.1. (line 3378) -0 <1>: See 23.2. (line 12038) -0 <2>: See 19.3. (line 10719) -0: See 14.2. (line 8542) -1 <1>: See 10.1.5. (line 5574) -1 <2>: See 8.3. (line 4600) -1: See 7.4. (line 3781) -2 <1>: See 8.3. (line 4603) -2: See 7.4. (line 3781) -3: See 7.4. (line 3781) -a <1>: See 21.4. (line 11637) -a <2>: See 20.6. (line 10929) -a <3>: See 19.2. (line 10264) -a <4>: See 18.1. (line 9858) -a <5>: See 17.1. (line 9726) -a <6>: See 16.3.6. (line 9510) -a <7>: See 14.2. (line 8550) -a <8>: See 14.1. (line 8322) -a <9>: See 13.4. (line 8199) -a: See 11.1. (line 6019) -A: See 10.1.1. (line 5110) -a <1>: See 10.1.1. (line 5106) -a <2>: See 9.3. (line 5038) -a <3>: See 8.3. (line 4570) -a <4>: See 5.3. (line 2475) -a <5>: See 4.3. (line 1877) -a: See 3.4. (line 1370) -A <1>: See 3.4. (line 1231) -A: See 3.1. (line 974) -b <1>: See 20.6. (line 10933) -b <2>: See 16.3.1. (line 9364) -b: See 14.2. (line 8575) -B <1>: See 14.2. (line 8570) -B: See 14.1. (line 8328) -b <1>: See 12.2. (line 7377) -b <2>: See 11.4. (line 6885) -b <3>: See 11.3. (line 6731) -b <4>: See 11.1. (line 6035) -b <5>: See 10.4. (line 5932) -b: See 10.1.7. (line 5814) -B: See 10.1.1. (line 5116) -b <1>: See 8.1. (line 4377) -b <2>: See 7.1. (line 3082) -b <3>: See 6.4. (line 2896) -b <4>: See 5.4. (line 2629) -b <5>: See 5.3. (line 2409) -b <6>: See 4.4. (line 2088) -b <7>: See 3.4. (line 1373) -b <8>: See 3.3. (line 1117) -b <9>: See 3.2. (line 1050) -b <10>: See 3.1. (line 978) -b: See 2.2. (line 381) -c <1>: See 22.2. (line 11857) -c <2>: See 16.3.1. (line 9367) -c <3>: See 14.5. (line 8997) -c <4>: See 14.3. (line 8803) -c <5>: See 14.2. (line 8579) -c <6>: See 13.4. (line 8203) -c <7>: See 13.3. (line 8088) -c <8>: See 13.2. (line 7978) -c <9>: See 13.1. (line 7861) -c: See 11.3. (line 6742) -C: See 11.3. (line 6736) -c: See 10.4. (line 5938) -C: See 10.1.5. (line 5579) -c <1>: See 10.1.3. (line 5467) -c <2>: See 8.1. (line 4385) -c <3>: See 7.3. (line 3693) -c <4>: See 7.2. (line 3562) -c <5>: See 7.1. (line 3021) -c: See 6.1. (line 2757) -C: See 5.3. (line 2423) -c <1>: See 5.2. (line 2205) -c <2>: See 5.1. (line 2135) -c <3>: See 4.3. (line 1883) -c <4>: See 4.1. (line 1492) -c: See 3.4. (line 1376) -COLUMN: See 4.3. (line 1863) -d <1>: See 21.1.6. (line 11334) -d <2>: See 20.6. (line 10937) -d <3>: See 18.4. (line 10069) -d: See 16.3.1. (line 9370) -D: See 14.2. (line 8585) -d <1>: See 13.4. (line 8207) -d <2>: See 12.2. (line 7383) -d <3>: See 11.5. (line 6975) -d: See 11.3. (line 6751) -D: See 11.3. (line 6745) -d: See 11.1. (line 6065) -D: See 10.1.2. (line 5200) -d <1>: See 10.1.1. (line 5121) -d <2>: See 8.2. (line 4485) -d: See 8.1. (line 4414) -D: See 7.3. (line 3707) -d <1>: See 7.3. (line 3701) -d <2>: See 7.1. (line 3090) -d <3>: See 5.3. (line 2483) -d <4>: See 4.3. (line 1889) -d <5>: See 4.2.1. (line 1568) -d <6>: See 3.5. (line 1443) -d <7>: See 3.4. (line 1380) -d: See 3.3. (line 1138) -d DEPTH: See 14.2. (line 8592) -e <1>: See 23.5. (line 12252) -e <2>: See 18.5. (line 10132) -e: See 16.3.3. (line 9428) -E: See 15.1. (line 9108) -e <1>: See 15.1. (line 9060) -e <2>: See 12.6. (line 7684) -e <3>: See 8.3. (line 4581) -e <4>: See 5.3. (line 2495) -e: See 4.3. (line 1913) -E: See 3.1. (line 985) -e: See 3.1. (line 981) -ef: See 16.3.3. (line 9442) -eq: See 16.3.5. (line 9487) -f: See 21.1.6. (line 11349) -F: See 19.2. (line 10269) -f <1>: See 16.3.1. (line 9373) -f <2>: See 14.3. (line 8797) -f <3>: See 13.4. (line 8217) -f <4>: See 13.3. (line 8094) -f <5>: See 13.2. (line 7984) -f <6>: See 13.1. (line 7867) -f <7>: See 12.6. (line 7677) -f: See 12.2. (line 7389) -F: See 12.2. (line 7383) -f <1>: See 11.6. (line 7158) -f <2>: See 11.5. (line 6979) -f <3>: See 11.4. (line 6890) -f: See 11.1. (line 6072) -F: See 10.1.5. (line 5612) -f <1>: See 10.1.3. (line 5474) -f <2>: See 8.1. (line 4395) -f <3>: See 7.3. (line 3669) -f <4>: See 7.1. (line 3097) -f: See 5.4. (line 2625) -F: See 5.2. (line 2272) -f <1>: See 5.2. (line 2221) -f: See 4.3. (line 1921) -F: See 4.3. (line 1921) -f <1>: See 3.4. (line 1383) -f: See 3.3. (line 1145) -f FORMAT: See 26.2. (line 12541) -G: See 20.1. (line 10790) -g <1>: See 20.1. (line 10786) -g: See 19.2. (line 10279) -G: See 16.3.2. (line 9419) -g <1>: See 16.3.2. (line 9397) -g: See 11.3. (line 6757) -G: See 10.1.2. (line 5294) -g <1>: See 10.1.2. (line 5289) -g <2>: See 7.1. (line 3108) -g: See 4.1. (line 1522) -ge: See 16.3.5. (line 9487) -gt: See 16.3.5. (line 9487) -H: See 22.1. (line 11797) -h: See 22.1. (line 11776) -H: See 20.6. (line 10941) -h <1>: See 16.3.1. (line 9377) -h: See 14.2. (line 8614) -H <1>: See 14.2. (line 8610) -H: See 14.1. (line 8349) -h <1>: See 14.1. (line 8343) -h: See 13.4. (line 8221) -H: See 13.2. (line 8028) -h: See 13.2. (line 7993) -H: See 13.1. (line 7934) -h: See 13.1. (line 7899) -H: See 11.1. (line 6088) -h: See 10.1.2. (line 5300) -H: See 10.1.1. (line 5129) -h <1>: See 7.1. (line 3133) -h <2>: See 4.3. (line 1926) -h: See 3.3. (line 1149) -H: See 2.10. (line 863) -h: See 2.3. (line 558) -i <1>: See 23.5. (line 12244) -i <2>: See 23.2. (line 12052) -i <3>: See 21.4. (line 11642) -i <4>: See 17.1. (line 9731) -i <5>: See 14.1. (line 8353) -i: See 12.2. (line 7393) -I: See 11.5. (line 6988) -i <1>: See 11.5. (line 6983) -i <2>: See 11.4. (line 6896) -i <3>: See 11.1. (line 6095) -i: See 10.1.2. (line 5307) -I: See 10.1.1. (line 5163) -i <1>: See 9.2. (line 4997) -i <2>: See 8.3. (line 4595) -i <3>: See 7.3. (line 3697) -i <4>: See 7.2. (line 3566) -i <5>: See 7.1. (line 3148) -i <6>: See 4.3. (line 1932) -i <7>: See 3.5. (line 1449) -i <8>: See 3.4. (line 1386) -i: See 3.3. (line 1153) -I[TIMESPEC]: See 21.1.6. (line 11357) -J: See 4.3. (line 1939) -j: See 3.4. (line 1250) -k <1>: See 23.6. (line 12328) -k <2>: See 16.3.2. (line 9400) -k <3>: See 14.2. (line 8620) -k <4>: See 14.1. (line 8358) -k <5>: See 10.1.5. (line 5649) -k <6>: See 7.1. (line 3237) -k <7>: See 5.4. (line 2649) -k: See 2.3. (line 558) -l <1>: See 22.2. (line 11873) -l: See 22.1. (line 11827) -L: See 22.1. (line 11802) -l: See 20.6. (line 10945) -L <1>: See 19.1. (line 10218) -L <2>: See 18.5. (line 10145) -L <3>: See 16.3.1. (line 9377) -L: See 14.3. (line 8791) -l: See 14.2. (line 8632) -L: See 14.2. (line 8626) -l: See 14.1. (line 8364) -L <1>: See 13.2. (line 8033) -L <2>: See 13.1. (line 7939) -L <3>: See 12.2. (line 7397) -L: See 11.1. (line 6105) -l <1>: See 11.1. (line 6101) -l: See 10.1.2. (line 5315) -L <1>: See 10.1.1. (line 5177) -L: See 6.1. (line 2773) -l <1>: See 6.1. (line 2769) -l <2>: See 5.3. (line 2402) -l <3>: See 4.3. (line 1948) -l <4>: See 3.4. (line 1389) -l: See 3.3. (line 1157) -L: See 2.10. (line 867) -le: See 16.3.5. (line 9487) -lt: See 16.3.5. (line 9487) -m <1>: See 21.4. (line 11648) -m <2>: See 20.6. (line 10955) -m <3>: See 18.5. (line 10140) -m <4>: See 14.2. (line 8636) -m <5>: See 13.4. (line 8236) -m <6>: See 12.6. (line 7691) -m <7>: See 12.5. (line 7638) -m <8>: See 12.4. (line 7579) -m <9>: See 12.3. (line 7517) -m <10>: See 11.3. (line 6763) -m: See 10.1.5. (line 5661) -M: See 7.1. (line 3155) -m <1>: See 7.1. (line 3035) -m <2>: See 6.1. (line 2761) -m: See 4.3. (line 1955) -n <1>: See 23.3. (line 12112) -n <2>: See 21.4. (line 11653) -n <3>: See 20.1. (line 10794) -n <4>: See 16.3.4. (line 9462) -n <5>: See 15.1. (line 9057) -n <6>: See 12.6. (line 7696) -n <7>: See 12.2. (line 7403) -n <8>: See 11.4. (line 6903) -n: See 11.1. (line 6112) -N: See 10.1.7. (line 5820) -n <1>: See 10.1.2. (line 5418) -n <2>: See 8.1. (line 4418) -n <3>: See 7.2. (line 3575) -n <4>: See 7.1. (line 3165) -n <5>: See 5.4. (line 2644) -n <6>: See 5.3. (line 2446) -n <7>: See 5.2. (line 2325) -n: See 5.1. (line 2150) -N: See 4.3. (line 1989) -n: See 4.3. (line 1968) -N: See 3.4. (line 1266) -n <1>: See 3.3. (line 1165) -n: See 3.1. (line 989) -n NUMBER: See 11.6. (line 7163) -ne: See 16.3.5. (line 9487) -nt: See 16.3.3. (line 9434) -o <1>: See 23.5. (line 12248) -o <2>: See 21.4. (line 11664) -o: See 16.3.6. (line 9513) -O: See 16.3.2. (line 9416) -o <1>: See 14.5. (line 9001) -o <2>: See 11.3. (line 6775) -o <3>: See 10.1.2. (line 5422) -o <4>: See 7.2. (line 3580) -o <5>: See 7.1. (line 3288) -o <6>: See 4.3. (line 1995) -o: See 3.4. (line 1392) -ot: See 16.3.3. (line 9438) -P: See 22.1. (line 11806) -p <1>: See 21.4. (line 11657) -p: See 20.6. (line 10959) -P <1>: See 19.1. (line 10225) -P: See 18.5. (line 10150) -p: See 18.4. (line 10089) -P: See 18.3. (line 9973) -p <1>: See 18.3. (line 9960) -p: See 16.3.1. (line 9382) -P <1>: See 14.2. (line 8642) -P <2>: See 14.1. (line 8437) -P <3>: See 13.2. (line 8037) -P: See 13.1. (line 7943) -p <1>: See 12.7. (line 7741) -p: See 12.3. (line 7532) -P: See 12.2. (line 7422) -p <1>: See 11.3. (line 6787) -p: See 11.1. (line 6125) -P: See 11.1. (line 6118) -p <1>: See 10.4. (line 5943) -p <2>: See 10.1.5. (line 5666) -p: See 3.3. (line 1178) -P: See 2.10. (line 871) -q <1>: See 20.6. (line 10963) -q <2>: See 18.5. (line 10156) -q <3>: See 18.4. (line 10076) -q: See 12.6. (line 7703) -Q: See 10.1.7. (line 5833) -q <1>: See 10.1.7. (line 5826) -q <2>: See 5.4. (line 2664) -q <3>: See 5.2. (line 2333) -q: See 5.1. (line 2157) -r <1>: See 22.2. (line 11865) -r: See 22.1. (line 11819) -R: See 22.1. (line 11785) -r: See 21.4. (line 11668) -R: See 21.1.6. (line 11388) -r <1>: See 21.1.6. (line 11382) -r <2>: See 20.6. (line 10968) -r <3>: See 20.1. (line 10799) -r <4>: See 16.3.2. (line 9403) -r <5>: See 14.5. (line 9005) -r: See 13.4. (line 8240) -R <1>: See 13.3. (line 8118) -R <2>: See 13.2. (line 8024) -R: See 13.1. (line 7931) -r: See 12.2. (line 7431) -R: See 11.5. (line 7035) -r <1>: See 11.5. (line 7035) -r: See 11.1. (line 6211) -R: See 11.1. (line 6211) -r: See 10.1.3. (line 5481) -R <1>: See 10.1.1. (line 5184) -R: See 7.1. (line 3194) -r <1>: See 7.1. (line 3188) -r <2>: See 6.2. (line 2819) -r <3>: See 4.3. (line 2002) -r: See 3.2. (line 1055) -s <1>: See 23.6. (line 12335) -s <2>: See 21.4. (line 11672) -s <3>: See 21.1.6. (line 11430) -s <4>: See 20.6. (line 10972) -s <5>: See 19.4. (line 10747) -s <6>: See 18.5. (line 10161) -s <7>: See 18.1. (line 9864) -s: See 16.3.3. (line 9431) -S: See 16.3.1. (line 9385) -s <1>: See 14.5. (line 9009) -s: See 14.2. (line 8663) -S: See 14.2. (line 8647) -s: See 12.6. (line 7703) -S: See 12.2. (line 7449) -s: See 12.2. (line 7443) -S <1>: See 11.4. (line 6927) -S: See 11.3. (line 6804) -s: See 11.3. (line 6797) -S: See 11.1. (line 6301) -s: See 11.1. (line 6293) -S: See 10.1.3. (line 5486) -s <1>: See 10.1.2. (line 5428) -s <2>: See 8.2. (line 4476) -s <3>: See 8.1. (line 4422) -s: See 7.3. (line 3679) -S: See 7.1. (line 3312) -s <1>: See 7.1. (line 3306) -s <2>: See 6.2. (line 2825) -s <3>: See 5.4. (line 2664) -s: See 4.4. (line 2094) -S: See 4.3. (line 2016) -s <1>: See 4.3. (line 2007) -s <2>: See 4.1. (line 1505) -s: See 3.4. (line 1395) -S: See 3.4. (line 1271) -s <1>: See 3.3. (line 1182) -s <2>: See 3.2. (line 1059) -s: See 3.1. (line 994) -S: See 2.2. (line 418) -s BYTES: See 11.6. (line 7174) -t <1>: See 22.2. (line 11869) -t: See 22.1. (line 11823) -T: See 20.6. (line 10988) -t <1>: See 20.6. (line 10976) -t <2>: See 18.4. (line 10105) -t <3>: See 16.3.1. (line 9388) -t <4>: See 14.3. (line 8823) -t: See 14.2. (line 8667) -T: See 14.1. (line 8476) -t: See 14.1. (line 8470) -T: See 12.2. (line 7458) -t: See 12.2. (line 7454) -T: See 11.4. (line 6936) -t: See 11.4. (line 6932) -T: See 11.3. (line 6813) -t: See 11.3. (line 6809) -T: See 11.1. (line 6310) -t: See 11.1. (line 6306) -T: See 10.1.5. (line 5675) -t <1>: See 10.1.3. (line 5490) -t <2>: See 9.3. (line 5025) -t: See 9.2. (line 4985) -T: See 7.1. (line 3348) -t <1>: See 7.1. (line 3328) -t: See 6.4. (line 2954) -T: See 4.3. (line 2036) -t <1>: See 4.3. (line 2025) -t <2>: See 4.1. (line 1498) -t: See 3.4. (line 1280) -T: See 3.1. (line 1002) -t: See 3.1. (line 998) -u <1>: See 23.2. (line 12046) -u <2>: See 22.2. (line 11861) -u <3>: See 22.1. (line 11815) -u <4>: See 21.1.6. (line 11436) -u <5>: See 20.6. (line 10979) -u <6>: See 20.1. (line 10804) -u <7>: See 18.4. (line 10081) -u <8>: See 16.3.2. (line 9406) -u <9>: See 11.6. (line 7180) -u <10>: See 11.4. (line 6909) -u: See 11.1. (line 6315) -U: See 10.1.3. (line 5503) -u <1>: See 10.1.3. (line 5496) -u <2>: See 7.3. (line 3739) -u <3>: See 7.1. (line 3364) -u <4>: See 5.3. (line 2503) -u <5>: See 4.1. (line 1511) -u: See 3.1. (line 1005) -v <1>: See 22.1. (line 11811) -v <2>: See 21.4. (line 11683) -v <3>: See 13.3. (line 8108) -v <4>: See 13.2. (line 8016) -v <5>: See 13.1. (line 7923) -v <6>: See 12.7. (line 7750) -v <7>: See 12.6. (line 7707) -v <8>: See 12.3. (line 7549) -v <9>: See 12.2. (line 7463) -v <10>: See 11.6. (line 7186) -v <11>: See 11.5. (line 7039) -v <12>: See 11.4. (line 6919) -v <13>: See 11.3. (line 6818) -v <14>: See 11.1. (line 6329) -v: See 10.1.3. (line 5510) -V: See 7.1. (line 3182) -v <1>: See 5.2. (line 2337) -v <2>: See 5.1. (line 2161) -v <3>: See 4.3. (line 2041) -v <4>: See 3.4. (line 1350) -v <5>: See 3.3. (line 1187) -v: See 3.1. (line 1009) -w <1>: See 20.6. (line 10988) -w <2>: See 16.3.2. (line 9409) -w <3>: See 10.1.5. (line 5687) -w <4>: See 7.3. (line 3744) -w <5>: See 6.4. (line 2963) -w <6>: See 6.1. (line 2765) -w: See 4.4. (line 2100) -W: See 4.3. (line 2054) -w <1>: See 4.3. (line 2045) -w <2>: See 4.1. (line 1517) -w <3>: See 3.5. (line 1435) -w <4>: See 3.4. (line 1357) -w: See 3.3. (line 1192) -WIDTH: See 4.1. (line 1517) -x <1>: See 16.3.2. (line 9412) -x <2>: See 14.2. (line 8759) -x <3>: See 14.1. (line 8501) -x <4>: See 11.6. (line 7191) -x <5>: See 11.1. (line 6333) -x: See 10.1.5. (line 5671) -X: See 10.1.3. (line 5517) -x: See 3.4. (line 1398) -X FILE: See 14.2. (line 8748) -Z: See 20.1. (line 10808) -z <1>: See 18.5. (line 10168) -z <2>: See 18.2. (line 9916) -z <3>: See 18.1. (line 9868) -z <4>: See 16.3.4. (line 9458) -z: See 12.6. (line 7711) -Z <1>: See 12.5. (line 7644) -Z <2>: See 12.4. (line 7586) -Z: See 12.3. (line 7554) -z: See 11.6. (line 7201) -Z <1>: See 11.3. (line 6822) -Z: See 10.1.2. (line 5452) -z <1>: See 7.3. (line 3750) -z <2>: See 7.2. (line 3591) -z <3>: See 7.1. (line 3378) -z: See 5.4. (line 2653) /: See 16.4.2. (line 9637) 128-bit checksum: See 6.4. (line 2865) 16-bit checksum: See 6.2. (line 2800) 160-bit checksum: See 6.5. (line 2978) 224-bit checksum: See 6.6. (line 2992) 256-bit checksum: See 6.6. (line 2992) 384-bit checksum: See 6.6. (line 2992) 4.2 file system type: See 14.1. (line 8488) 512-bit checksum: See 6.6. (line 2992) <: See 16.4.3. (line 9660) <=: See 16.4.3. (line 9660) = <1>: See 16.4.3. (line 9660) =: See 16.3.4. (line 9465) == <1>: See 16.4.3. (line 9660) ==: See 16.3.4. (line 9468) >: See 16.4.3. (line 9660) >=: See 16.4.3. (line 9660) \( regexp operator: See 16.4.1. (line 9584) \+ regexp operator: See 16.4.1. (line 9588) \? regexp operator: See 16.4.1. (line 9588) \c: See 15.2. (line 9153) \OOO: See 15.2. (line 9187) \uhhhh: See 15.2. (line 9194) \Uhhhhhhhh: See 15.2. (line 9194) \xHH: See 15.2. (line 9187) \| regexp operator: See 16.4.1. (line 9588) _POSIX2_VERSION <1>: See 13.4. (line 8259) _POSIX2_VERSION <2>: See 7.3. (line 3684) _POSIX2_VERSION <3>: See 7.1. (line 3411) _POSIX2_VERSION <4>: See 5.2. (line 2348) _POSIX2_VERSION: See 2.13. (line 943) abbreviations for months: See 28.2. (line 13259) access permission tests: See 16.3.2. (line 9394) access permissions, changing: See 13.3. (line 8055) access time: See 11.2. (line 6583) access time, changing: See 13.4. (line 8199) access time, printing or sorting files by: See 10.1.3. (line 5496) access time, show the most recent: See 14.2. (line 8706) across columns: See 4.3. (line 1877) across, listing files: See 10.1.5. (line 5671) adding permissions: See 27.2.1. (line 12769) addition: See 16.4.2. (line 9633) ago in date strings: See 28.7. (line 13402) all repeated lines, outputting: See 7.3. (line 3707) alnum: See 9.1.1. (line 4789) alpha: See 9.1.1. (line 4792) alternate ebcdic, converting to: See 11.2. (line 6432) always color option: See 10.1.5. (line 5591) always interactive option: See 11.5. (line 7001) am i: See 20.6. (line 10914) am in date strings: See 28.3. (line 13296) and operator <1>: See 16.4.3. (line 9655) and operator: See 16.3.6. (line 9510) append: See 11.2. (line 6523) appending to the output file: See 11.2. (line 6523) appropriate privileges <1>: See 23.3. (line 12067) appropriate privileges <2>: See 21.5. (line 11692) appropriate privileges <3>: See 21.1.5. (line 11289) appropriate privileges: See 11.3. (line 6775) arbitrary date strings, parsing: See 21.1.6. (line 11334) arbitrary text, displaying: See 15.1. (line 9041) arch: See 21.2. (line 11572) arithmetic tests: See 16.3.5. (line 9477) ASCII dump of files: See 3.4. (line 1201) ascii, converting to: See 11.2. (line 6424) atime, changing: See 13.4. (line 8199) atime, printing or sorting files by: See 10.1.3. (line 5496) atime, show the most recent: See 14.2. (line 8706) attributes, file: See 13. (line 7785) authors of parse_datetime: See 28.11. (line 13540) auto color option: See 10.1.5. (line 5589) automounter file systems: See 14.1. (line 8322) b for block special file: See 12.5. (line 7621) background jobs, stopping at terminal write: See 19.2.4. (line 10496) backslash escapes <1>: See 15.1. (line 9060) backslash escapes: See 9.1.1. (line 4711) backslash sequences for file names: See 10.1.7. (line 5814) backup files, ignoring: See 10.1.1. (line 5116) backup options: See 2.2. (line 374) backup suffix: See 2.2. (line 418) backups, making <1>: See 12.2. (line 7377) backups, making <2>: See 11.4. (line 6885) backups, making <3>: See 11.3. (line 6731) backups, making <4>: See 11.1. (line 6035) backups, making: See 2.2. (line 381) backups, making only: See 11.1. (line 6007) base64: See 3.5. (line 1419) Base64 decoding: See 3.5. (line 1443) base64 encoding: See 3.5. (line 1419) basename: See 18.1. (line 9832) baud rate, setting: See 19.2.7. (line 10695) beeping at input buffer full: See 19.2.2. (line 10393) beginning of time: See 21.1.1. (line 11071) beginning of time, for POSIX: See 28.9. (line 13473) Bellovin, Steven M.: See 28.11. (line 13540) Berets, Jim: See 28.11. (line 13540) Berry, K. <1>: See 28.11. (line 13553) Berry, K.: See 1. (line 291) binary: See 11.2. (line 6600) binary I/O: See 11.2. (line 6600) binary input files: See 6.4. (line 2896) bind mount <1>: See 14.3. (line 8919) bind mount: See 11.5. (line 7011) blank: See 9.1.1. (line 4795) blank lines, numbering: See 3.3. (line 1157) blanks, ignoring leading: See 7.1. (line 3082) block (space-padding): See 11.2. (line 6441) block size <1>: See 11.2. (line 6372) block size: See 2.3. (line 427) block size of conversion: See 11.2. (line 6379) block size of input: See 11.2. (line 6364) block size of output: See 11.2. (line 6368) block special check: See 16.3.1. (line 9364) block special files: See 12.5. (line 7601) block special files, creating: See 12.5. (line 7596) BLOCK_SIZE: See 2.3. (line 433) BLOCKSIZE: See 2.3. (line 433) body, numbering: See 3.3. (line 1087) Bourne shell syntax for color setup: See 10.4. (line 5932) breaks, cause interrupts: See 19.2.2. (line 10346) breaks, ignoring: See 19.2.2. (line 10343) brkint: See 19.2.2. (line 10346) bs: See 11.2. (line 6372) BSD output: See 6.4. (line 2944) BSD sum: See 6.2. (line 2819) BSD tail: See 5.2. (line 2192) BSD touch compatibility: See 13.4. (line 8217) bsN: See 19.2.3. (line 10448) bugs, reporting: See 1. (line 284) built-in shell commands, conflicts with <1>: See 25.1. (line 12459) built-in shell commands, conflicts with <2>: See 24.1. (line 12370) built-in shell commands, conflicts with <3>: See 23.3. (line 12099) built-in shell commands, conflicts with <4>: See 19.1. (line 10233) built-in shell commands, conflicts with <5>: See 16.3. (line 9338) built-in shell commands, conflicts with <6>: See 15.2. (line 9140) built-in shell commands, conflicts with <7>: See 15.1. (line 9046) built-in shell commands, conflicts with <8>: See 14.3. (line 8784) built-in shell commands, conflicts with: See 12.5. (line 7610) byte count: See 6.1. (line 2720) byte-swapping: See 11.2. (line 6473) c for character special file: See 12.5. (line 7624) C shell syntax for color setup: See 10.4. (line 5938) C-s/C-q flow control: See 19.2.2. (line 10374) calendar date item: See 28.2. (line 13227) canonical file name <1>: See 18.5. (line 10121) canonical file name: See 12.6. (line 7654) canonicalize a file name <1>: See 18.5. (line 10121) canonicalize a file name: See 12.6. (line 7654) case folding: See 7.1. (line 3097) case translation: See 19.2.4. (line 10491) case, ignored in dates: See 28.1. (line 13214) cat: See 3.1. (line 964) cbreak: See 19.2.5. (line 10565) cbs: See 11.2. (line 6379) CD-ROM file system type: See 14.1. (line 8492) cdfs file system type: See 14.1. (line 8492) cdtrdsr: See 19.2.1. (line 10335) change or print terminal settings: See 19.2. (line 10244) change SELinux context: See 22.1. (line 11756) changed files, verbosely describing: See 13.2. (line 7978) changed owners, verbosely describing: See 13.1. (line 7861) changing access permissions: See 13.3. (line 8055) changing file attributes: See 13. (line 7785) changing file ownership: See 13.1. (line 7797) changing file timestamps: See 13.4. (line 8127) changing group ownership <1>: See 13.2. (line 7964) changing group ownership: See 13.1. (line 7797) changing security context: See 22.1. (line 11756) changing special mode bits: See 27.2.3. (line 12840) character classes: See 9.1.1. (line 4776) character count: See 6.1. (line 2720) character size: See 19.2.1. (line 10315) character special check: See 16.3.1. (line 9367) character special files: See 12.5. (line 7601) character special files, creating: See 12.5. (line 7596) characters, special: See 19.2.6. (line 10596) chcon: See 22.1. (line 11756) check file types: See 16.3. (line 9316) checking for sortedness: See 7.1. (line 3021) checksum, 128-bit: See 6.4. (line 2865) checksum, 16-bit: See 6.2. (line 2800) checksum, 160-bit: See 6.5. (line 2978) checksum, 224-bit: See 6.6. (line 2992) checksum, 256-bit: See 6.6. (line 2992) checksum, 384-bit: See 6.6. (line 2992) checksum, 512-bit: See 6.6. (line 2992) chgrp: See 13.2. (line 7964) chmod: See 13.3. (line 8055) chown: See 13.1. (line 7797) chroot: See 23.1. (line 11892) cio: See 11.2. (line 6531) cksum: See 6.3. (line 2838) clocal: See 19.2.1. (line 10329) clock skew <1>: See 13.4. (line 8138) clock skew: See 10.1.6. (line 5702) clone: See 11.1. (line 6224) cntrl: See 9.1.1. (line 4798) color database, printing: See 10.4. (line 5943) color setup: See 10.4. (line 5904) color, distinguishing file types with: See 10.1.5. (line 5585) cols: See 19.2.7. (line 10679) column to wrap data after: See 3.5. (line 1435) COLUMNS: See 19.2.7. (line 10682) columns: See 19.2.7. (line 10679) COLUMNS: See 10.1.5. (line 5687) combination settings: See 19.2.5. (line 10519) combined date and time of day item: See 28.5. (line 13346) comm: See 7.4. (line 3764) command-line operands to shuffle: See 7.2. (line 3562) commands for controlling processes: See 24. (line 12360) commands for delaying: See 25. (line 12428) commands for exit status: See 16. (line 9261) commands for file name manipulation: See 18. (line 9827) commands for invoking other commands: See 23. (line 11885) commands for printing text: See 15. (line 9036) commands for printing the working context: See 19. (line 10202) commands for printing user information: See 20. (line 10760) commands for redirection: See 17. (line 9699) commands for SELinux context: See 22. (line 11751) commands for system context: See 21. (line 11002) commas, outputting between files: See 10.1.5. (line 5661) comments, in dates: See 28.1. (line 13214) common field, joining on: See 8.3. (line 4501) common lines: See 7.4. (line 3776) common options: See 2. (line 306) compare values: See 16.3. (line 9316) comparing sorted files: See 7.4. (line 3764) comparison operators: See 16.4.3. (line 9660) concatenate and write files: See 3.1. (line 964) concurrent I/O: See 11.2. (line 6531) conditional executability: See 27.2.4. (line 12893) conditions: See 16. (line 9261) conflicts with shell built-ins <1>: See 25.1. (line 12459) conflicts with shell built-ins <2>: See 24.1. (line 12370) conflicts with shell built-ins <3>: See 23.3. (line 12099) conflicts with shell built-ins <4>: See 19.1. (line 10233) conflicts with shell built-ins <5>: See 16.3. (line 9338) conflicts with shell built-ins <6>: See 15.2. (line 9140) conflicts with shell built-ins <7>: See 15.1. (line 9046) conflicts with shell built-ins <8>: See 14.3. (line 8784) conflicts with shell built-ins: See 12.5. (line 7610) connectives, logical <1>: See 16.4.3. (line 9644) connectives, logical: See 16.3.6. (line 9504) context splitting: See 5.4. (line 2569) context, system: See 21. (line 11002) control characters, using ^C: See 19.2.4. (line 10506) control settings: See 19.2.1. (line 10302) controlling terminal: See 11.2. (line 6588) conv: See 11.2. (line 6418) conversion block size: See 11.2. (line 6379) conversion specifiers, date: See 21.1.2. (line 11116) conversion specifiers, literal: See 21.1.3. (line 11214) conversion specifiers, time: See 21.1.1. (line 11035) converting tabs to spaces: See 9.2. (line 4969) converting while copying a file: See 11.2. (line 6344) cooked: See 19.2.5. (line 10550) Coordinated Universal Time: See 21.1.6. (line 11436) copy on write: See 11.1. (line 6224) copying directories recursively: See 11.1. (line 6052) copying existing permissions: See 27.2.2. (line 12824) copying files: See 3.1. (line 964) copying files and directories: See 11.1. (line 5960) copying files and setting attributes: See 11.3. (line 6695) core utilities: See ``GNU Coreutils''. (line 275) count: See 11.2. (line 6394) count_bytes: See 11.2. (line 6618) COW: See 11.1. (line 6224) cp: See 11.1. (line 5960) crashes and corruption: See 14.4. (line 8967) CRC checksum: See 6.3. (line 2838) cread: See 19.2.1. (line 10326) creating directories: See 12.3. (line 7504) creating FIFOs (named pipes): See 12.4. (line 7564) creating links (hard only): See 12.1. (line 7272) creating links (hard or soft): See 12.2. (line 7299) creating output file, avoiding: See 11.2. (line 6491) creating output file, requiring: See 11.2. (line 6487) crN: See 19.2.3. (line 10438) crown margin: See 4.1. (line 1492) crt: See 19.2.5. (line 10588) crterase: See 19.2.4. (line 10477) crtkill: See 19.2.4. (line 10511) crtscts: See 19.2.1. (line 10332) csh syntax for color setup: See 10.4. (line 5938) csN: See 19.2.1. (line 10315) csplit: See 5.4. (line 2569) cstopb: See 19.2.1. (line 10323) ctime, printing or sorting by: See 10.1.3. (line 5467) ctime, show the most recent: See 14.2. (line 8701) ctlecho: See 19.2.4. (line 10506) current working directory, printing: See 19.1. (line 10209) cut: See 8.1. (line 4357) cyclic redundancy check: See 6.3. (line 2838) data, erasing: See 11.6. (line 7063) database for color setup, printing: See 10.4. (line 5943) date: See 21.1. (line 11008) date and time of day format, ISO 8601: See 28.5. (line 13346) date conversion specifiers: See 21.1.2. (line 11116) date format, ISO 8601: See 28.2. (line 13251) date input formats: See 28. (line 13120) date options: See 21.1.6. (line 11329) date strings, parsing: See 21.1.6. (line 11334) day in date strings: See 28.7. (line 13394) day of week item: See 28.6. (line 13365) dd: See 11.2. (line 6344) dec: See 19.2.5. (line 10591) decctlq: See 19.2.5. (line 10576) Decode base64 data: See 3.5. (line 1443) delay for a specified time: See 25.1. (line 12431) delaying commands: See 25. (line 12428) deleting characters: See 9.1.3. (line 4889) dereferencing symbolic links: See 12.2. (line 7335) descriptor follow option: See 5.2. (line 2221) destination directory <1>: See 12.2. (line 7454) destination directory <2>: See 11.4. (line 6932) destination directory <3>: See 11.3. (line 6809) destination directory <4>: See 11.1. (line 6306) destination directory: See 2.8. (line 767) destinations, multiple output: See 17.1. (line 9707) device file, disk: See 14.1. (line 8309) df: See 14.1. (line 8285) DF_BLOCK_SIZE: See 2.3. (line 433) diagnostic: See 22.1. (line 11811) dictionary order: See 7.1. (line 3090) differing lines: See 7.4. (line 3776) digit: See 9.1.1. (line 4801) dir: See 10.2. (line 5888) dircolors: See 10.4. (line 5904) direct: See 11.2. (line 6537) direct I/O: See 11.2. (line 6537) directories, copying: See 11.1. (line 5960) directories, copying recursively: See 11.1. (line 6052) directories, creating: See 12.3. (line 7504) directories, creating with given attributes: See 11.3. (line 6751) directories, removing: See 11.5. (line 6975) directories, removing (recursively): See 11.5. (line 7035) directories, removing empty: See 12.7. (line 7725) directory: See 11.2. (line 6545) directory check: See 16.3.1. (line 9370) directory components, printing: See 18.2. (line 9891) directory deletion, ignoring failures: See 12.7. (line 7736) directory deletion, reporting: See 12.7. (line 7750) directory I/O: See 11.2. (line 6545) directory listing: See 10.1. (line 5054) directory listing, brief: See 10.2. (line 5888) directory listing, recursive: See 10.1.1. (line 5184) directory listing, verbose: See 10.3. (line 5897) directory order, listing by: See 10.1.3. (line 5474) directory, creating temporary: See 18.4. (line 9989) directory, stripping from file names: See 18.1. (line 9832) dired Emacs mode support: See 10.1.2. (line 5200) dirname: See 18.2. (line 9891) disabling special characters: See 19.2.6. (line 10603) disambiguating group names and IDs: See 2.6. (line 695) discarding file cache: See 11.2. (line 6561) disk allocation: See 10.1.2. (line 5428) disk device file: See 14.1. (line 8309) disk usage: See 14. (line 8278) disk usage by file system: See 14.1. (line 8285) disk usage for files: See 14.2. (line 8523) diskette file system: See 14.1. (line 8496) displacement of dates: See 28.7. (line 13385) displaying text: See 15.1. (line 9041) displaying value of a symbolic link: See 12.6. (line 7654) division: See 16.4.2. (line 9637) do nothing, successfully: See 16.2. (line 9290) do nothing, unsuccessfully: See 16.1. (line 9269) DOS file system: See 14.1. (line 8496) double spacing: See 4.3. (line 1889) down columns: See 4.3. (line 1863) dsusp: See 19.2.6. (line 10643) dsync: See 11.2. (line 6550) DTR/DSR flow control: See 19.2.1. (line 10335) du: See 14.2. (line 8523) DU_BLOCK_SIZE: See 2.3. (line 433) ebcdic, converting to: See 11.2. (line 6428) echo <1>: See 19.2.4. (line 10473) echo: See 15.1. (line 9041) echoctl: See 19.2.4. (line 10506) echoe: See 19.2.4. (line 10477) echok: See 19.2.4. (line 10481) echoke: See 19.2.4. (line 10511) echonl: See 19.2.4. (line 10484) echoprt: See 19.2.4. (line 10501) effective user and group IDs, printing: See 20.1. (line 10766) effective user ID, printing: See 20.3. (line 10839) efs file system type: See 14.1. (line 8488) Eggert, Paul: See 28.11. (line 13540) eight-bit characters <1>: See 19.2.5. (line 10568) eight-bit characters: See 19.2.1. (line 10315) eight-bit input: See 19.2.2. (line 10359) ek: See 19.2.5. (line 10535) empty files, creating: See 13.4. (line 8132) empty lines, numbering: See 3.3. (line 1157) entire files, output of: See 3. (line 958) env: See 23.2. (line 11962) environment variables, printing: See 19.3. (line 10707) environment, printing: See 23.2. (line 12001) environment, running a program in a modified: See 23.2. (line 11962) eof: See 19.2.6. (line 10622) eol: See 19.2.6. (line 10625) eol2: See 19.2.6. (line 10628) epoch, for POSIX: See 28.9. (line 13473) epoch, seconds since: See 21.1.1. (line 11071) equal string check: See 16.3.4. (line 9465) equivalence classes: See 9.1.1. (line 4825) erase: See 19.2.6. (line 10616) erasing data: See 11.6. (line 7063) error messages, omitting <1>: See 13.3. (line 8094) error messages, omitting <2>: See 13.2. (line 7984) error messages, omitting: See 13.1. (line 7867) evaluation of expressions: See 16.4. (line 9519) even parity: See 19.2.1. (line 10309) evenp: See 19.2.5. (line 10522) exabyte, definition of: See 2.3. (line 538) examples of date: See 21.1.7. (line 11445) examples of expr: See 16.4.4. (line 9671) exbibyte, definition of: See 2.3. (line 542) excl: See 11.2. (line 6487) excluding files from du: See 14.2. (line 8748) executable file check: See 16.3.2. (line 9412) executables and file type, marking: See 10.1.5. (line 5612) execute/search permission: See 27.1. (line 12643) execute/search permission, symbolic: See 27.2.1. (line 12794) existence-of-file check: See 16.3.3. (line 9428) existing backup method: See 2.2. (line 407) exit status commands: See 16. (line 9261) exit status of chroot: See 23.1. (line 11944) exit status of env: See 23.2. (line 12056) exit status of expr: See 16.4. (line 9556) exit status of false: See 16.1. (line 9269) exit status of ls: See 10.1. (line 5077) exit status of mktemp: See 18.4. (line 10113) exit status of nice: See 23.3. (line 12121) exit status of nohup: See 23.4. (line 12211) exit status of pathchk: See 18.3. (line 9981) exit status of printenv: See 19.3. (line 10726) exit status of realpath: See 18.5. (line 10194) exit status of runcon: See 22.2. (line 11876) exit status of sort: See 7.1. (line 3061) exit status of stdbuf: See 23.5. (line 12285) exit status of test: See 16.3. (line 9351) exit status of timeout: See 23.6. (line 12348) exit status of true: See 16.2. (line 9290) exit status of tty: See 19.4. (line 10750) expand: See 9.2. (line 4969) expr: See 16.4. (line 9519) expression evaluation <1>: See 16.4. (line 9519) expression evaluation: See 16.3. (line 9316) expressions, numeric: See 16.4.2. (line 9627) expressions, string: See 16.4.1. (line 9566) extended attributes, xattr <1>: See 11.4. (line 6861) extended attributes, xattr: See 11.3. (line 6724) extension, sorting files by: See 10.1.3. (line 5517) factor: See 26.1. (line 12475) failure exit status: See 16.1. (line 9269) false: See 16.1. (line 9269) fdatasync: See 11.2. (line 6503) ffN: See 19.2.3. (line 10456) field separator character: See 7.1. (line 3328) fields, padding numeric: See 21.1.4. (line 11228) FIFOs, creating: See 12.4. (line 7564) file attributes, changing: See 13. (line 7785) file characteristic tests: See 16.3.3. (line 9425) file contents, dumping unambiguously: See 3.4. (line 1201) file information, preserving: See 11.1. (line 6194) file information, preserving, extended attributes, xattr:See 11.1. (line 6125) file mode bits, numeric: See 27.3. (line 12983) file name manipulation: See 18. (line 9827) file names, canonicalization: See 18.5. (line 10121) file names, checking validity and portability: See 18.3. (line 9937) file names, creating temporary: See 18.4. (line 9989) file names, stripping directory and suffix: See 18.1. (line 9832) file offset radix: See 3.4. (line 1231) file ownership, changing: See 13.1. (line 7797) file sizes: See 14.2. (line 8570) file space usage: See 14.2. (line 8523) file status: See 14.3. (line 8775) file system disk usage: See 14.1. (line 8285) file system sizes: See 14.1. (line 8328) file system space, retrieving current data more slowly:See 14.1. (line 8463) file system space, retrieving old data more quickly:See 14.1. (line 8368) file system status: See 14.3. (line 8775) file system types, limiting output to certain: See 14.1. (line 8364) file system types, printing: See 14.1. (line 8476) file systems: See 14.3. (line 8797) file systems and hard links: See 12.2. (line 7299) file systems, omitting copying to different: See 11.1. (line 6333) file timestamp resolution: See 13.4. (line 8147) file timestamps, changing: See 13.4. (line 8127) file type and executables, marking: See 10.1.5. (line 5612) file type tests: See 16.3.1. (line 9360) file type, marking: See 10.1.5. (line 5623) file types: See 12. (line 7257) file types, special: See 12. (line 7254) file utilities: See ``GNU Coreutils''. (line 275) files beginning with -, removing: See 11.5. (line 7042) files, copying: See 11.1. (line 5960) files, creating: See 14.5. (line 8986) fingerprint, 128-bit: See 6.4. (line 2865) fingerprint, 160-bit: See 6.5. (line 2978) fingerprint, 224-bit: See 6.6. (line 2992) fingerprint, 256-bit: See 6.6. (line 2992) fingerprint, 384-bit: See 6.6. (line 2992) fingerprint, 512-bit: See 6.6. (line 2992) first in date strings: See 28.1. (line 13176) first part of files, outputting: See 5.1. (line 2117) fixed-length records, converting to variable-length:See 11.2. (line 6379) floating point: See 2.4. (line 568) flow control, hardware: See 19.2.1. (line 10332) flow control, software: See 19.2.2. (line 10379) flushing, disabling: See 19.2.4. (line 10487) fmt: See 4.1. (line 1464) fold: See 4.4. (line 2071) folding long input lines: See 4.4. (line 2071) footers, numbering: See 3.3. (line 1087) force deletion: See 11.6. (line 7158) formatting file contents: See 4. (line 1459) formatting of numbers in seq: See 26.2. (line 12541) formatting times <1>: See 21.1. (line 11022) formatting times: See 4.3. (line 1893) fortnight in date strings: See 28.7. (line 13394) fsync: See 11.2. (line 6507) fullblock: See 11.2. (line 6608) general date syntax: See 28.1. (line 13154) general numeric sort: See 7.1. (line 3108) gibibyte, definition of: See 2.3. (line 521) gigabyte, definition of: See 2.3. (line 517) giving away permissions: See 27.2.6. (line 12961) GMT: See 21.1.6. (line 11436) grand total of disk size, usage and available space:See 14.1. (line 8332) grand total of disk space: See 14.2. (line 8579) graph: See 9.1.1. (line 4804) Greenwich Mean Time: See 21.1.6. (line 11436) group IDs, disambiguating: See 2.6. (line 695) group names, disambiguating: See 2.6. (line 695) group owner, default: See 27.1. (line 12656) group ownership of installed files, setting: See 11.3. (line 6757) group ownership, changing <1>: See 13.2. (line 7964) group ownership, changing: See 13.1. (line 7797) group, permissions for: See 27.2.1. (line 12757) groups: See 20.4. (line 10851) growing files: See 5.2. (line 2221) hangups, immunity to: See 23.4. (line 12170) hard link check: See 16.3.3. (line 9442) hard link, defined: See 12.2. (line 7325) hard links: See 11.2. (line 6597) hard links to directories: See 12.2. (line 7383) hard links to symbolic links: See 12.2. (line 7466) hard links, counting in du: See 14.2. (line 8632) hard links, creating <1>: See 12.2. (line 7299) hard links, creating: See 12.1. (line 7272) hard links, preserving: See 11.1. (line 6065) hardware class: See 21.4. (line 11648) hardware flow control: See 19.2.1. (line 10332) hardware platform: See 21.4. (line 11642) hardware type: See 21.4. (line 11648) hat notation for control characters: See 19.2.4. (line 10506) head: See 5.1. (line 2117) head of output: See 7.2. (line 3575) headers, numbering: See 3.3. (line 1087) help, online: See 2. (line 337) hex dump of files: See 3.4. (line 1201) High Sierra file system: See 14.1. (line 8492) holes, copying files with: See 11.1. (line 6254) holes, creating files with: See 14.5. (line 8988) horizontal, listing files: See 10.1.5. (line 5671) host processor type: See 21.4. (line 11657) hostid: See 21.6. (line 11708) hostname <1>: See 21.5. (line 11692) hostname: See 21.4. (line 11653) hour in date strings: See 28.7. (line 13394) hsfs file system type: See 14.1. (line 8492) human numeric sort: See 7.1. (line 3133) human-readable output <1>: See 14.2. (line 8614) human-readable output <2>: See 14.1. (line 8343) human-readable output <3>: See 10.1.2. (line 5300) human-readable output: See 2.3. (line 464) hup[cl]: See 19.2.1. (line 10319) hurd, author, printing: See 10.1.2. (line 5194) ibs: See 11.2. (line 6364) icanon: See 19.2.4. (line 10466) icrnl: See 19.2.2. (line 10368) id: See 20.1. (line 10766) idle time: See 20.6. (line 10979) IEEE floating point: See 2.4. (line 568) iexten: See 19.2.4. (line 10470) if: See 11.2. (line 6356) iflag: See 11.2. (line 6512) ignbrk: See 19.2.2. (line 10343) igncr: See 19.2.2. (line 10365) ignore file systems: See 14.1. (line 8322) Ignore garbage in base64 stream: See 3.5. (line 1449) ignoring case: See 7.1. (line 3097) ignpar: See 19.2.2. (line 10349) imaxbel: See 19.2.2. (line 10393) immunity to hangups: See 23.4. (line 12170) implementation, hardware: See 21.4. (line 11642) indenting lines: See 4.3. (line 1995) index: See 16.4.1. (line 9605) information, about current users: See 20.6. (line 10899) initial part of files, outputting: See 5.1. (line 2117) initial tabs, converting: See 9.2. (line 4997) inlcr: See 19.2.2. (line 10362) inode number, printing: See 10.1.2. (line 5307) inode usage: See 14.1. (line 8353) inode, and hard links: See 12.2. (line 7325) inodes, written buffered: See 14.4. (line 8962) inpck: See 19.2.2. (line 10356) input block size: See 11.2. (line 6364) input encoding, UTF-8: See 19.2.2. (line 10371) input range to shuffle: See 7.2. (line 3566) input settings: See 19.2.2. (line 10340) input tabs: See 4.3. (line 1913) install: See 11.3. (line 6695) intr: See 19.2.6. (line 10610) invocation of commands, modified: See 23. (line 11885) isig: See 19.2.4. (line 10462) ISO 8601 date and time of day format: See 28.5. (line 13346) ISO 8601 date format: See 28.2. (line 13251) ISO/IEC 10646: See 15.2. (line 9194) ispeed: See 19.2.7. (line 10668) istrip: See 19.2.2. (line 10359) items in date strings: See 28.1. (line 13154) iterations, selecting the number of: See 11.6. (line 7163) iuclc: See 19.2.2. (line 10384) iutf8: See 19.2.2. (line 10371) ixany: See 19.2.2. (line 10389) ixoff: See 19.2.2. (line 10379) ixon: See 19.2.2. (line 10374) join: See 8.3. (line 4501) kernel name: See 21.4. (line 11672) kernel release: See 21.4. (line 11668) kernel version: See 21.4. (line 11683) kibibyte, definition of: See 2.3. (line 505) kibibytes for file sizes: See 14.2. (line 8620) kibibytes for file system sizes: See 14.1. (line 8358) kill <1>: See 24.1. (line 12363) kill: See 19.2.6. (line 10619) kilobyte, definition of: See 2.3. (line 500) Knuth, Donald E.: See 4.1. (line 1477) language, in dates: See 28.1. (line 13190) last DAY <1>: See 28.6. (line 13374) last DAY: See 21.1.6. (line 11334) last in date strings: See 28.1. (line 13176) last modified dates, displaying in du: See 14.2. (line 8695) last part of files, outputting: See 5.2. (line 2179) LC_ALL <1>: See 10.1. (line 5065) LC_ALL: See 7.1. (line 3052) LC_COLLATE <1>: See 16.4.3. (line 9660) LC_COLLATE <2>: See 8.3. (line 4509) LC_COLLATE <3>: See 7.4. (line 3770) LC_COLLATE <4>: See 7.3. (line 3659) LC_COLLATE: See 7.1. (line 3052) LC_CTYPE <1>: See 15.2. (line 9194) LC_CTYPE: See 7.1. (line 3082) LC_MESSAGES: See 4.3. (line 1827) LC_NUMERIC <1>: See 15.2. (line 9181) LC_NUMERIC <2>: See 7.1. (line 3108) LC_NUMERIC <3>: See 2.4. (line 579) LC_NUMERIC: See 2.3. (line 479) LC_TIME <1>: See 21.1. (line 11013) LC_TIME <2>: See 14.2. (line 8715) LC_TIME <3>: See 10.1.6. (line 5720) LC_TIME <4>: See 7.1. (line 3155) LC_TIME: See 4.3. (line 1900) LCASE: See 19.2.5. (line 10584) lcase: See 19.2.5. (line 10584) lcase, converting to: See 11.2. (line 6452) lchown <1>: See 13.2. (line 7988) lchown: See 13.1. (line 7894) leading directories, creating missing: See 11.3. (line 6751) leading directory components, stripping: See 18.1. (line 9832) leap seconds <1>: See 28.9. (line 13487) leap seconds <2>: See 28.3. (line 13288) leap seconds <3>: See 28.1. (line 13219) leap seconds <4>: See 21.1.7. (line 11543) leap seconds <5>: See 21.1.6. (line 11436) leap seconds <6>: See 21.1.1. (line 11071) leap seconds: See 13.4. (line 8250) left margin: See 4.3. (line 1995) length: See 16.4.1. (line 9610) limiting output of du: See 14.2. (line 8592) line: See 19.2.7. (line 10689) line buffered: See 23.5. (line 12224) line count: See 6.1. (line 2720) line numbering: See 3.3. (line 1076) line settings of terminal: See 19.2. (line 10244) line-breaking: See 4.1. (line 1477) line-by-line comparison: See 7.4. (line 3764) LINES: See 19.2.7. (line 10682) link: See 12.1. (line 7272) links, creating <1>: See 12.2. (line 7299) links, creating: See 12.1. (line 7272) Linux file system types: See 14.1. (line 8488) literal conversion specifiers: See 21.1.3. (line 11214) litout: See 19.2.5. (line 10572) ln: See 12.2. (line 7299) ln format for nl: See 3.3. (line 1168) lnext: See 19.2.6. (line 10652) local file system types: See 14.1. (line 8488) local settings: See 19.2.4. (line 10461) logging out and continuing to run: See 23.4. (line 12170) logical and operator <1>: See 16.4.3. (line 9655) logical and operator: See 16.3.6. (line 9510) logical connectives <1>: See 16.4.3. (line 9644) logical connectives: See 16.3.6. (line 9504) logical or operator <1>: See 16.4.3. (line 9649) logical or operator: See 16.3.6. (line 9513) logical pages, numbering on: See 3.3. (line 1082) login name, printing: See 20.2. (line 10825) login sessions, printing users with: See 20.5. (line 10877) login time: See 20.6. (line 10904) logname: See 20.2. (line 10825) long ls format: See 10.1.2. (line 5315) lower: See 9.1.1. (line 4807) lowercase, translating to output: See 19.2.3. (line 10405) ls: See 10.1. (line 5054) LS_BLOCK_SIZE: See 2.3. (line 433) LS_COLORS <1>: See 10.4. (line 5921) LS_COLORS: See 10.1.5. (line 5597) lutimes: See 13.4. (line 8221) machine type: See 21.4. (line 11648) machine-readable stty output: See 19.2. (line 10279) MacKenzie, D.: See 1. (line 291) MacKenzie, David: See 28.11. (line 13540) Makefiles, installing programs in: See 11.3. (line 6719) manipulating files: See 11. (line 5954) manipulation of file names: See 18. (line 9827) match: See 16.4.1. (line 9596) matching patterns: See 16.4.1. (line 9571) MD5: See 6.4. (line 2865) md5sum: See 6.4. (line 2865) mebibyte, definition of: See 2.3. (line 514) mebibytes for file sizes: See 14.2. (line 8636) megabyte, definition of: See 2.3. (line 510) merging files: See 8.2. (line 4448) merging files in parallel: See 4.3. (line 1820) merging sorted files: See 7.1. (line 3035) message status: See 20.6. (line 10988) message-digest, 128-bit: See 6.4. (line 2865) message-digest, 160-bit: See 6.5. (line 2978) message-digest, 224-bit: See 6.6. (line 2992) message-digest, 256-bit: See 6.6. (line 2992) message-digest, 384-bit: See 6.6. (line 2992) message-digest, 512-bit: See 6.6. (line 2992) Meyering, J.: See 1. (line 291) Meyering, Jim: See 28.11. (line 13540) midnight in date strings: See 28.3. (line 13296) min: See 19.2.7. (line 10659) minute in date strings: See 28.7. (line 13394) minutes, time zone correction by: See 28.3. (line 13304) mkdir: See 12.3. (line 7504) mkfifo: See 12.4. (line 7564) mknod: See 12.5. (line 7596) mktemp: See 18.4. (line 9989) modem control: See 19.2.1. (line 10329) modes and umask: See 27.2.6. (line 12955) modes of created directories, setting: See 12.3. (line 7517) modes of created FIFOs, setting: See 12.4. (line 7579) modification time, sorting files by: See 10.1.3. (line 5490) modified command invocation: See 23. (line 11885) modified environment, running a program in a: See 23.2. (line 11962) modify time, changing: See 13.4. (line 8236) month in date strings: See 28.7. (line 13394) month names in date strings: See 28.2. (line 13259) months, sorting by: See 7.1. (line 3155) months, written-out: See 28.1. (line 13186) MS-DOS file system: See 14.1. (line 8496) mtime, changing: See 13.4. (line 8236) multicolumn output, generating: See 4.3. (line 1820) multiple changes to permissions: See 27.2.5. (line 12907) multiplication: See 16.4.2. (line 9637) multipliers after numbers: See 11.2. (line 6644) multithreaded sort: See 7.1. (line 3356) mv: See 11.4. (line 6833) name follow option: See 5.2. (line 2221) name of kernel: See 21.4. (line 11672) named pipe check: See 16.3.1. (line 9382) named pipes, creating: See 12.4. (line 7564) network node name: See 21.4. (line 11653) never interactive option: See 11.5. (line 6996) newer files, copying only: See 11.1. (line 6315) newer files, moving only: See 11.4. (line 6909) newer-than file check: See 16.3.3. (line 9434) newline echoing after kill: See 19.2.4. (line 10481) newline, echoing: See 19.2.4. (line 10484) newline, translating to crlf: See 19.2.3. (line 10412) newline, translating to return: See 19.2.2. (line 10362) next DAY <1>: See 28.6. (line 13374) next DAY: See 21.1.6. (line 11334) next in date strings: See 28.1. (line 13176) NFS file system type: See 14.1. (line 8483) NFS mounts from BSD to HP-UX <1>: See 14.2. (line 8763) NFS mounts from BSD to HP-UX: See 10.1.2. (line 5436) nice: See 23.3. (line 12067) niceness: See 23.3. (line 12067) nl <1>: See 19.2.5. (line 10531) nl: See 3.3. (line 1076) nlN: See 19.2.3. (line 10432) no dereference: See 22.1. (line 11776) no-op: See 16.2. (line 9290) noatime: See 11.2. (line 6583) nocache: See 11.2. (line 6561) nocreat: See 11.2. (line 6491) noctty: See 11.2. (line 6588) node name: See 21.4. (line 11653) noerror: See 11.2. (line 6500) noflsh: See 19.2.4. (line 10487) nofollow: See 11.2. (line 6594) nohup: See 23.4. (line 12170) nohup.out: See 23.4. (line 12170) nolinks: See 11.2. (line 6597) non-directories, copying as special files: See 11.1. (line 6052) non-directory suffix, stripping: See 18.2. (line 9891) nonblock: See 11.2. (line 6580) nonblocking I/O: See 11.2. (line 6580) none backup method: See 2.2. (line 399) none color option: See 10.1.5. (line 5587) none dd status=: See 11.2. (line 6413) none, sorting option for ls: See 10.1.3. (line 5503) nonempty file check: See 16.3.3. (line 9431) nonprinting characters, ignoring: See 7.1. (line 3148) nonzero-length string check: See 16.3.4. (line 9462) noon in date strings: See 28.3. (line 13296) not-equal string check: See 16.3.4. (line 9471) notrunc: See 11.2. (line 6497) now in date strings: See 28.7. (line 13412) noxfer dd status=: See 11.2. (line 6409) nproc: See 21.3. (line 11585) number of inputs to merge, nmerge: See 7.1. (line 3262) numbered backup method: See 2.2. (line 403) numbering lines: See 3.3. (line 1076) numbers, written-out: See 28.1. (line 13176) numeric expressions: See 16.4.2. (line 9627) numeric field padding: See 21.1.4. (line 11228) numeric modes: See 27.3. (line 12983) numeric operations: See 26. (line 12470) numeric sequences: See 26.2. (line 12523) numeric sort: See 7.1. (line 3165) numeric tests: See 16.3.5. (line 9477) numeric uid and gid: See 10.1.2. (line 5418) numeric user and group IDs: See 10.1.2. (line 5418) numfmt: See 4.2. (line 1540) obs: See 11.2. (line 6368) ocrnl: See 19.2.3. (line 10409) octal dump of files: See 3.4. (line 1201) octal numbers for file modes: See 27.3. (line 12983) od: See 3.4. (line 1201) odd parity: See 19.2.1. (line 10309) oddp: See 19.2.5. (line 10527) of: See 11.2. (line 6359) ofdel: See 19.2.3. (line 10427) ofill: See 19.2.3. (line 10423) oflag: See 11.2. (line 6516) olcuc: See 19.2.3. (line 10405) older-than file check: See 16.3.3. (line 9438) once interactive option: See 11.5. (line 6998) one file system, restricting du to: See 14.2. (line 8759) one file system, restricting rm to: See 11.5. (line 7007) one-line output format: See 14.1. (line 8437) onlcr: See 19.2.3. (line 10412) onlret: See 19.2.3. (line 10420) onocr: See 19.2.3. (line 10416) operating on characters: See 9. (line 4658) operating on sorted files: See 7. (line 3004) operating system name: See 21.4. (line 11664) opost: See 19.2.3. (line 10402) option delimiter: See 2. (line 344) options for date: See 21.1.6. (line 11329) or operator <1>: See 16.4.3. (line 9649) or operator: See 16.3.6. (line 9513) ordinal numbers: See 28.1. (line 13176) ospeed: See 19.2.7. (line 10671) other permissions: See 27.2.1. (line 12760) output block size: See 11.2. (line 6368) output file name prefix <1>: See 5.4. (line 2625) output file name prefix: See 5.3. (line 2384) output file name suffix: See 5.4. (line 2629) output format: See 14.3. (line 8803) output format, portable: See 14.1. (line 8437) output NUL-byte-terminated lines <1>: See 23.2. (line 12039) output NUL-byte-terminated lines <2>: See 19.3. (line 10720) output NUL-byte-terminated lines: See 14.2. (line 8543) output of entire files: See 3. (line 958) output of parts of files: See 5. (line 2112) output settings: See 19.2.3. (line 10399) output tabs: See 4.3. (line 1932) overwriting of input, allowed <1>: See 7.2. (line 3580) overwriting of input, allowed: See 7.1. (line 3288) owned by effective group ID check: See 16.3.2. (line 9419) owned by effective user ID check: See 16.3.2. (line 9416) owner of file, permissions for: See 27.2.1. (line 12754) owner, default: See 27.1. (line 12656) ownership of installed files, setting: See 11.3. (line 6775) p for FIFO file: See 12.5. (line 7618) pad character: See 19.2.3. (line 10427) pad instead of timing for delaying: See 19.2.3. (line 10423) padding of numeric fields: See 21.1.4. (line 11228) paragraphs, reformatting: See 4.1. (line 1464) parenb: See 19.2.1. (line 10305) parent directories and cp: See 11.1. (line 6198) parent directories, creating: See 12.3. (line 7532) parent directories, creating missing: See 11.3. (line 6751) parent directories, removing: See 12.7. (line 7741) parentheses for grouping: See 16.4. (line 9544) parity: See 19.2.5. (line 10523) parity errors, marking: See 19.2.2. (line 10352) parity, ignoring: See 19.2.2. (line 10349) parmrk: See 19.2.2. (line 10352) parodd: See 19.2.1. (line 10309) parse_datetime: See 28. (line 13120) parsing date strings: See 21.1.6. (line 11334) parts of files, output of: See 5. (line 2112) pass8: See 19.2.5. (line 10568) paste: See 8.2. (line 4448) Paterson, R.: See 1. (line 291) PATH: See 23.2. (line 11979) pathchk: See 18.3. (line 9937) pattern matching: See 16.4.1. (line 9571) PC file system: See 14.1. (line 8496) pcfs: See 14.1. (line 8496) pebibyte, definition of: See 2.3. (line 535) permission tests: See 16.3.2. (line 9394) permissions of installed files, setting: See 11.3. (line 6763) permissions, changing access: See 13.3. (line 8055) permissions, copying existing: See 27.2.2. (line 12824) permissions, for changing file timestamps: See 13.4. (line 8161) permissions, output by ls: See 10.1.2. (line 5375) petabyte, definition of: See 2.3. (line 531) phone directory order: See 7.1. (line 3090) pieces, splitting a file into: See 5.3. (line 2375) Pinard, F. <1>: See 28.11. (line 13553) Pinard, F.: See 1. (line 291) pipe fitting: See 17.1. (line 9707) Plass, Michael F.: See 4.1. (line 1477) platform, hardware: See 21.4. (line 11642) pm in date strings: See 28.3. (line 13296) portable file names, checking for: See 18.3. (line 9937) portable output format: See 14.1. (line 8437) POSIX: See 1. (line 283) POSIX output format: See 14.1. (line 8437) POSIXLY_CORRECT <1>: See 20.1. (line 10771) POSIXLY_CORRECT <2>: See 15.2. (line 9172) POSIXLY_CORRECT <3>: See 15.1. (line 9113) POSIXLY_CORRECT <4>: See 11.2. (line 6685) POSIXLY_CORRECT <5>: See 7.1. (line 3296) POSIXLY_CORRECT <6>: See 4.3. (line 1900) POSIXLY_CORRECT <7>: See 2.13. (line 930) POSIXLY_CORRECT: See 2. (line 311) POSIXLY_CORRECT, and block size: See 2.3. (line 433) pr: See 4.3. (line 1820) prime factors: See 26.1. (line 12475) print: See 9.1.1. (line 4810) print machine hardware name: See 21.2. (line 11572) print name of current directory: See 19.1. (line 10209) print system information: See 21.4. (line 11613) print terminal file name: See 19.4. (line 10735) Print the number of processors: See 21.3. (line 11585) printenv: See 19.3. (line 10707) printf: See 15.2. (line 9130) printing all or some environment variables: See 19.3. (line 10707) printing color database: See 10.4. (line 5943) printing current user information: See 20.6. (line 10899) printing current usernames: See 20.5. (line 10877) printing groups a user is in: See 20.4. (line 10851) printing real and effective user and group IDs:See 20.1. (line 10766) printing text: See 15.1. (line 9041) printing text, commands for: See 15. (line 9036) printing the current time: See 21.1. (line 11008) printing the effective user ID: See 20.3. (line 10839) printing the host identifier: See 21.6. (line 11708) printing the hostname: See 21.5. (line 11692) printing the system uptime and load: See 21.7. (line 11726) printing user's login name: See 20.2. (line 10825) printing, preparing files for: See 4.3. (line 1820) process zero-terminated items <1>: See 7.3. (line 3750) process zero-terminated items <2>: See 7.2. (line 3591) process zero-terminated items: See 7.1. (line 3378) processes, commands for controlling: See 24. (line 12360) prompting, and ln: See 12.2. (line 7393) prompting, and mv: See 11.4. (line 6865) prompting, and rm: See 11.5. (line 6951) prompts, forcing: See 11.4. (line 6896) prompts, omitting: See 11.4. (line 6890) prterase: See 19.2.4. (line 10501) ptx: See 7.5. (line 3821) punct: See 9.1.1. (line 4813) pure numbers in date strings: See 28.8. (line 13446) pwd: See 19.1. (line 10209) quit: See 19.2.6. (line 10613) quoting style: See 10.1.7. (line 5837) radix for file offsets: See 3.4. (line 1231) random sort: See 7.1. (line 3194) random source for shredding: See 11.6. (line 7169) random source for shuffling: See 7.2. (line 3586) random source for sorting: See 7.1. (line 3301) random sources: See 2.7. (line 728) ranges: See 9.1.1. (line 4748) raw: See 19.2.5. (line 10556) read errors, ignoring: See 11.2. (line 6500) read from stdin and write to stdout and files: See 17.1. (line 9707) read permission: See 27.1. (line 12637) read permission, symbolic: See 27.2.1. (line 12788) read system call, and holes: See 11.1. (line 6254) readable file check: See 16.3.2. (line 9403) readlink: See 12.6. (line 7654) real user and group IDs, printing: See 20.1. (line 10766) realpath <1>: See 18.5. (line 10121) realpath: See 12.6. (line 7654) recursive directory listing: See 10.1.1. (line 5184) recursively changing access permissions: See 13.3. (line 8118) recursively changing file ownership: See 13.1. (line 7931) recursively changing group ownership: See 13.2. (line 8024) recursively copying directories: See 11.1. (line 6052) redirection: See 17. (line 9699) reference file: See 22.1. (line 11780) reformatting paragraph text: See 4.1. (line 1464) regular expression matching: See 16.4.1. (line 9571) regular file check: See 16.3.1. (line 9373) relations, numeric or string: See 16.4.3. (line 9644) relative items in date strings: See 28.7. (line 13385) release of kernel: See 21.4. (line 11668) relpath: See 18.5. (line 10171) remainder: See 16.4.2. (line 9637) remote hostname: See 20.6. (line 10904) removing empty directories: See 12.7. (line 7725) removing files after shredding: See 11.6. (line 7180) removing files or directories: See 11.5. (line 6946) removing files or directories (via the unlink syscall):See 12.8. (line 7763) removing permissions: See 27.2.1. (line 12773) repeated characters: See 9.1.1. (line 4769) repeated lines, outputting: See 7.3. (line 3701) repeated output of a string: See 15.3. (line 9248) restricted deletion flag: See 27.1. (line 12681) return, ignoring: See 19.2.2. (line 10365) return, translating to newline <1>: See 19.2.3. (line 10409) return, translating to newline: See 19.2.2. (line 10368) reverse sorting <1>: See 10.1.3. (line 5481) reverse sorting: See 7.1. (line 3188) reversing files: See 3.2. (line 1035) rm: See 11.5. (line 6946) rmdir: See 12.7. (line 7725) rn format for nl: See 3.3. (line 1171) root as default owner: See 11.3. (line 6775) root directory, allow recursive destruction: See 11.5. (line 7028) root directory, allow recursive modification <1>:See 13.3. (line 8103) root directory, allow recursive modification <2>:See 13.2. (line 8006) root directory, allow recursive modification: See 13.1. (line 7912) root directory, disallow recursive destruction:See 11.5. (line 7023) root directory, disallow recursive modification <1>:See 13.3. (line 8098) root directory, disallow recursive modification <2>:See 13.2. (line 8001) root directory, disallow recursive modification:See 13.1. (line 7907) root directory, running a program in a specified:See 23.1. (line 11892) rows: See 19.2.7. (line 10674) rprnt: See 19.2.6. (line 10646) RTS/CTS flow control: See 19.2.1. (line 10332) run commands with bounded time: See 23.6. (line 12295) run with security context: See 22.2. (line 11836) runcon: See 22.2. (line 11836) running a program in a modified environment: See 23.2. (line 11962) running a program in a specified root directory:See 23.1. (line 11892) rz format for nl: See 3.3. (line 1174) Salz, Rich: See 28.11. (line 13540) same file check: See 16.3.3. (line 9442) sane: See 19.2.5. (line 10539) scheduling, affecting: See 23.3. (line 12067) screen columns: See 4.4. (line 2079) seconds since the epoch: See 21.1.1. (line 11071) section delimiters of pages: See 3.3. (line 1138) security context <1>: See 20.1. (line 10808) security context <2>: See 12.5. (line 7644) security context <3>: See 12.4. (line 7586) security context <4>: See 12.3. (line 7554) security context <5>: See 11.3. (line 6780) security context: See 10.1.2. (line 5452) seek: See 11.2. (line 6389) seek_bytes: See 11.2. (line 6630) self-backups: See 11.1. (line 6007) SELinux <1>: See 20.1. (line 10808) SELinux <2>: See 12.5. (line 7644) SELinux <3>: See 12.4. (line 7586) SELinux <4>: See 12.3. (line 7554) SELinux <5>: See 11.3. (line 6780) SELinux: See 10.1.2. (line 5452) SELinux context: See 22. (line 11751) SELinux, context: See 22. (line 11751) send a signal to processes: See 24.1. (line 12363) sentences and line-breaking: See 4.1. (line 1477) separator for numbers in seq: See 26.2. (line 12559) seq: See 26.2. (line 12523) sequence of numbers: See 26.2. (line 12523) set-group-ID: See 27.1. (line 12674) set-group-ID check: See 16.3.2. (line 9397) set-user-ID: See 27.1. (line 12667) set-user-ID check: See 16.3.2. (line 9406) setgid: See 27.1. (line 12674) setting permissions: See 27.2.1. (line 12777) setting the hostname: See 21.5. (line 11692) setting the time: See 21.1.5. (line 11289) setuid: See 27.1. (line 12667) setup for color: See 10.4. (line 5904) sh syntax for color setup: See 10.4. (line 5932) SHA-1: See 6.5. (line 2978) SHA-2: See 6.6. (line 2992) sha1sum: See 6.5. (line 2978) sha224sum: See 6.6. (line 2992) sha256sum: See 6.6. (line 2992) sha384sum: See 6.6. (line 2992) sha512sum: See 6.6. (line 2992) SHELL environment variable, and color <1>: See 10.4. (line 5921) SHELL environment variable, and color: See 10.1.5. (line 5597) shell utilities: See ``GNU Coreutils''. (line 275) shred: See 11.6. (line 7063) shuf: See 7.2. (line 3549) shuffling files: See 7.2. (line 3549) SI output <1>: See 14.2. (line 8655) SI output <2>: See 14.1. (line 8456) SI output <3>: See 10.1.2. (line 5444) SI output: See 2.3. (line 464) signals, specifying: See 2.5. (line 591) simple backup method: See 2.2. (line 412) SIMPLE_BACKUP_SUFFIX: See 2.2. (line 418) single-column output of files: See 10.1.5. (line 5574) size: See 19.2.7. (line 10682) size for main memory sorting: See 7.1. (line 3312) size of file to shred: See 11.6. (line 7174) size of files, reporting: See 10.1.2. (line 5428) size of files, sorting files by: See 10.1.3. (line 5486) skip: See 11.2. (line 6384) skip_bytes: See 11.2. (line 6624) sleep: See 25.1. (line 12431) socket check: See 16.3.1. (line 9385) software flow control: See 19.2.2. (line 10379) sort: See 7.1. (line 3009) sort field: See 7.1. (line 3237) sort stability: See 7.1. (line 3041) sort's last-resort comparison: See 7.1. (line 3041) sorted files, operations on: See 7. (line 3004) sorting files: See 7.1. (line 3009) sorting ls output: See 10.1.3. (line 5460) space: See 9.1.1. (line 4816) sparse: See 11.2. (line 6460) sparse files, copying: See 11.1. (line 6254) sparse files, creating: See 14.5. (line 8988) special characters: See 19.2.6. (line 10596) special file types: See 12. (line 7254) special files: See 12.5. (line 7601) special settings: See 19.2.7. (line 10658) specifying sets of characters: See 9.1.1. (line 4703) speed: See 19.2.7. (line 10692) split: See 5.3. (line 2375) splitting a file into pieces: See 5.3. (line 2375) splitting a file into pieces by context: See 5.4. (line 2569) squeezing empty lines: See 3.1. (line 994) squeezing repeat characters: See 9.1.3. (line 4889) Stallman, R.: See 1. (line 291) standard input: See 2. (line 349) standard output: See 2. (line 349) standard streams, buffering: See 23.5. (line 12224) start: See 19.2.6. (line 10634) stat: See 14.3. (line 8775) status: See 11.2. (line 6404) status time, printing or sorting by: See 10.1.3. (line 5467) status time, show the most recent: See 14.2. (line 8701) stdbuf: See 23.5. (line 12224) sticky: See 27.1. (line 12681) sticky bit check: See 16.3.2. (line 9400) stop: See 19.2.6. (line 10637) stop bits: See 19.2.1. (line 10323) strftime and date: See 21.1. (line 11022) string constants, outputting: See 3.4. (line 1271) string expressions: See 16.4.1. (line 9566) string tests: See 16.3.4. (line 9449) strip directory and suffix from file names: See 18.1. (line 9832) stripping non-directory suffix: See 18.2. (line 9891) stripping symbol table information: See 11.3. (line 6797) stripping trailing slashes <1>: See 11.4. (line 6922) stripping trailing slashes: See 11.1. (line 6288) stty: See 19.2. (line 10244) substr: See 16.4.1. (line 9600) subtracting permissions: See 27.2.1. (line 12773) subtraction: See 16.4.2. (line 9633) successful exit: See 16.2. (line 9290) suffix, stripping from file names: See 18.1. (line 9832) sum: See 6.2. (line 2800) summarizing files: See 6. (line 2714) superblock, writing: See 14.4. (line 8962) supplementary groups, printing: See 20.4. (line 10851) susp: See 19.2.6. (line 10640) swab (byte-swapping): See 11.2. (line 6473) swap space, saving text image in: See 27.1. (line 12681) swtch: See 19.2.6. (line 10631) symbol table information, stripping: See 11.3. (line 6797) symbol table information, stripping, program: See 11.3. (line 6800) symbolic (soft) links, creating: See 12.2. (line 7299) symbolic link check: See 16.3.1. (line 9377) symbolic link to directory, controlling traversal of:See 2.10. (line 851) symbolic link to directory, never traverse <1>:See 22.1. (line 11806) symbolic link to directory, never traverse <2>:See 13.2. (line 8037) symbolic link to directory, never traverse <3>:See 13.1. (line 7943) symbolic link to directory, never traverse: See 2.10. (line 871) symbolic link to directory, traverse each that is encountered <1>:See 22.1. (line 11802) symbolic link to directory, traverse each that is encountered <2>:See 13.2. (line 8033) symbolic link to directory, traverse each that is encountered <3>:See 13.1. (line 7939) symbolic link to directory, traverse each that is encountered:See 2.10. (line 867) symbolic link to directory, traverse if on the command line <1>:See 22.1. (line 11797) symbolic link to directory, traverse if on the command line <2>:See 13.2. (line 8028) symbolic link to directory, traverse if on the command line <3>:See 13.1. (line 7934) symbolic link to directory, traverse if on the command line:See 2.10. (line 863) symbolic link, defined: See 12.2. (line 7335) symbolic links and ln: See 12.2. (line 7466) symbolic links and pwd: See 19.1. (line 10229) symbolic links, changing group: See 13.2. (line 7993) symbolic links, changing owner <1>: See 13.2. (line 7988) symbolic links, changing owner: See 13.1. (line 7871) symbolic links, changing time: See 13.4. (line 8221) symbolic links, copying: See 11.1. (line 6065) symbolic links, copying with: See 11.1. (line 6293) symbolic links, dereferencing: See 10.1.1. (line 5129) symbolic links, dereferencing in du: See 14.2. (line 8626) symbolic links, dereferencing in stat: See 14.3. (line 8791) symbolic links, following: See 11.2. (line 6594) symbolic links, permissions of: See 13.3. (line 8059) symbolic modes: See 27.2. (line 12718) symlinks, resolution: See 18.5. (line 10121) sync <1>: See 14.4. (line 8962) sync: See 11.2. (line 6558) sync (padding with ASCII NULs): See 11.2. (line 6478) synchronize disk and memory: See 14.4. (line 8962) synchronized data and metadata I/O: See 11.2. (line 6558) synchronized data and metadata writes, before finishing:See 11.2. (line 6507) synchronized data reads: See 11.2. (line 6550) synchronized data writes, before finishing: See 11.2. (line 6503) system context: See 21. (line 11002) system information, printing <1>: See 21.4. (line 11613) system information, printing <2>: See 21.3. (line 11585) system information, printing: See 21.2. (line 11572) system name, printing: See 21.5. (line 11692) System V sum: See 6.2. (line 2825) tab stops, setting: See 9.2. (line 4985) tabN: See 19.2.3. (line 10444) tabs: See 19.2.5. (line 10579) tabs to spaces, converting: See 9.2. (line 4969) tac: See 3.2. (line 1035) tagged paragraphs: See 4.1. (line 1498) tail: See 5.2. (line 2179) tandem: See 19.2.2. (line 10379) target directory <1>: See 12.2. (line 7454) target directory <2>: See 11.4. (line 6932) target directory <3>: See 11.3. (line 6809) target directory <4>: See 11.1. (line 6306) target directory: See 2.8. (line 758) tebibyte, definition of: See 2.3. (line 528) tee: See 17.1. (line 9707) telephone directory order: See 7.1. (line 3090) temporary directory: See 7.1. (line 3348) temporary files and directories: See 18.4. (line 9989) terabyte, definition of: See 2.3. (line 524) terminal check: See 16.3.1. (line 9388) terminal file name, printing: See 19.4. (line 10735) terminal lines, currently used: See 20.6. (line 10904) terminal settings: See 19.2. (line 10244) terminal, using color iff: See 10.1.5. (line 5589) terse output: See 14.3. (line 8823) test: See 16.3. (line 9316) text: See 11.2. (line 6604) text I/O: See 11.2. (line 6604) text image, saving in swap space: See 27.1. (line 12681) text input files: See 6.4. (line 2954) text utilities: See ``GNU Coreutils''. (line 275) text, displaying: See 15.1. (line 9041) text, reformatting: See 4.1. (line 1464) this in date strings: See 28.7. (line 13412) time <1>: See 19.2.7. (line 10663) time: See 13.4. (line 8207) time conversion specifiers: See 21.1.1. (line 11035) time formats <1>: See 21.1. (line 11022) time formats: See 4.3. (line 1893) time limit: See 23.6. (line 12295) time of day item: See 28.3. (line 13280) time setting: See 21.1.5. (line 11289) time style <1>: See 14.2. (line 8710) time style: See 10.1.6. (line 5716) time units <1>: See 25.1. (line 12436) time units: See 23.6. (line 12339) time zone correction: See 28.3. (line 13304) time zone item <1>: See 28.4. (line 13323) time zone item: See 28.1. (line 13194) time, printing or setting: See 21.1. (line 11008) TIME_STYLE <1>: See 14.2. (line 8738) TIME_STYLE: See 10.1.6. (line 5796) timeout: See 23.6. (line 12295) timestamps of installed files, preserving: See 11.3. (line 6787) timestamps, changing file: See 13.4. (line 8127) TMPDIR: See 7.1. (line 3067) today in date strings: See 28.7. (line 13412) tomorrow: See 21.1.6. (line 11334) tomorrow in date strings: See 28.7. (line 13408) topological sort: See 7.6. (line 4214) tostop: See 19.2.4. (line 10496) total counts: See 6.1. (line 2726) touch: See 13.4. (line 8127) tr: See 9.1. (line 4663) trailing slashes: See 2.9. (line 833) translating characters: See 9.1.2. (line 4837) true: See 16.2. (line 9290) truncate: See 14.5. (line 8981) truncating output file, avoiding: See 11.2. (line 6497) truncating, file sizes: See 14.5. (line 8981) tsort: See 7.6. (line 4214) tty: See 19.4. (line 10735) two-way parity: See 19.2.1. (line 10305) type size: See 3.4. (line 1317) TZ <1>: See 28.10. (line 13495) TZ <2>: See 21.1.6. (line 11436) TZ <3>: See 21.1. (line 11018) TZ <4>: See 20.6. (line 10919) TZ <5>: See 14.3. (line 8951) TZ <6>: See 13.4. (line 8186) TZ <7>: See 10.1.6. (line 5708) TZ: See 4.3. (line 1906) u, and disabling special characters: See 19.2.6. (line 10603) ucase, converting to: See 11.2. (line 6455) ufs file system type: See 14.1. (line 8488) umask and modes: See 27.2.6. (line 12955) uname: See 21.4. (line 11613) unblock: See 11.2. (line 6446) unexpand: See 9.3. (line 5007) Unicode: See 15.2. (line 9194) uniq: See 7.3. (line 3644) unique lines, outputting: See 7.3. (line 3739) uniquify files: See 7.3. (line 3644) uniquifying output: See 7.1. (line 3364) unlink: See 12.8. (line 7763) unprintable characters, ignoring: See 7.1. (line 3148) unsorted directory listing: See 10.1.3. (line 5474) upper: See 9.1.1. (line 4819) uppercase, translating to lowercase: See 19.2.2. (line 10384) uptime: See 21.7. (line 11726) use time, changing: See 13.4. (line 8199) use time, printing or sorting files by: See 10.1.3. (line 5467) use time, show the most recent: See 14.2. (line 8701) user IDs, disambiguating: See 2.6. (line 695) user information, commands for: See 20. (line 10760) user name, printing: See 20.2. (line 10825) user names, disambiguating: See 2.6. (line 695) usernames, printing current: See 20.5. (line 10877) users: See 20.5. (line 10877) UTC: See 21.1.6. (line 11436) utmp <1>: See 20.6. (line 10908) utmp <2>: See 20.5. (line 10885) utmp: See 20.2. (line 10825) valid file names, checking for: See 18.3. (line 9937) variable-length records, converting to fixed-length:See 11.2. (line 6379) vdir: See 10.3. (line 5897) verbose ls format: See 10.1.2. (line 5315) verifying MD5 checksums: See 6.4. (line 2927) version number sort: See 7.1. (line 3182) version number, finding: See 2. (line 341) version of kernel: See 21.4. (line 11683) version, sorting option for ls: See 10.1.3. (line 5510) version-control Emacs variable: See 2.2. (line 392) VERSION_CONTROL <1>: See 12.2. (line 7377) VERSION_CONTROL <2>: See 11.4. (line 6885) VERSION_CONTROL <3>: See 11.3. (line 6731) VERSION_CONTROL <4>: See 11.1. (line 6035) VERSION_CONTROL: See 2.2. (line 381) vertical sorted files in columns: See 10.1.5. (line 5579) vtN: See 19.2.3. (line 10452) wc: See 6.1. (line 2720) week in date strings: See 28.7. (line 13394) werase: See 19.2.6. (line 10649) who: See 20.6. (line 10899) who am i: See 20.6. (line 10914) whoami: See 20.3. (line 10839) word count: See 6.1. (line 2720) working context: See 19. (line 10202) working directory, printing: See 19.1. (line 10209) wrap data: See 3.5. (line 1435) wrapping long input lines: See 4.4. (line 2071) writable file check: See 16.3.2. (line 9409) write permission: See 27.1. (line 12640) write permission, symbolic: See 27.2.1. (line 12791) write, allowed: See 20.6. (line 10988) wtmp <1>: See 20.6. (line 10908) wtmp: See 20.5. (line 10885) xcase: See 19.2.4. (line 10491) xdigit: See 9.1.1. (line 4822) XON/XOFF flow control: See 19.2.2. (line 10374) year in date strings: See 28.7. (line 13394) yes: See 15.3. (line 9248) yesterday: See 21.1.6. (line 11334) yesterday in date strings: See 28.7. (line 13408) yottabyte, definition of: See 2.3. (line 552) Youmans, B.: See 1. (line 291) zero-length string check: See 16.3.4. (line 9458) zettabyte, definition of: See 2.3. (line 545) |: See 16.4.3. (line 9649)