diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ChangeLog-2007 (renamed from doc/ChangeLog) | 42 | ||||
-rw-r--r-- | doc/Makefile.am | 74 | ||||
-rw-r--r-- | doc/Makefile.in | 976 | ||||
-rw-r--r-- | doc/constants.texi | 1 | ||||
-rw-r--r-- | doc/coreutils.info | 19625 | ||||
-rw-r--r-- | doc/coreutils.texi | 7182 | ||||
-rw-r--r-- | doc/fdl.texi | 109 | ||||
-rw-r--r-- | doc/local.mk | 127 | ||||
-rw-r--r-- | doc/parse-datetime.texi (renamed from doc/getdate.texi) | 141 | ||||
-rw-r--r-- | doc/perm.texi | 71 | ||||
-rw-r--r-- | doc/stamp-vti | 8 | ||||
-rw-r--r-- | doc/version.texi | 8 |
12 files changed, 17189 insertions, 11175 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog-2007 index 38b5f9d..15e0c1b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog-2007 @@ -1,3 +1,42 @@ +2007-10-05 Jim Meyering <jim@meyering.net> + + * coreutils.texi (chroot invocation): List two systems on which + chroot works when run by non-root. + +2007-09-19 Jim Meyering <jim@meyering.net> + + * coreutils.texi (expr invocation): Correct description of relative + operator precedence. Reported by hanpingtian@gmail.com. + +2007-08-25 Eric Blake <ebb9@byu.net> + + Avoid case-insensitive clash in one-page-per-node html docs. + * coreutils.texi (Concept index): Rename from Index. + +2007-07-15 Jim Meyering <jim@meyering.net> + + * coreutils.texi: Revise node structure per new fdl.texi. + +2007-06-06 Jim Meyering <jim@meyering.net> + + * coreutils.texi (rmdir invocation): Fix a tiny typo. + +2007-06-03 Jim Meyering <jim@meyering.net> + + * constants.texi: Remove from version control. + This file has always been generated. + * .gitignore: Add constants.texi. + +2007-04-28 Paul Eggert <eggert@cs.ucla.edu> + + * coreutils.texi (nohup invocation): Add advice about saving + output to a file. + +2007-04-16 Jim Meyering <jim@meyering.net> + + * coreutils.texi (cut invocation): Adjust synopsis to show that an + OPTION is required. Reported by Rudolf Kastl. + 2007-03-21 Eric Blake <ebb9@byu.net> * coreutils.texi (md5sum invocation): Document escapes in output @@ -1963,8 +2002,7 @@ ----- - Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software - Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index e0e2ee5..0000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -# Make coreutils documentation. -*-Makefile-*- - -# Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, -# 2006 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -info_TEXINFOS = coreutils.texi - -EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi - -# The following is necessary if the package name is 8 characters or longer. -# If the info documentation would be split into 10 or more separate files, -# then this is necessary even if the package name is 7 characters long. -# -# Tell makeinfo to put everything in a single info file: <package>.info. -# Otherwise, it would also generate files with names like <package>.info-[123], -# and those names all map to one 14-byte name (<package>.info-) on some crufty -# old systems. -AM_MAKEINFOFLAGS = --no-split - -constants.texi: $(top_srcdir)/src/tail.c - LC_ALL=C \ - sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \ - $(top_srcdir)/src/tail.c > t-$@ - mv t-$@ $@ - -MAINTAINERCLEANFILES = constants.texi - -$(DVIS): $(EXTRA_DIST) -$(INFO_DEPS): $(EXTRA_DIST) - -# Extended regular expressions to match word starts and ends. -_W = (^|[^A-Za-z0-9_]) -W_ = ([^A-Za-z0-9_]|$$) - -# List words/regexps here that should not appear in the texinfo documentation. -# E.g., use @sc{nul}, not `NUL' -# Use `time zone', not `timezone'. -# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent). -check-texinfo: - fail=0; \ - grep timezone $(srcdir)/*.texi && fail=1; \ - $(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && fail=1; \ - grep non-zero $(srcdir)/*.texi && fail=1; \ - grep '@url{' $(srcdir)/*.texi && fail=1; \ - $(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && fail=1; \ - grep '\$$@"' $(srcdir)/*.texi && fail=1; \ - grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \ - grep -n filename $(srcdir)/*.texi|$(EGREP) -v 'setfilename|[{]filename[}]' \ - && fail=1; \ - $(PERL) -e 1 2> /dev/null && { $(PERL) -ne \ - '/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \ - $(srcdir)/*.texi 2> /dev/null || fail=1; }; \ - $(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && fail=1; \ - $(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \ - $(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \ - | $(EGREP) -v '@vindex PATH$$|@env[{]PATH[}]' && fail=1; \ - exit $$fail - -check: check-texinfo diff --git a/doc/Makefile.in b/doc/Makefile.in deleted file mode 100644 index ca84e92..0000000 --- a/doc/Makefile.in +++ /dev/null @@ -1,976 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Make coreutils documentation. -*-Makefile-*- - -# Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, -# 2006 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = doc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/stamp-vti $(srcdir)/version.texi ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/alloca.m4 \ - $(top_srcdir)/m4/allocsa.m4 $(top_srcdir)/m4/argmatch.m4 \ - $(top_srcdir)/m4/arpa_inet_h.m4 $(top_srcdir)/m4/assert.m4 \ - $(top_srcdir)/m4/atexit.m4 $(top_srcdir)/m4/autobuild.m4 \ - $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/base64.m4 \ - $(top_srcdir)/m4/bison.m4 $(top_srcdir)/m4/boottime.m4 \ - $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/calloc.m4 \ - $(top_srcdir)/m4/canon-host.m4 \ - $(top_srcdir)/m4/canonicalize.m4 \ - $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/check-decl.m4 \ - $(top_srcdir)/m4/chown.m4 $(top_srcdir)/m4/clock_time.m4 \ - $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ - $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ - $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/cycle-check.m4 \ - $(top_srcdir)/m4/d-ino.m4 $(top_srcdir)/m4/d-type.m4 \ - $(top_srcdir)/m4/dirfd.m4 $(top_srcdir)/m4/dirname.m4 \ - $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \ - $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \ - $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ - $(top_srcdir)/m4/euidaccess-stat.m4 \ - $(top_srcdir)/m4/euidaccess.m4 $(top_srcdir)/m4/exclude.m4 \ - $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/fchdir.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ - $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/fd-reopen.m4 \ - $(top_srcdir)/m4/file-type.m4 $(top_srcdir)/m4/fileblocks.m4 \ - $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/filenamecat.m4 \ - $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fnmatch.m4 \ - $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/fprintftime.m4 \ - $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstypename.m4 \ - $(top_srcdir)/m4/fsusage.m4 $(top_srcdir)/m4/ftruncate.m4 \ - $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getaddrinfo.m4 \ - $(top_srcdir)/m4/getcwd-abort-bug.m4 \ - $(top_srcdir)/m4/getcwd-path-max.m4 $(top_srcdir)/m4/getcwd.m4 \ - $(top_srcdir)/m4/getdate.m4 $(top_srcdir)/m4/getdelim.m4 \ - $(top_srcdir)/m4/getgroups.m4 $(top_srcdir)/m4/gethostname.m4 \ - $(top_srcdir)/m4/gethrxtime.m4 $(top_srcdir)/m4/getline.m4 \ - $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getndelim2.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/getpagesize.m4 \ - $(top_srcdir)/m4/getpass.m4 $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/getugroups.m4 \ - $(top_srcdir)/m4/getusershell.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 \ - $(top_srcdir)/m4/group-member.m4 \ - $(top_srcdir)/m4/hard-locale.m4 $(top_srcdir)/m4/hash.m4 \ - $(top_srcdir)/m4/host-os.m4 $(top_srcdir)/m4/human.m4 \ - $(top_srcdir)/m4/i-ring.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/idcache.m4 $(top_srcdir)/m4/inet_ntop.m4 \ - $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intmax_t.m4 \ - $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes-pri.m4 \ - $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/isapipe.m4 $(top_srcdir)/m4/jm-macros.m4 \ - $(top_srcdir)/m4/jm-winsz1.m4 $(top_srcdir)/m4/jm-winsz2.m4 \ - $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/lchown.m4 \ - $(top_srcdir)/m4/lib-check.m4 $(top_srcdir)/m4/lib-ignore.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/link-follow.m4 \ - $(top_srcdir)/m4/localcharset.m4 \ - $(top_srcdir)/m4/long-options.m4 \ - $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/ls-mntd-fs.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbscasecmp.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbswidth.m4 \ - $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/memcasecmp.m4 \ - $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \ - $(top_srcdir)/m4/memcoll.m4 $(top_srcdir)/m4/memcpy.m4 \ - $(top_srcdir)/m4/memmove.m4 $(top_srcdir)/m4/mempcpy.m4 \ - $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/memset.m4 \ - $(top_srcdir)/m4/memxfrm.m4 $(top_srcdir)/m4/mkancesdirs.m4 \ - $(top_srcdir)/m4/mkdir-p.m4 $(top_srcdir)/m4/mkdir-slash.m4 \ - $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/mktime.m4 \ - $(top_srcdir)/m4/modechange.m4 $(top_srcdir)/m4/mountlist.m4 \ - $(top_srcdir)/m4/mpsort.m4 $(top_srcdir)/m4/nanosleep.m4 \ - $(top_srcdir)/m4/netinet_in_h.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/pathmax.m4 \ - $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/physmem.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posixtm.m4 \ - $(top_srcdir)/m4/posixver.m4 $(top_srcdir)/m4/prereq.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/putenv.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/randint.m4 $(top_srcdir)/m4/randperm.m4 \ - $(top_srcdir)/m4/randread.m4 $(top_srcdir)/m4/readlink.m4 \ - $(top_srcdir)/m4/readtokens.m4 $(top_srcdir)/m4/readutmp.m4 \ - $(top_srcdir)/m4/regex.m4 \ - $(top_srcdir)/m4/rename-dest-slash.m4 \ - $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir-errno.m4 \ - $(top_srcdir)/m4/rmdir.m4 $(top_srcdir)/m4/root-dev-ino.m4 \ - $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/safe-read.m4 \ - $(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \ - $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \ - $(top_srcdir)/m4/savewd.m4 $(top_srcdir)/m4/setenv.m4 \ - $(top_srcdir)/m4/settime.m4 $(top_srcdir)/m4/sha1.m4 \ - $(top_srcdir)/m4/sha256.m4 $(top_srcdir)/m4/sha512.m4 \ - $(top_srcdir)/m4/sig2str.m4 $(top_srcdir)/m4/snprintf.m4 \ - $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sockpfaf.m4 \ - $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ - $(top_srcdir)/m4/stat-prog.m4 $(top_srcdir)/m4/stat-time.m4 \ - $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ - $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ - $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strcspn.m4 \ - $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strftime.m4 \ - $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \ - $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/strnumcmp.m4 \ - $(top_srcdir)/m4/strpbrk.m4 $(top_srcdir)/m4/strtod.m4 \ - $(top_srcdir)/m4/strtoimax.m4 $(top_srcdir)/m4/strtol.m4 \ - $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoul.m4 \ - $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/strtoumax.m4 \ - $(top_srcdir)/m4/strverscmp.m4 \ - $(top_srcdir)/m4/sys_socket_h.m4 \ - $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ - $(top_srcdir)/m4/tempname.m4 $(top_srcdir)/m4/time_h.m4 \ - $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/timespec.m4 \ - $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/tzset.m4 \ - $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \ - $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlink-busy.m4 \ - $(top_srcdir)/m4/unlinkdir.m4 $(top_srcdir)/m4/unlocked-io.m4 \ - $(top_srcdir)/m4/uptime.m4 $(top_srcdir)/m4/userspec.m4 \ - $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utime.m4 \ - $(top_srcdir)/m4/utimecmp.m4 $(top_srcdir)/m4/utimens.m4 \ - $(top_srcdir)/m4/utimes-null.m4 $(top_srcdir)/m4/utimes.m4 \ - $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \ - $(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/m4/wctype.m4 $(top_srcdir)/m4/wcwidth.m4 \ - $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ - $(top_srcdir)/m4/xfts.m4 $(top_srcdir)/m4/xgetcwd.m4 \ - $(top_srcdir)/m4/xnanosleep.m4 $(top_srcdir)/m4/xstrndup.m4 \ - $(top_srcdir)/m4/xstrtod.m4 $(top_srcdir)/m4/xstrtol.m4 \ - $(top_srcdir)/m4/yesno.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/lib/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -INFO_DEPS = $(srcdir)/coreutils.info -TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex -am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux -DVIS = coreutils.dvi -PDFS = coreutils.pdf -PSS = coreutils.ps -HTMLS = coreutils.html -TEXINFOS = coreutils.texi -TEXI2DVI = texi2dvi -TEXI2PDF = $(TEXI2DVI) --pdf --batch -MAKEINFOHTML = $(MAKEINFO) --html -AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) -DVIPS = dvips -am__installdirs = "$(DESTDIR)$(infodir)" -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABSOLUTE_DIRENT_H = @ABSOLUTE_DIRENT_H@ -ABSOLUTE_FCNTL_H = @ABSOLUTE_FCNTL_H@ -ABSOLUTE_INTTYPES_H = @ABSOLUTE_INTTYPES_H@ -ABSOLUTE_NETINET_IN_H = @ABSOLUTE_NETINET_IN_H@ -ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ -ABSOLUTE_STDIO_H = @ABSOLUTE_STDIO_H@ -ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@ -ABSOLUTE_STRING_H = @ABSOLUTE_STRING_H@ -ABSOLUTE_SYS_SOCKET_H = @ABSOLUTE_SYS_SOCKET_H@ -ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ -ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@ -ABSOLUTE_TIME_H = @ABSOLUTE_TIME_H@ -ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@ -ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@ -ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@ -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALLOCA_H = @ALLOCA_H@ -AMTAR = @AMTAR@ -ARPA_INET_H = @ARPA_INET_H@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ -BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ -BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ -BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ -BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFAULT_POSIX2_VERSION = @DEFAULT_POSIX2_VERSION@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DF_PROG = @DF_PROG@ -DIRENT_H = @DIRENT_H@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EOVERFLOW = @EOVERFLOW@ -EXEEXT = @EXEEXT@ -FCNTL_H = @FCNTL_H@ -FNMATCH_H = @FNMATCH_H@ -GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ -GETOPT_H = @GETOPT_H@ -GLIBC21 = @GLIBC21@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNULIB_CHOWN = @GNULIB_CHOWN@ -GNULIB_DUP2 = @GNULIB_DUP2@ -GNULIB_FCHDIR = @GNULIB_FCHDIR@ -GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ -GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ -GNULIB_GETCWD = @GNULIB_GETCWD@ -GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ -GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ -GNULIB_IMAXABS = @GNULIB_IMAXABS@ -GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ -GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ -GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ -GNULIB_MBSCHR = @GNULIB_MBSCHR@ -GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ -GNULIB_MBSLEN = @GNULIB_MBSLEN@ -GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ -GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ -GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ -GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ -GNULIB_MBSSEP = @GNULIB_MBSSEP@ -GNULIB_MBSSPN = @GNULIB_MBSSPN@ -GNULIB_MBSSTR = @GNULIB_MBSSTR@ -GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ -GNULIB_MEMMEM = @GNULIB_MEMMEM@ -GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ -GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ -GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ -GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ -GNULIB_READLINK = @GNULIB_READLINK@ -GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ -GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ -GNULIB_STPCPY = @GNULIB_STPCPY@ -GNULIB_STPNCPY = @GNULIB_STPNCPY@ -GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ -GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ -GNULIB_STRDUP = @GNULIB_STRDUP@ -GNULIB_STRNDUP = @GNULIB_STRNDUP@ -GNULIB_STRNLEN = @GNULIB_STRNLEN@ -GNULIB_STRPBRK = @GNULIB_STRPBRK@ -GNULIB_STRSEP = @GNULIB_STRSEP@ -GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ -GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ -GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ -GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ -GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ -GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ -GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ -GNU_PACKAGE = @GNU_PACKAGE@ -GREP = @GREP@ -HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ -HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ -HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ -HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ -HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ -HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ -HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ -HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@ -HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ -HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ -HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ -HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ -HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ -HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ -HAVE_DUP2 = @HAVE_DUP2@ -HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ -HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ -HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ -HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ -HAVE_MEMPCPY = @HAVE_MEMPCPY@ -HAVE_MKDTEMP = @HAVE_MKDTEMP@ -HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ -HAVE_READLINK = @HAVE_READLINK@ -HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ -HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ -HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ -HAVE_STDINT_H = @HAVE_STDINT_H@ -HAVE_STPCPY = @HAVE_STPCPY@ -HAVE_STPNCPY = @HAVE_STPNCPY@ -HAVE_STRCASECMP = @HAVE_STRCASECMP@ -HAVE_STRCASESTR = @HAVE_STRCASESTR@ -HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ -HAVE_STRNDUP = @HAVE_STRNDUP@ -HAVE_STRPBRK = @HAVE_STRPBRK@ -HAVE_STRSEP = @HAVE_STRSEP@ -HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ -HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ -HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ -HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ -HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ -HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ -HAVE_UNISTD_H = @HAVE_UNISTD_H@ -HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ -HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ -HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ -HAVE_WINT_T = @HAVE_WINT_T@ -HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ -HAVE__BOOL = @HAVE__BOOL@ -HELP2MAN = @HELP2MAN@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -INTTYPES_H = @INTTYPES_H@ -KMEM_GROUP = @KMEM_GROUP@ -LDFLAGS = @LDFLAGS@ -LIBCOREUTILS_LIBDEPS = @LIBCOREUTILS_LIBDEPS@ -LIBCOREUTILS_LTLIBDEPS = @LIBCOREUTILS_LTLIBDEPS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIB_ACL = @LIB_ACL@ -LIB_ACL_TRIVIAL = @LIB_ACL_TRIVIAL@ -LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ -LIB_CRYPT = @LIB_CRYPT@ -LIB_EACCESS = @LIB_EACCESS@ -LIB_FDATASYNC = @LIB_FDATASYNC@ -LIB_GETHRXTIME = @LIB_GETHRXTIME@ -LIB_NANOSLEEP = @LIB_NANOSLEEP@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MAN = @MAN@ -MKDIR_P = @MKDIR_P@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NEED_SETGID = @NEED_SETGID@ -NETINET_IN_H = @NETINET_IN_H@ -OBJEXT = @OBJEXT@ -OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -POSUB = @POSUB@ -POW_LIB = @POW_LIB@ -PRIPTR_PREFIX = @PRIPTR_PREFIX@ -PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ -PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ -RANLIB = @RANLIB@ -REPLACE_CHOWN = @REPLACE_CHOWN@ -REPLACE_FCHDIR = @REPLACE_FCHDIR@ -REPLACE_FPRINTF = @REPLACE_FPRINTF@ -REPLACE_GETCWD = @REPLACE_GETCWD@ -REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ -REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ -REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ -REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ -REPLACE_PRINTF = @REPLACE_PRINTF@ -REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ -REPLACE_SPRINTF = @REPLACE_SPRINTF@ -REPLACE_STRPTIME = @REPLACE_STRPTIME@ -REPLACE_TIMEGM = @REPLACE_TIMEGM@ -REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ -REPLACE_VPRINTF = @REPLACE_VPRINTF@ -REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ -REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ -SEQ_LIBM = @SEQ_LIBM@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ -SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ -STDBOOL_H = @STDBOOL_H@ -STDINT_H = @STDINT_H@ -STRIP = @STRIP@ -SYS_SOCKET_H = @SYS_SOCKET_H@ -SYS_STAT_H = @SYS_STAT_H@ -SYS_TIME_H = @SYS_TIME_H@ -SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ -TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ -U = @U@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -WCHAR_H = @WCHAR_H@ -WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WCTYPE_H = @WCTYPE_H@ -WINT_T_SUFFIX = @WINT_T_SUFFIX@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gl_LIBOBJS = @gl_LIBOBJS@ -gl_LTLIBOBJS = @gl_LTLIBOBJS@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -info_TEXINFOS = coreutils.texi -EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi - -# The following is necessary if the package name is 8 characters or longer. -# If the info documentation would be split into 10 or more separate files, -# then this is necessary even if the package name is 7 characters long. -# -# Tell makeinfo to put everything in a single info file: <package>.info. -# Otherwise, it would also generate files with names like <package>.info-[123], -# and those names all map to one 14-byte name (<package>.info-) on some crufty -# old systems. -AM_MAKEINFOFLAGS = --no-split -MAINTAINERCLEANFILES = constants.texi - -# Extended regular expressions to match word starts and ends. -_W = (^|[^A-Za-z0-9_]) -W_ = ([^A-Za-z0-9_]|$$) -all: all-am - -.SUFFIXES: -.SUFFIXES: .dvi .html .info .pdf .ps .texi -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu doc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -.texi.info: - restore=: && backupdir="$(am__leading_dot)am$$$$" && \ - am__cwd=`pwd` && cd $(srcdir) && \ - rm -rf $$backupdir && mkdir $$backupdir && \ - if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ - for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ - if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ - done; \ - else :; fi && \ - cd "$$am__cwd"; \ - if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ $<; \ - then \ - rc=0; \ - cd $(srcdir); \ - else \ - rc=$$?; \ - cd $(srcdir) && \ - $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ - fi; \ - rm -rf $$backupdir; exit $$rc - -.texi.dvi: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2DVI) $< - -.texi.pdf: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2PDF) $< - -.texi.html: - rm -rf $(@:.html=.htp) - if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $(@:.html=.htp) $<; \ - then \ - rm -rf $@; \ - if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ - mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ - else \ - if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ - rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ - exit 1; \ - fi -$(srcdir)/coreutils.info: coreutils.texi $(srcdir)/version.texi -coreutils.dvi: coreutils.texi $(srcdir)/version.texi -coreutils.pdf: coreutils.texi $(srcdir)/version.texi -coreutils.html: coreutils.texi $(srcdir)/version.texi -$(srcdir)/version.texi: $(srcdir)/stamp-vti -$(srcdir)/stamp-vti: coreutils.texi $(top_srcdir)/configure - @(dir=.; test -f ./coreutils.texi || dir=$(srcdir); \ - set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/coreutils.texi`; \ - echo "@set UPDATED $$1 $$2 $$3"; \ - echo "@set UPDATED-MONTH $$2 $$3"; \ - echo "@set EDITION $(VERSION)"; \ - echo "@set VERSION $(VERSION)") > vti.tmp - @cmp -s vti.tmp $(srcdir)/version.texi \ - || (echo "Updating $(srcdir)/version.texi"; \ - cp vti.tmp $(srcdir)/version.texi) - -@rm -f vti.tmp - @cp $(srcdir)/version.texi $@ - -mostlyclean-vti: - -rm -f vti.tmp - -maintainer-clean-vti: - -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi -.dvi.ps: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - $(DVIPS) -o $@ $< - -uninstall-dvi-am: - @$(NORMAL_UNINSTALL) - @list='$(DVIS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ - rm -f "$(DESTDIR)$(dvidir)/$$f"; \ - done - -uninstall-html-am: - @$(NORMAL_UNINSTALL) - @list='$(HTMLS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ - rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ - done - -uninstall-info-am: - @$(PRE_UNINSTALL) - @if test -d '$(DESTDIR)$(infodir)' && \ - (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ - install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ - done; \ - else :; fi - @$(NORMAL_UNINSTALL) - @list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ - (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ - echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ - rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ - else :; fi); \ - done - -uninstall-pdf-am: - @$(NORMAL_UNINSTALL) - @list='$(PDFS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ - done - -uninstall-ps-am: - @$(NORMAL_UNINSTALL) - @list='$(PSS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ - rm -f "$(DESTDIR)$(psdir)/$$f"; \ - done - -dist-info: $(INFO_DEPS) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - list='$(INFO_DEPS)'; \ - for base in $$list; do \ - case $$base in \ - $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ - esac; \ - if test -f $$base; then d=.; else d=$(srcdir); fi; \ - base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ - for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ - if test -f $$file; then \ - relfile=`expr "$$file" : "$$d/\(.*\)"`; \ - test -f $(distdir)/$$relfile || \ - cp -p $$file $(distdir)/$$relfile; \ - else :; fi; \ - done; \ - done - -mostlyclean-aminfo: - -rm -rf coreutils.aux coreutils.cp coreutils.cps coreutils.fl coreutils.fn \ - coreutils.ky coreutils.log coreutils.op coreutils.pg \ - coreutils.tmp coreutils.toc coreutils.tp coreutils.tps \ - coreutils.vr coreutils.dvi coreutils.pdf coreutils.ps \ - coreutils.html - -maintainer-clean-aminfo: - @list='$(INFO_DEPS)'; for i in $$list; do \ - i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ - echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ - rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ - done -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-info -check-am: all-am -check: check-am -all-am: Makefile $(INFO_DEPS) -installdirs: - for dir in "$(DESTDIR)$(infodir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: $(DVIS) - -html: html-am - -html-am: $(HTMLS) - -info: info-am - -info-am: $(INFO_DEPS) - -install-data-am: install-info-am - -install-dvi: install-dvi-am - -install-dvi-am: $(DVIS) - @$(NORMAL_INSTALL) - test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" - @list='$(DVIS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(dvidir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(dvidir)/$$f"; \ - done -install-exec-am: - -install-html: install-html-am - -install-html-am: $(HTMLS) - @$(NORMAL_INSTALL) - test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" - @list='$(HTMLS)'; for p in $$list; do \ - if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - if test -d "$$d$$p"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ - $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ - echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ - else \ - echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ - fi; \ - done -install-info: install-info-am - -install-info-am: $(INFO_DEPS) - @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - esac; \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ - for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ - $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ - if test -f $$ifile; then \ - relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ - echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ - $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ - else : ; fi; \ - done; \ - done - @$(POST_INSTALL) - @if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ - install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ - done; \ - else : ; fi -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: $(PDFS) - @$(NORMAL_INSTALL) - test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" - @list='$(PDFS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \ - done -install-ps: install-ps-am - -install-ps-am: $(PSS) - @$(NORMAL_INSTALL) - test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" - @list='$(PSS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(psdir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(psdir)/$$f"; \ - done -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-aminfo \ - maintainer-clean-generic maintainer-clean-vti - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti - -pdf: pdf-am - -pdf-am: $(PDFS) - -ps: ps-am - -ps-am: $(PSS) - -uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ - uninstall-pdf-am uninstall-ps-am - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic dist-info \ - distclean distclean-generic distdir dvi dvi-am html html-am \ - info info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-aminfo \ - maintainer-clean-generic maintainer-clean-vti mostlyclean \ - mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \ - pdf-am ps ps-am uninstall uninstall-am uninstall-dvi-am \ - uninstall-html-am uninstall-info-am uninstall-pdf-am \ - uninstall-ps-am - - -constants.texi: $(top_srcdir)/src/tail.c - LC_ALL=C \ - sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \ - $(top_srcdir)/src/tail.c > t-$@ - mv t-$@ $@ - -$(DVIS): $(EXTRA_DIST) -$(INFO_DEPS): $(EXTRA_DIST) - -# List words/regexps here that should not appear in the texinfo documentation. -# E.g., use @sc{nul}, not `NUL' -# Use `time zone', not `timezone'. -# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent). -check-texinfo: - fail=0; \ - grep timezone $(srcdir)/*.texi && fail=1; \ - $(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && fail=1; \ - grep non-zero $(srcdir)/*.texi && fail=1; \ - grep '@url{' $(srcdir)/*.texi && fail=1; \ - $(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && fail=1; \ - grep '\$$@"' $(srcdir)/*.texi && fail=1; \ - grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \ - grep -n filename $(srcdir)/*.texi|$(EGREP) -v 'setfilename|[{]filename[}]' \ - && fail=1; \ - $(PERL) -e 1 2> /dev/null && { $(PERL) -ne \ - '/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \ - $(srcdir)/*.texi 2> /dev/null || fail=1; }; \ - $(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && fail=1; \ - $(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \ - $(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \ - | $(EGREP) -v '@vindex PATH$$|@env[{]PATH[}]' && fail=1; \ - exit $$fail - -check: check-texinfo -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/doc/constants.texi b/doc/constants.texi index f6bffca..afbc6a0 100644 --- a/doc/constants.texi +++ b/doc/constants.texi @@ -1 +1,2 @@ @set DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS 5 +@set SHRED_DEFAULT_PASSES 3 diff --git a/doc/coreutils.info b/doc/coreutils.info index 4589ca2..524be8d 100644 --- a/doc/coreutils.info +++ b/doc/coreutils.info @@ -1,22 +1,36 @@ -This is coreutils.info, produced by makeinfo version 4.8 from +This is coreutils.info, produced by makeinfo version 6.0 from coreutils.texi. +This manual documents version 8.25 of the GNU core utilities, including +the standard programs for text and file manipulation. + + Copyright © 1994-2016 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”. INFO-DIR-SECTION Basics START-INFO-DIR-ENTRY * Coreutils: (coreutils). Core GNU (file, text, shell) utilities. -* Common options: (coreutils)Common options. Common options. +* Common options: (coreutils)Common options. * File permissions: (coreutils)File permissions. Access modes. * Date input formats: (coreutils)Date input formats. END-INFO-DIR-ENTRY INFO-DIR-SECTION Individual utilities START-INFO-DIR-ENTRY +* arch: (coreutils)arch invocation. Print machine hardware name. +* base32: (coreutils)base32 invocation. Base32 encode/decode data. * base64: (coreutils)base64 invocation. Base64 encode/decode data. * basename: (coreutils)basename invocation. Strip directory and suffix. * cat: (coreutils)cat invocation. Concatenate and write files. +* chcon: (coreutils)chcon invocation. Change SELinux CTX of files. * chgrp: (coreutils)chgrp invocation. Change file groups. -* chmod: (coreutils)chmod invocation. Change file permissions. -* chown: (coreutils)chown invocation. Change file owners/groups. +* chmod: (coreutils)chmod invocation. Change access permissions. +* chown: (coreutils)chown invocation. Change file owners and groups. * chroot: (coreutils)chroot invocation. Specify the root directory. * cksum: (coreutils)cksum invocation. Print POSIX CRC checksum. * comm: (coreutils)comm invocation. Compare sorted files by line. @@ -28,7 +42,7 @@ START-INFO-DIR-ENTRY * df: (coreutils)df invocation. Report file system disk usage. * dir: (coreutils)dir invocation. List directories briefly. * dircolors: (coreutils)dircolors invocation. Color setup for ls. -* dirname: (coreutils)dirname invocation. Strip non-directory suffix. +* dirname: (coreutils)dirname invocation. Strip last file name component. * du: (coreutils)du invocation. Report on disk usage. * echo: (coreutils)echo invocation. Print a line of text. * env: (coreutils)env invocation. Modify the environment. @@ -43,7 +57,7 @@ START-INFO-DIR-ENTRY * hostid: (coreutils)hostid invocation. Print numeric host identifier. * hostname: (coreutils)hostname invocation. Print or set system name. * id: (coreutils)id invocation. Print user identity. -* install: (coreutils)install invocation. Copy and change attributes. +* install: (coreutils)install invocation. Copy files and set attributes. * join: (coreutils)join invocation. Join lines on a common field. * kill: (coreutils)kill invocation. Send a signal to processes. * link: (coreutils)link invocation. Make hard links between files. @@ -54,10 +68,13 @@ START-INFO-DIR-ENTRY * mkdir: (coreutils)mkdir invocation. Create directories. * mkfifo: (coreutils)mkfifo invocation. Create FIFOs (named pipes). * mknod: (coreutils)mknod invocation. Create special files. +* mktemp: (coreutils)mktemp invocation. Create temporary files. * mv: (coreutils)mv invocation. Rename files. * nice: (coreutils)nice invocation. Modify niceness. * nl: (coreutils)nl invocation. Number lines and write files. * nohup: (coreutils)nohup invocation. Immunize to hangups. +* nproc: (coreutils)nproc invocation. Print the number of processors. +* numfmt: (coreutils)numfmt invocation. Reformat numbers. * od: (coreutils)od invocation. Dump files in octal, etc. * paste: (coreutils)paste invocation. Merge lines of files. * pathchk: (coreutils)pathchk invocation. Check file name portability. @@ -67,8 +84,10 @@ START-INFO-DIR-ENTRY * ptx: (coreutils)ptx invocation. Produce permuted indexes. * pwd: (coreutils)pwd invocation. Print working directory. * readlink: (coreutils)readlink invocation. Print referent of a symlink. +* realpath: (coreutils)realpath invocation. Print resolved file names. * rm: (coreutils)rm invocation. Remove files. * rmdir: (coreutils)rmdir invocation. Remove empty directories. +* runcon: (coreutils)runcon invocation. Run in specified SELinux CTX. * seq: (coreutils)seq invocation. Print numeric sequences * sha1sum: (coreutils)sha1sum invocation. Print or check SHA-1 digests. * sha2: (coreutils)sha2 utilities. Print or check SHA-2 digests. @@ -76,25 +95,28 @@ START-INFO-DIR-ENTRY * shuf: (coreutils)shuf invocation. Shuffling text files. * sleep: (coreutils)sleep invocation. Delay for a specified time. * sort: (coreutils)sort invocation. Sort text files. -* split: (coreutils)split invocation. Split into fixed-size pieces. +* split: (coreutils)split invocation. Split into pieces. * stat: (coreutils)stat invocation. Report file(system) status. +* stdbuf: (coreutils)stdbuf invocation. Modify stdio buffering. * stty: (coreutils)stty invocation. Print/change terminal settings. -* su: (coreutils)su invocation. Modify user and group ID. * sum: (coreutils)sum invocation. Print traditional checksum. -* sync: (coreutils)sync invocation. Synchronize memory and disk. +* sync: (coreutils)sync invocation. Synchronize memory to disk. * tac: (coreutils)tac invocation. Reverse files. * tail: (coreutils)tail invocation. Output the last part of files. * tee: (coreutils)tee invocation. Redirect to multiple files. * test: (coreutils)test invocation. File/string tests. +* timeout: (coreutils)timeout invocation. Run with time limit. * touch: (coreutils)touch invocation. Change file timestamps. * tr: (coreutils)tr invocation. Translate characters. * true: (coreutils)true invocation. Do nothing, successfully. +* truncate: (coreutils)truncate invocation. Shrink/extend size of a file. * tsort: (coreutils)tsort invocation. Topological sort. * tty: (coreutils)tty invocation. Print terminal name. * uname: (coreutils)uname invocation. Print system information. * unexpand: (coreutils)unexpand invocation. Convert spaces to tabs. * uniq: (coreutils)uniq invocation. Uniquify files. * unlink: (coreutils)unlink invocation. Removal via unlink(2). +* uptime: (coreutils)uptime invocation. Print uptime and load. * users: (coreutils)users invocation. Print current user names. * vdir: (coreutils)vdir invocation. List directories verbosely. * wc: (coreutils)wc invocation. Line, word, and byte counts. @@ -103,238 +125,232 @@ START-INFO-DIR-ENTRY * yes: (coreutils)yes invocation. Print a string indefinitely. END-INFO-DIR-ENTRY - This manual documents version 6.9 of the GNU core utilities, -including the standard programs for text and file manipulation. - - Copyright (C) 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2004, 2005, -2006 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.2 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". - File: coreutils.info, Node: Top, Next: Introduction, Up: (dir) GNU Coreutils ************* -This manual documents version 6.9 of the GNU core utilities, including +This manual documents version 8.25 of the GNU core utilities, including the standard programs for text and file manipulation. - Copyright (C) 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2004, 2005, -2006 Free Software Foundation, Inc. + Copyright © 1994-2016 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.2 or any later version published by the Free Software + 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". + and with no Back-Cover Texts. A copy of the license is included in + the section entitled “GNU Free Documentation License”. * Menu: -* Introduction:: Caveats, overview, and authors. -* Common options:: Common options. -* Output of entire files:: cat tac nl od -* Formatting file contents:: fmt pr fold -* Output of parts of files:: head tail split csplit -* Summarizing files:: wc sum cksum md5sum sha1sum sha2 -* Operating on sorted files:: sort shuf uniq comm ptx tsort -* Operating on fields within a line:: cut paste join -* Operating on characters:: tr expand unexpand -* Directory listing:: ls dir vdir dircolors -* Basic operations:: cp dd install mv rm shred -* Special file types:: ln mkdir rmdir mkfifo mknod -* Changing file attributes:: chgrp chmod chown touch -* Disk usage:: df du stat sync -* Printing text:: echo printf yes -* Conditions:: false true test expr -* Redirection:: tee -* File name manipulation:: dirname basename pathchk -* Working context:: pwd stty printenv tty -* User information:: id logname whoami groups users who -* System context:: date uname hostname hostid -* Modified command invocation:: chroot env nice nohup su -* Process control:: kill -* Delaying:: sleep -* Numeric operations:: factor seq -* File permissions:: Access modes. -* Date input formats:: Specifying date strings. -* Opening the software toolbox:: The software tools philosophy. -* Copying This Manual:: License for copying this manual. -* Index:: General index. - - --- The Detailed Node Listing --- +* Introduction:: Caveats, overview, and authors +* Common options:: Common options +* Output of entire files:: cat tac nl od base32 base64 +* Formatting file contents:: fmt pr fold +* Output of parts of files:: head tail split csplit +* Summarizing files:: wc sum cksum md5sum sha1sum sha2 +* Operating on sorted files:: sort shuf uniq comm ptx tsort +* Operating on fields:: cut paste join +* Operating on characters:: tr expand unexpand +* Directory listing:: ls dir vdir dircolors +* Basic operations:: cp dd install mv rm shred +* Special file types:: mkdir rmdir unlink mkfifo mknod ln link readlink +* Changing file attributes:: chgrp chmod chown touch +* Disk usage:: df du stat sync truncate +* Printing text:: echo printf yes +* Conditions:: false true test expr +* Redirection:: tee +* File name manipulation:: dirname basename pathchk mktemp realpath +* Working context:: pwd stty printenv tty +* User information:: id logname whoami groups users who +* System context:: date arch nproc uname hostname hostid uptime +* SELinux context:: chcon runcon +* Modified command invocation:: chroot env nice nohup stdbuf timeout +* Process control:: kill +* Delaying:: sleep +* Numeric operations:: factor numfmt seq +* File permissions:: Access modes +* Date input formats:: Specifying date strings +* Opening the software toolbox:: The software tools philosophy +* GNU Free Documentation License:: Copying and sharing this manual +* Concept index:: General index + + — The Detailed Node Listing — Common Options -* Exit status:: Indicating program success or failure. -* Backup options:: Backup options -* Block size:: Block size -* Disambiguating names and IDs:: chgrp and chown owner and group syntax -* Random sources:: Sources of random data -* Target directory:: Target directory -* Trailing slashes:: Trailing slashes -* Traversing symlinks:: Traversing symlinks to directories -* Treating / specially:: Treating / specially -* Standards conformance:: Standards conformance +* Exit status:: Indicating program success or failure +* Backup options:: Backup options +* Block size:: Block size +* Floating point:: Floating point number representation +* Signal specifications:: Specifying signals +* Disambiguating names and IDs:: chgrp, chown, chroot, id: user and group syntax +* Random sources:: Sources of random data +* Target directory:: Target directory +* Trailing slashes:: Trailing slashes +* Traversing symlinks:: Traversing symlinks to directories +* Treating / specially:: Treating / specially +* Standards conformance:: Standards conformance +* Multi-call invocation:: Multi-call program invocation Output of entire files -* cat invocation:: Concatenate and write files. -* tac invocation:: Concatenate and write files in reverse. -* nl invocation:: Number lines and write files. -* od invocation:: Write files in octal or other formats. -* base64 invocation:: Transform data into printable data. +* cat invocation:: Concatenate and write files +* tac invocation:: Concatenate and write files in reverse +* nl invocation:: Number lines and write files +* od invocation:: Write files in octal or other formats +* base32 invocation:: Transform data into printable data +* base64 invocation:: Transform data into printable data Formatting file contents -* fmt invocation:: Reformat paragraph text. -* pr invocation:: Paginate or columnate files for printing. -* fold invocation:: Wrap input lines to fit in specified width. +* fmt invocation:: Reformat paragraph text +* pr invocation:: Paginate or columnate files for printing +* fold invocation:: Wrap input lines to fit in specified width Output of parts of files -* head invocation:: Output the first part of files. -* tail invocation:: Output the last part of files. -* split invocation:: Split a file into fixed-size pieces. -* csplit invocation:: Split a file into context-determined pieces. +* head invocation:: Output the first part of files +* tail invocation:: Output the last part of files +* split invocation:: Split a file into fixed-size pieces +* csplit invocation:: Split a file into context-determined pieces Summarizing files -* wc invocation:: Print newline, word, and byte counts. -* sum invocation:: Print checksum and block counts. -* cksum invocation:: Print CRC checksum and byte counts. -* md5sum invocation:: Print or check MD5 digests. -* sha1sum invocation:: Print or check SHA-1 digests. -* sha2 utilities:: Print or check SHA-2 digests. +* wc invocation:: Print newline, word, and byte counts +* sum invocation:: Print checksum and block counts +* cksum invocation:: Print CRC checksum and byte counts +* md5sum invocation:: Print or check MD5 digests +* sha1sum invocation:: Print or check SHA-1 digests +* sha2 utilities:: Print or check SHA-2 digests Operating on sorted files -* sort invocation:: Sort text files. -* shuf invocation:: Shuffle text files. -* uniq invocation:: Uniquify files. -* comm invocation:: Compare two sorted files line by line. -* ptx invocation:: Produce a permuted index of file contents. -* tsort invocation:: Topological sort. +* sort invocation:: Sort text files +* shuf invocation:: Shuffle text files +* uniq invocation:: Uniquify files +* comm invocation:: Compare two sorted files line by line +* ptx invocation:: Produce a permuted index of file contents +* tsort invocation:: Topological sort -`ptx': Produce permuted indexes +‘ptx’: Produce permuted indexes -* General options in ptx:: Options which affect general program behavior. -* Charset selection in ptx:: Underlying character set considerations. -* Input processing in ptx:: Input fields, contexts, and keyword selection. -* Output formatting in ptx:: Types of output format, and sizing the fields. -* Compatibility in ptx:: The GNU extensions to `ptx' +* General options in ptx:: Options which affect general program behavior +* Charset selection in ptx:: Underlying character set considerations +* Input processing in ptx:: Input fields, contexts, and keyword selection +* Output formatting in ptx:: Types of output format, and sizing the fields +* Compatibility in ptx:: The GNU extensions to ‘ptx’ -Operating on fields within a line +Operating on fields -* cut invocation:: Print selected parts of lines. -* paste invocation:: Merge lines of files. -* join invocation:: Join lines on a common field. +* cut invocation:: Print selected parts of lines +* paste invocation:: Merge lines of files +* join invocation:: Join lines on a common field Operating on characters -* tr invocation:: Translate, squeeze, and/or delete characters. -* expand invocation:: Convert tabs to spaces. -* unexpand invocation:: Convert spaces to tabs. +* tr invocation:: Translate, squeeze, and/or delete characters +* expand invocation:: Convert tabs to spaces +* unexpand invocation:: Convert spaces to tabs -`tr': Translate, squeeze, and/or delete characters +‘tr’: Translate, squeeze, and/or delete characters -* Character sets:: Specifying sets of characters. -* Translating:: Changing one set of characters to another. -* Squeezing:: Squeezing repeats and deleting. +* Character sets:: Specifying sets of characters +* Translating:: Changing one set of characters to another +* Squeezing and deleting:: Removing characters Directory listing -* ls invocation:: List directory contents -* dir invocation:: Briefly list directory contents -* vdir invocation:: Verbosely list directory contents -* dircolors invocation:: Color setup for `ls' +* ls invocation:: List directory contents +* dir invocation:: Briefly list directory contents +* vdir invocation:: Verbosely list directory contents +* dircolors invocation:: Color setup for ‘ls’ -`ls': List directory contents +‘ls’: List directory contents -* Which files are listed:: Which files are listed -* What information is listed:: What information is listed -* Sorting the output:: Sorting the output -* More details about version sort:: More details about version sort -* General output formatting:: General output formatting -* Formatting the file names:: Formatting the file names +* Which files are listed:: Which files are listed +* What information is listed:: What information is listed +* Sorting the output:: Sorting the output +* Details about version sort:: More details about version sort +* General output formatting:: General output formatting +* Formatting the file names:: Formatting the file names Basic operations -* cp invocation:: Copy files and directories -* dd invocation:: Convert and copy a file -* install invocation:: Copy files and set attributes -* mv invocation:: Move (rename) files -* rm invocation:: Remove files or directories -* shred invocation:: Remove files more securely +* cp invocation:: Copy files and directories +* dd invocation:: Convert and copy a file +* install invocation:: Copy files and set attributes +* mv invocation:: Move (rename) files +* rm invocation:: Remove files or directories +* shred invocation:: Remove files more securely Special file types -* link invocation:: Make a hard link via the link syscall -* ln invocation:: Make links between files -* mkdir invocation:: Make directories -* mkfifo invocation:: Make FIFOs (named pipes) -* mknod invocation:: Make block or character special files -* readlink invocation:: Print the referent of a symbolic link -* rmdir invocation:: Remove empty directories -* unlink invocation:: Remove files via unlink syscall +* link invocation:: Make a hard link via the link syscall +* ln invocation:: Make links between files +* mkdir invocation:: Make directories +* mkfifo invocation:: Make FIFOs (named pipes) +* mknod invocation:: Make block or character special files +* readlink invocation:: Print value of a symlink or canonical file name +* rmdir invocation:: Remove empty directories +* unlink invocation:: Remove files via unlink syscall Changing file attributes -* chown invocation:: Change file owner and group -* chgrp invocation:: Change group ownership -* chmod invocation:: Change access permissions -* touch invocation:: Change file timestamps +* chown invocation:: Change file owner and group +* chgrp invocation:: Change group ownership +* chmod invocation:: Change access permissions +* touch invocation:: Change file timestamps Disk usage -* df invocation:: Report file system disk space usage -* du invocation:: Estimate file space usage -* stat invocation:: Report file or file system status -* sync invocation:: Synchronize data on disk with memory +* df invocation:: Report file system disk space usage +* du invocation:: Estimate file space usage +* stat invocation:: Report file or file system status +* sync invocation:: Synchronize cached writes to persistent storage +* truncate invocation:: Shrink or extend the size of a file Printing text -* echo invocation:: Print a line of text -* printf invocation:: Format and print data -* yes invocation:: Print a string until interrupted +* echo invocation:: Print a line of text +* printf invocation:: Format and print data +* yes invocation:: Print a string until interrupted Conditions -* false invocation:: Do nothing, unsuccessfully -* true invocation:: Do nothing, successfully -* test invocation:: Check file types and compare values -* expr invocation:: Evaluate expressions +* false invocation:: Do nothing, unsuccessfully +* true invocation:: Do nothing, successfully +* test invocation:: Check file types and compare values +* expr invocation:: Evaluate expressions -`test': Check file types and compare values +‘test’: Check file types and compare values -* File type tests:: File type tests -* Access permission tests:: Access permission tests -* File characteristic tests:: File characteristic tests -* String tests:: String tests -* Numeric tests:: Numeric tests +* File type tests:: File type tests +* Access permission tests:: Access permission tests +* File characteristic tests:: File characteristic tests +* String tests:: String tests +* Numeric tests:: Numeric tests -`expr': Evaluate expression +‘expr’: Evaluate expression -* String expressions:: + : match substr index length -* Numeric expressions:: + - * / % -* Relations for expr:: | & < <= = == != >= > -* Examples of expr:: Examples of using `expr' +* String expressions:: + : match substr index length +* Numeric expressions:: + - * / % +* Relations for expr:: | & < <= = == != >= > +* Examples of expr:: Examples of using ‘expr’ Redirection -* tee invocation:: Redirect output to multiple files +* tee invocation:: Redirect output to multiple files or processes File name manipulation * basename invocation:: Strip directory and suffix from a file name -* dirname invocation:: Strip non-directory suffix from a file name -* pathchk invocation:: Check file name portability +* dirname invocation:: Strip last file name component +* pathchk invocation:: Check file name validity and portability +* mktemp invocation:: Create temporary file or directory +* realpath invocation:: Print resolved file names Working context @@ -343,15 +359,15 @@ Working context * printenv invocation:: Print all or some environment variables * tty invocation:: Print file name of terminal on standard input -`stty': Print or change terminal characteristics +‘stty’: Print or change terminal characteristics -* Control:: Control settings -* Input:: Input settings -* Output:: Output settings -* Local:: Local settings -* Combination:: Combination settings -* Characters:: Special characters -* Special:: Special settings +* Control:: Control settings +* Input:: Input settings +* Output:: Output settings +* Local:: Local settings +* Combination:: Combination settings +* Characters:: Special characters +* Special:: Special settings User information @@ -364,20 +380,29 @@ User information System context +* arch invocation:: Print machine hardware name * date invocation:: Print or set system date and time +* nproc invocation:: Print the number of processors * uname invocation:: Print system information * hostname invocation:: Print or set system name -* hostid invocation:: Print numeric host identifier. +* hostid invocation:: Print numeric host identifier +* uptime invocation:: Print system uptime and load -`date': Print or set system date and time +‘date’: Print or set system date and time * Time conversion specifiers:: %[HIklMNpPrRsSTXzZ] * Date conversion specifiers:: %[aAbBcCdDeFgGhjmuUVwWxyY] * Literal conversion specifiers:: %[%nt] * Padding and other flags:: Pad with zeros, spaces, etc. -* Setting the time:: Changing the system clock. -* Options for date:: Instead of the current time. -* Examples of date:: Examples. +* Setting the time:: Changing the system clock +* Options for date:: Instead of the current time +* Date input formats:: Specifying date strings +* Examples of date:: Examples + +SELinux context + +* chcon invocation:: Change SELinux context of file +* runcon invocation:: Run a command in specified SELinux context Modified command invocation @@ -385,7 +410,8 @@ Modified command invocation * env invocation:: Run a command in a modified environment * nice invocation:: Run a command with modified niceness * nohup invocation:: Run a command immune to hangups -* su invocation:: Run a command with substitute user and group ID +* stdbuf invocation:: Run a command with modified I/O buffering +* timeout invocation:: Run a command with a time limit Process control @@ -398,41 +424,44 @@ Delaying Numeric operations * factor invocation:: Print prime factors +* numfmt invocation:: Reformat numbers * seq invocation:: Print numeric sequences File permissions -* Mode Structure:: Structure of file mode bits. -* Symbolic Modes:: Mnemonic representation of file mode bits. -* Numeric Modes:: File mode bits as octal numbers. -* Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories. +* Mode Structure:: Structure of file mode bits +* Symbolic Modes:: Mnemonic representation of file mode bits +* Numeric Modes:: File mode bits as octal numbers +* Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories Date input formats -* General date syntax:: Common rules. -* Calendar date items:: 19 Dec 1994. -* Time of day items:: 9:20pm. -* Time zone items:: EST, PDT, GMT. -* Day of week items:: Monday and others. -* Relative items in date strings:: next tuesday, 2 years ago. -* Pure numbers in date strings:: 19931219, 1440. -* Seconds since the Epoch:: @1078100502. -* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0". -* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al. +* General date syntax:: Common rules +* Calendar date items:: 19 Dec 1994 +* Time of day items:: 9:20pm +* Time zone items:: EST, PDT, UTC, … +* Combined date and time of day items:: 1972-09-24T20:02:00,000000-0500 +* Day of week items:: Monday and others +* Relative items in date strings:: next tuesday, 2 years ago +* Pure numbers in date strings:: 19931219, 1440 +* Seconds since the Epoch:: @1078100502 +* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0" +* Authors of parse_datetime:: Bellovin, Eggert, Salz, Berets, et al. Opening the software toolbox * Toolbox introduction:: Toolbox introduction * I/O redirection:: I/O redirection -* The who command:: The `who' command -* The cut command:: The `cut' command -* The sort command:: The `sort' command -* The uniq command:: The `uniq' command +* The who command:: The ‘who’ command +* The cut command:: The ‘cut’ command +* The sort command:: The ‘sort’ command +* The uniq command:: The ‘uniq’ command * Putting the tools together:: Putting the tools together Copying This Manual -* GNU Free Documentation License:: License for copying this manual. +* GNU Free Documentation License:: Copying and sharing this manual + File: coreutils.info, Node: Introduction, Next: Common options, Prev: Top, Up: Top @@ -446,18 +475,28 @@ 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 <bug-coreutils@gnu.org>. -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. +POSIX standard. + + Please report bugs to <bug-coreutils@gnu.org>. 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. + + If you have a problem with ‘sort’, try running ‘sort --debug’, as it +can can often help find and fix problems without having to wait for an +answer to a bug report. If the debug output does not suffice to fix the +problem on your own, please compress and attach it to the rest of your +bug report. + + Although diffs are welcome, please include a description of the +problem as well, since this is sometimes difficult to infer. *Note +(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 +original ‘fmt’ man page was written by Ross Paterson. Franç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 @@ -478,54 +517,63 @@ 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 +‘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 `-'. + 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 +‘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. - Some of these programs recognize the `--help' and `--version' -options only when one of them is the sole command line argument. + 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. -`--help' + 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' +‘--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'. - + 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. + A single ‘-’ operand is not really an option, though it looks like +one. It stands for a file operand, and some tools treat it as standard +input, or as standard output if that is clear from the context. For +example, ‘sort -’ reads from standard input, and is equivalent to plain +‘sort’. Unless otherwise specified, a ‘-’ can appear as any operand +that requires a file name. * Menu: * Exit status:: Indicating program success or failure. * Backup options:: -b -S, in some programs. -* Block size:: BLOCK_SIZE and --block-size, in some programs. -* Disambiguating names and IDs:: chgrp and chown owner and group syntax -* Random sources:: --random-source, in some programs. +* Block size:: BLOCK_SIZE and –block-size, in some programs. +* Floating point:: Floating point number representation. +* Signal specifications:: Specifying signals using the –signal option. +* Disambiguating names and IDs:: chgrp, chown, chroot, id: user and group syntax +* Random sources:: –random-source, in some programs. * Target directory:: Specifying a target directory, in some programs. -* Trailing slashes:: --strip-trailing-slashes, in some programs. +* Trailing slashes:: –strip-trailing-slashes, in some programs. * Traversing symlinks:: -H, -L, or -P, in some programs. -* Treating / specially:: --preserve-root and --no-preserve-root. -* Special built-in utilities:: `break', `:', `eval', ... +* Treating / specially:: –preserve-root and –no-preserve-root. +* Special built-in utilities:: ‘break’, ‘:’, … * Standards conformance:: Conformance to the POSIX standard. +* Multi-call invocation:: Multi-call program invocation. File: coreutils.info, Node: Exit status, Next: Backup options, Up: Common options @@ -533,16 +581,17 @@ File: coreutils.info, Node: Exit status, Next: Backup options, Up: Common opt 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 +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', `printenv', `sort', `su', `test', `tty'. +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’. File: coreutils.info, Node: Backup options, Next: Block size, Prev: Exit status, Up: Common options @@ -550,232 +599,326 @@ File: coreutils.info, Node: Backup options, Next: Block size, Prev: Exit stat 2.2 Backup options ================== -Some GNU programs (at least `cp', `install', `ln', and `mv') optionally +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]' +‘-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'. + ‘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'. + 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'; + 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' + ‘none’ + ‘off’ Never make backups. - `numbered' - `t' + ‘numbered’ + ‘t’ Always make numbered backups. - `existing' - `nil' + ‘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. + ‘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. -File: coreutils.info, Node: Block size, Next: Disambiguating names and IDs, Prev: Backup options, Up: Common options +File: coreutils.info, Node: Block size, Next: Floating point, Prev: Backup options, Up: Common options 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. +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'. +‘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' +‘BLOCK_SIZE’ This specifies the default block size for all three commands, if the above command-specific environment variables are not set. -`BLOCKSIZE' +‘BLOCKSIZE’ This specifies the default block size for all values that are - normally printed as blocks, if neither `BLOCK_SIZE' nor the above + 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 + environment variables, ‘BLOCKSIZE’ does not affect values that are normally printed as byte counts, e.g., the file sizes contained in - `ls -l' output. + ‘ls -l’ output. -`POSIXLY_CORRECT' - If neither `COMMAND_BLOCK_SIZE', nor `BLOCK_SIZE', nor `BLOCKSIZE' +‘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. +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 +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.fr/enus/3_SI/si-prefixes.html) for decimal multiples -and with the IEC 60027-2 prefixes for binary multiples -(http://physics.nist.gov/cuu/Units/binary.html). +(http://www.bipm.org/en/publications/si-brochure/chapter3.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 +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 + 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. +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', +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'. +‘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'. + 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 + The following suffixes are defined. Large sizes like ‘1Y’ may be rejected by your computer due to limitations of its arithmetic. -`kB' +‘kB’ kilobyte: 10^3 = 1000. - -`k' -`K' -`KiB' - kibibyte: 2^10 = 1024. `K' is special: the SI prefix is `k' and - the IEC 60027-2 prefix is `Ki', but tradition and POSIX use `k' to - mean `KiB'. - -`MB' +‘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' +‘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. -`G' -`GiB' - gibibyte: 2^30 = 1,073,741,824. - -`TB' - terabyte: 10^12 = 1,000,000,000,000. + 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’. Note for ‘ls’ the ‘-k’ option does not +control the display of the apparent file sizes, whereas the +‘--block-size’ option does. -`T' -`TiB' - tebibyte: 2^40 = 1,099,511,627,776. + +File: coreutils.info, Node: Floating point, Next: Signal specifications, Prev: Block size, Up: Common options -`PB' - petabyte: 10^15 = 1,000,000,000,000,000. +2.4 Floating point numbers +========================== -`P' -`PiB' - pebibyte: 2^50 = 1,125,899,906,842,624. +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’. +Commands that parse floating point also understand case-insensitive +‘inf’, ‘infinity’, and ‘NaN’, although whether such values are useful +depends on the command in question. 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 (libc)Parsing of +Floats::. -`EB' - exabyte: 10^18 = 1,000,000,000,000,000,000. + +File: coreutils.info, Node: Signal specifications, Next: Disambiguating names and IDs, Prev: Floating point, Up: Common options -`E' -`EiB' - exbibyte: 2^60 = 1,152,921,504,606,846,976. +2.5 Signal specifications +========================= -`ZB' - zettabyte: 10^21 = 1,000,000,000,000,000,000,000 +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: -`Z' -`ZiB' - 2^70 = 1,180,591,620,717,411,303,424. (`Zi' is a GNU extension to - IEC 60027-2.) +‘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. -`YB' - yottabyte: 10^24 = 1,000,000,000,000,000,000,000,000. +Other supported signal names have system-dependent corresponding +numbers. All systems conforming to POSIX 1003.1-2001 also support the +following signals: -`Y' -`YiB' - 2^80 = 1,208,925,819,614,629,174,706,176. (`Yi' is a GNU - extension to IEC 60027-2.) +‘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. - 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'. +POSIX 1003.1-2001 systems that support the XSI extension also support +the following signals: - -File: coreutils.info, Node: Disambiguating names and IDs, Next: Random sources, Prev: Block size, Up: Common options +‘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. -2.4 chown and chgrp: Disambiguating user names and IDs -====================================================== +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’. -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: + +File: coreutils.info, Node: Disambiguating names and IDs, Next: Random sources, Prev: Signal specifications, Up: Common options + +2.6 chown, chgrp, chroot, id: Disambiguating user names and IDs +=============================================================== + +Since the USER and GROUP arguments to these commands 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 these commands 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’, ‘chgrp’, ‘chroot’, and ‘id’ 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. + The name look-up process is skipped 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 ---------- @@ -784,99 +927,106 @@ systems, but not on Solaris 10. File: coreutils.info, Node: Random sources, Next: Target directory, Prev: Disambiguating names and IDs, Up: Common options -2.5 Sources of random data +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 +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. - Normally these commands use the device file `/dev/urandom' as the + By default these commands use an internal pseudo-random 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. - - `/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. +cryptographically secure pseudo-random number generator. But be aware +that this device is not designed for bulk random data generation and is +relatively slow. - To use such a source, specify the `--random-source=FILE' option, -e.g., `shuf --random-source=/dev/random'. The contents of FILE should -be as random as possible. An error is reported if FILE does not -contain enough bytes to randomize the input adequately. + ‘/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. +random source in earlier and later invocations of the command. Rather +than depending on a file, one can generate a reproducible arbitrary +amount of pseudo-random data given a seed value, using for example: - Some old-fashioned or stripped-down operating systems lack support -for `/dev/urandom'. On these systems commands like `shuf' by default -fall back on an internal pseudorandom generator initialized by a small -amount of entropy. + get_seeded_random() + { + seed="$1" + openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt \ + </dev/zero 2>/dev/null + } + + shuf -i1-100 --random-source=<(get_seeded_random 42) File: coreutils.info, Node: Target directory, Next: Trailing slashes, Prev: Random sources, Up: Common options -2.6 Target directory +2.8 Target directory ==================== -The `cp', `install', `ln', and `mv' commands normally treat the last +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 +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' +‘-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'. + 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. + the ‘--target-directory’ (‘-t’) option. -`-t DIRECTORY' -`--target-directory=DIRECTORY' +‘-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 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 + 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 + 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: + 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 + 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 \ @@ -884,32 +1034,31 @@ to allow more fine-grained control: 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': + 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') +The ‘--target-directory’ (‘-t’) and ‘--no-target-directory’ (‘-T’) options cannot be combined. File: coreutils.info, Node: Trailing slashes, Next: Traversing symlinks, Prev: Target directory, Up: Common options -2.7 Trailing slashes +2.9 Trailing slashes ==================== -Some GNU programs (at least `cp' and `mv') allow you to remove any +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. +‘--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 +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 @@ -919,73 +1068,72 @@ of that standard. File: coreutils.info, Node: Traversing symlinks, Next: Treating / specially, Prev: Trailing slashes, Up: Common options -2.8 Traversing symlinks -======================= +2.10 Traversing symlinks +======================== -The following options modify how `chown' and `chgrp' traverse a -hierarchy when the `--recursive' (`-R') option is also specified. If +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 + 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. +‘-H’ + If ‘--recursive’ (‘-R’) is specified and a command line argument is + a symbolic link to a directory, traverse it. -`-L' +‘-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. - +‘-P’ + Do not traverse any symbolic links. This is the default if none of + ‘-H’, ‘-L’, or ‘-P’ is specified. File: coreutils.info, Node: Treating / specially, Next: Special built-in utilities, Prev: Traversing symlinks, Up: Common options -2.9 Treating / specially -======================== +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 +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-option', is safer for most purposes. +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 + 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 +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. +‘--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 -`/'. + Note that the ‘--preserve-root’ option also ensures that ‘chgrp’ and +‘chown’ do not modify ‘/’ even when dereferencing a symlink pointing to +‘/’. File: coreutils.info, Node: Special built-in utilities, Next: Standards conformance, Prev: Treating / specially, Up: Common options -2.10 Special built-in utilities +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 +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. @@ -995,44 +1143,59 @@ 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 + 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 +special built-in utilities like ‘history’, and ‘suspend’, and with Bash +the command ‘nice suspend’ generates an error message instead of suspending. -File: coreutils.info, Node: Standards conformance, Prev: Special built-in utilities, Up: Common options +File: coreutils.info, Node: Standards conformance, Next: Multi-call invocation, Prev: Special built-in utilities, Up: Common options -2.11 Standards conformance +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'. +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 +‘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. +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. Two values are currently supported for `_POSIX2_VERSION': -`199209' stands for POSIX 1003.2-1992, and `200112' stands for POSIX -1003.1-2001. 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. +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. + + +File: coreutils.info, Node: Multi-call invocation, Prev: Standards conformance, Up: Common options + +2.14 ‘coreutils’: Multi-call program +==================================== + +The ‘coreutils’ command invokes an individual utility, either implicitly +selected by the last component of the name used to invoke ‘coreutils’, +or explicitly with the ‘--coreutils-prog’ option. Synopsis: + + coreutils --coreutils-prog=PROGRAM … + + The ‘coreutils’ command is not installed by default, so portable +scripts should not rely on its existence. File: coreutils.info, Node: Output of entire files, Next: Formatting file contents, Prev: Common options, Up: Top @@ -1049,67 +1212,69 @@ in some way. * tac invocation:: Concatenate and write files in reverse. * nl invocation:: Number lines and write files. * od invocation:: Write files in octal or other formats. +* base32 invocation:: Transform data into printable data. * base64 invocation:: Transform data into printable data. File: coreutils.info, Node: cat invocation, Next: tac invocation, Up: Output of entire files -3.1 `cat': Concatenate and write files +3.1 ‘cat’: Concatenate and write files ====================================== -`cat' copies each FILE (`-' means standard input), or standard input if +‘cat’ copies each FILE (‘-’ means standard input), or standard input if none are given, to standard output. Synopsis: - cat [OPTION] [FILE]... + cat [OPTION] [FILE]… - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-A' -`--show-all' - Equivalent to `-vET'. +‘-A’ +‘--show-all’ + Equivalent to ‘-vET’. -`-b' -`--number-nonblank' - Number all nonblank output lines, starting with 1. +‘-b’ +‘--number-nonblank’ + Number all nonempty output lines, starting with 1. -`-e' - Equivalent to `-vE'. +‘-e’ + Equivalent to ‘-vE’. -`-E' -`--show-ends' - Display a `$' after the end of each line. +‘-E’ +‘--show-ends’ + Display a ‘$’ after the end of each line. -`-n' -`--number' - Number all output lines, starting with 1. +‘-n’ +‘--number’ + Number all output lines, starting with 1. This option is ignored + if ‘-b’ is in effect. -`-s' -`--squeeze-blank' - Replace multiple adjacent blank lines with a single blank line. +‘-s’ +‘--squeeze-blank’ + Suppress repeated adjacent blank lines; output just one empty line + instead of several. -`-t' - Equivalent to `-vT'. +‘-t’ + Equivalent to ‘-vT’. -`-T' -`--show-tabs' - Display TAB characters as `^I'. +‘-T’ +‘--show-tabs’ + Display TAB characters as ‘^I’. -`-u' +‘-u’ Ignored; for POSIX compatibility. -`-v' -`--show-nonprinting' - Display control characters except for LFD and TAB using `^' +‘-v’ +‘--show-nonprinting’ + Display control characters except for LFD and TAB using ‘^’ notation and precede characters that have the high bit set with - `M-'. - + ‘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' +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 +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 @@ -1126,56 +1291,62 @@ indicates failure. File: coreutils.info, Node: tac invocation, Next: nl invocation, Prev: cat invocation, Up: Output of entire files -3.2 `tac': Concatenate and write files in reverse +3.2 ‘tac’: Concatenate and write files in reverse ================================================= -`tac' copies each FILE (`-' means standard input), or standard input if +‘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]... + tac [OPTION]… [FILE]… - "Records" are separated by instances of a string (newline by + “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 + The program accepts the following options. Also see *note Common options::. -`-b' -`--before' +‘-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. Users of `tac' - on MS-DOS/MS-Windows should note that, since `tac' reads files in - binary mode, each line of a text file might end with a CR/LF pair - instead of the Unix-style LF. +‘-r’ +‘--regex’ + Treat the separator string as a regular expression. -`-s SEPARATOR' -`--separator=SEPARATOR' - Use SEPARATOR as the record separator, instead of newline. +‘-s SEPARATOR’ +‘--separator=SEPARATOR’ + Use SEPARATOR as the record separator, instead of newline. Note an + empty SEPARATOR is treated as a zero byte. I.e., input and output + items are delimited with ASCII NUL. + 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]' + File: coreutils.info, Node: nl invocation, Next: od invocation, Prev: tac invocation, Up: Output of entire files -3.3 `nl': Number lines and write files +3.3 ‘nl’: Number lines and write files ====================================== -`nl' writes each FILE (`-' means standard input), or standard input if +‘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 [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 + ‘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. @@ -1186,308 +1357,302 @@ 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 +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 +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 + The program accepts the following options. Also see *note Common options::. -`-b STYLE' -`--body-numbering=STYLE' +‘-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' + ‘a’ number all lines, - - `t' + ‘t’ number only nonempty lines (default for body), - - `n' + ‘n’ do not number lines (default for header and footer), - - `pBRE' + ‘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 `\' +‘-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'. +‘-f STYLE’ +‘--footer-numbering=STYLE’ + Analogous to ‘--body-numbering’. -`-h STYLE' -`--header-numbering=STYLE' - Analogous to `--body-numbering'. +‘-h STYLE’ +‘--header-numbering=STYLE’ + Analogous to ‘--body-numbering’. -`-i NUMBER' -`--page-increment=NUMBER' +‘-i NUMBER’ +‘--line-increment=NUMBER’ Increment line numbers by NUMBER (default 1). -`-l NUMBER' -`--join-blank-lines=NUMBER' +‘-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'): +‘-n FORMAT’ +‘--number-format=FORMAT’ + Select the line numbering format (default is ‘rn’): - `ln' + ‘ln’ left justified, no leading zeros; - - `rn' + ‘rn’ right justified, no leading zeros; - - `rz' + ‘rz’ right justified, leading zeros. -`-p' -`--no-renumber' +‘-p’ +‘--no-renumber’ Do not reset the line number at the start of a logical page. -`-s STRING' -`--number-separator=STRING' +‘-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). +‘-v NUMBER’ +‘--starting-line-number=NUMBER’ + Set the initial line number on each logical page to NUMBER (default + 1). -`-w NUMBER' -`--number-width=NUMBER' +‘-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. -File: coreutils.info, Node: od invocation, Next: base64 invocation, Prev: nl invocation, Up: Output of entire files +File: coreutils.info, Node: od invocation, Next: base32 invocation, Prev: nl invocation, Up: Output of entire files -3.4 `od': Write files in octal or other formats +3.4 ‘od’: Write files in octal or other formats =============================================== -`od' writes an unambiguous representation of each FILE (`-' means +‘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]]] + 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 +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 +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. +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 + The program accepts the following options. Also see *note Common options::. -`-A RADIX' -`--address-radix=RADIX' +‘-A RADIX’ +‘--address-radix=RADIX’ Select the base in which file offsets are printed. RADIX can be one of the following: - `d' + ‘d’ decimal; - - `o' + ‘o’ octal; - - `x' + ‘x’ hexadecimal; - - `n' + ‘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. - Appending `b' multiplies BYTES by 512, `k' by 1024, and `m' by - 1048576. +‘--endian=ORDER’ + Reorder input bytes, to handle inputs with differing byte orders, + or to provide consistent output independent of the endian + convention of the current system. Swapping is performed according + to the specified ‘--type’ size and endian ORDER, which can be + ‘little’ or ‘big’. -`-N BYTES' -`--read-bytes=BYTES' +‘-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. + ‘bytes’ are interpreted as for the ‘-j’ option. -`-S N' -`--strings[=N]' - Instead of the normal output, output only "string constants": at - least N consecutive ASCII graphic characters, followed by a null - (zero) byte. +‘-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 N is omitted with `--strings', the default is 3. + If BYTES is omitted with ‘--strings’, the default is 3. -`-t TYPE' -`--format=TYPE' +‘-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 + 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. + Adding a trailing “z” to any type specification appends a display + of the single byte character representation of the printable + characters to the output line generated by the type specification. - `a' + ‘a’ named character, ignoring high-order bit - - `c' - ASCII character or backslash escape, - - `d' + ‘c’ + printable single byte character, C backslash escape or a 3 + digit octal sequence + ‘d’ signed decimal - - `f' - floating point - - `o' + ‘f’ + floating point (*note Floating point::) + ‘o’ octal - - `u' + ‘u’ unsigned decimal - - `x' + ‘x’ hexadecimal - The type `a' outputs things like `sp' for space, `nl' for newline, - and `nul' for a null (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. + 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 + 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 + 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'): + one of the following characters. For integers (‘d’, ‘o’, ‘u’, + ‘x’): - `C' + ‘C’ char - - `S' + ‘S’ short - - `I' + ‘I’ int - - `L' + ‘L’ long - For floating point (`f'): + For floating point (‘f’): - F + F float - - D + D double - - L + L long double -`-v' -`--output-duplicates' +‘-v’ +‘--output-duplicates’ Output consecutive lines that are identical. By default, when two - or more consecutive output lines would be identical, `od' outputs + 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 +‘-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 +GNU ‘od’ accepts any combination of shorthands and format specification options. These options accumulate. -`-a' - Output as named characters. Equivalent to `-t a'. +‘-a’ + Output as named characters. Equivalent to ‘-t a’. -`-b' - Output as octal bytes. Equivalent to `-t o1'. +‘-b’ + Output as octal bytes. Equivalent to ‘-t o1’. -`-c' - Output as ASCII characters or backslash escapes. Equivalent to - `-t c'. +‘-c’ + Output as printable single byte characters, C backslash escapes or + 3 digit octal sequences. Equivalent to ‘-t c’. -`-d' - Output as unsigned decimal two-byte units. Equivalent to `-t u2'. +‘-d’ + Output as unsigned decimal two-byte units. Equivalent to ‘-t u2’. -`-f' - Output as floats. Equivalent to `-t fF'. +‘-f’ + Output as floats. Equivalent to ‘-t fF’. -`-i' - Output as decimal ints. Equivalent to `-t dI'. +‘-i’ + Output as decimal ints. Equivalent to ‘-t dI’. -`-l' - Output as decimal long ints. Equivalent to `-t dL'. +‘-l’ + Output as decimal long ints. Equivalent to ‘-t dL’. -`-o' - Output as octal two-byte units. Equivalent to `-t o2'. +‘-o’ + Output as octal two-byte units. Equivalent to ‘-t o2’. -`-s' - Output as decimal two-byte units. Equivalent to `-t d2'. +‘-s’ + Output as decimal two-byte units. Equivalent to ‘-t d2’. -`-x' - Output as hexadecimal two-byte units. Equivalent to `-t x2'. +‘-x’ + Output as hexadecimal two-byte units. Equivalent to ‘-t x2’. -`--traditional' - Recognize the non-option label argument that traditional `od' +‘--traditional’ + Recognize the non-option label argument that traditional ‘od’ accepted. The following syntax: od --traditional [FILE] [[+]OFFSET[.][b] [[+]LABEL[.][b]]] @@ -1498,49 +1663,61 @@ options. These options accumulate. 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. -File: coreutils.info, Node: base64 invocation, Prev: od invocation, Up: Output of entire files +File: coreutils.info, Node: base32 invocation, Next: base64 invocation, Prev: od invocation, Up: Output of entire files -3.5 `base64': Transform data into printable data. -================================================= +3.5 ‘base32’: 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, see RFC 3548 -(ftp://ftp.rfc-editor.org/in-notes/rfc3548.txt). Synopses: +‘base32’ transforms data read from a file, or standard input, into (or +from) base32 encoded form. The base32 encoded form uses printable ASCII +characters to represent binary data. The usage and options of this +command are precisely the same as for ‘base64’. *Note base64 +invocation::. - base64 [OPTION]... [FILE] - base64 --decode [OPTION]... [FILE] + +File: coreutils.info, Node: base64 invocation, Prev: base32 invocation, Up: Output of entire files + +3.6 ‘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 base32 encoding expands data to roughly 160% 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 + The program accepts the following options. Also see *note Common options::. -`-w COLS' -`--wrap=COLS' +‘-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' +‘-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' +‘-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. @@ -1561,15 +1738,15 @@ These commands reformat the contents of files. File: coreutils.info, Node: fmt invocation, Next: pr invocation, Up: Formatting file contents -4.1 `fmt': Reformat paragraph text +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’ fills and joins lines to produce output lines of (at most) a given +number of characters (75 by default). Synopsis: - fmt [OPTION]... [FILE]... + fmt [OPTION]… [FILE]… - `fmt' reads from the specified FILE arguments (or standard input if + ‘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 @@ -1577,336 +1754,315 @@ 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 + ‘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 +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 +‘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. +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 + The program accepts the following options. Also see *note Common options::. -`-c' -`--crown-margin' - "Crown margin" mode: preserve the indentation of the first two +‘-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 +‘-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' +‘-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. + This prevents sample lines of code, and other such “formatted” text + from being unduly combined. -`-u' -`--uniform-spacing' +‘-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). `fmt' - initially tries to make lines about 7% shorter than this, to give - it room to balance line lengths. +‘-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' +‘-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 + 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. File: coreutils.info, Node: pr invocation, Next: fold invocation, Prev: fmt invocation, Up: Formatting file contents -4.2 `pr': Paginate or columnate files for printing +4.2 ‘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’ 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]... + 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. With the -`-F' option, a 3-line header is printed: the leading two blank lines are -omitted; no footer is used. The default PAGE_LENGTH in both cases is 66 -lines. The default number of text lines changes from 56 (without `-F') -to 63 (with `-F'). 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. +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 +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 following changes were made in version 1.22i and apply to later -versions of `pr': - Brian - * Some small LETTER OPTIONS (`-s', `-w') have been redefined for - better POSIX compliance. The output of some further cases has - been adapted to other Unix systems. These changes are not - compatible with earlier versions of the program. - - * Some NEW CAPITAL LETTER options (`-J', `-S', `-W') have been - introduced to turn off unexpected interferences of small letter - options. The `-N' option and the second argument LAST_PAGE of - `+FIRST_PAGE' offer more flexibility. The detailed handling of - form feeds set in the input files requires the `-T' option. - - * Capital letter options override small letter ones. - - * Some of the option-arguments (compare `-s', `-e', `-i', `-n') - cannot be specified as separate arguments from the preceding - option letter (already stated in the POSIX specification). - - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`+FIRST_PAGE[:LAST_PAGE]' -`--pages=FIRST_PAGE[:LAST_PAGE]' +‘+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 + 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' + 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 + ‘-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 +‘-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' +‘-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"'. - - Normally the date format defaults to `%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'. +‘-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': + 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]]' +‘-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 + 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. The - default page length of 66 lines is not altered. But the number of - lines of text per page changes from default 56 to 63 lines. +‘-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' +‘-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. + be separated from ‘-h’ by a space. -`-i[OUT-TABCHAR[OUT-TABWIDTH]]' -`--output-tabs[=OUT-TABCHAR[OUT-TABWIDTH]]' +‘-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). + 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' +‘-J’ +‘--join-lines’ Merge lines of full length. Used together with the column options - `-COLUMN', `-a -COLUMN' or `-m'. Turns off `-W/-w' line + ‘-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. + ‘--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' +‘-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 (or <= 3 with `-F'), the header and footer are - omitted, and all form feeds set in input files are eliminated, as - if the `-T' option had been given. + than or equal to 10, the header and footer are omitted, as if the + ‘-t’ option had been given. -`-m' -`--merge' +‘-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 + ‘-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 + 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]]' +‘-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 + 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' + 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' +‘-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). + 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' +‘-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]' +‘-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]' + 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 + (‘-COLUMN’|‘-a -COLUMN’|‘-m’) unless ‘-w’ is set. This is a POSIX-compliant formulation. -`-SSTRING' -`--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" "'). - `--sep-string' with no `=STRING' is equivalent to - `--sep-string=""'. - -`-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' +‘-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' +‘-v’ +‘--show-nonprinting’ Print nonprinting characters in octal backslash notation. -`-w PAGE_WIDTH' -`--width=PAGE_WIDTH' +‘-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. - + output only (default for PAGE_WIDTH is 72). The specified + PAGE_WIDTH is rounded down so that columns have equal width. + ‘-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, honored with and + without a column option. With a column option, the specified + PAGE_WIDTH is rounded down so that columns have equal width. 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 + disable 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. @@ -1914,43 +2070,42 @@ indicates failure. File: coreutils.info, Node: fold invocation, Prev: pr invocation, Up: Formatting file contents -4.3 `fold': Wrap input lines to fit in specified width +4.3 ‘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’ writes each FILE (‘-’ means standard input), or standard input if +none are given, to standard output, breaking long lines. Synopsis: - fold [OPTION]... [FILE]... + fold [OPTION]… [FILE]… - By default, `fold' breaks lines wider than 80 columns. The output -is split into as many lines as necessary. + 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 + ‘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 + The program accepts the following options. Also see *note Common options::. -`-b' -`--bytes' +‘-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' +‘-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' +‘-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. - + 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. @@ -1967,60 +2122,78 @@ These commands output pieces of the input. * head invocation:: Output the first part of files. * tail invocation:: Output the last part of files. -* split invocation:: Split a file into fixed-size pieces. +* split invocation:: Split a file into pieces. * csplit invocation:: Split a file into context-determined pieces. File: coreutils.info, Node: head invocation, Next: tail invocation, Up: Output of parts of files -5.1 `head': Output the first part of files +5.1 ‘head’: Output the first part of files ========================================== -`head' prints the first part (10 lines by default) of each FILE; it +‘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: +‘-’. Synopsis: - head [OPTION]... [FILE]... + head [OPTION]… [FILE]… - If more than one FILE is specified, `head' prints a one-line header + 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 + The program accepts the following options. Also see *note Common options::. -`-c N' -`--bytes=N' - Print the first N bytes, instead of initial lines. Appending `b' - multiplies N by 512, `k' by 1024, and `m' by 1048576. However, if - N starts with a `-', print all but the last N bytes of each file. - -`-n N' -`--lines=N' - Output the first N lines. However, if N starts with a `-', print - all but the last N lines of each file. - -`-q' -`--quiet' -`--silent' +‘-c [-]NUM’ +‘--bytes=[-]NUM’ + Print the first NUM bytes, instead of initial lines. However, if + NUM is prefixed with a ‘-’, print all but the last NUM bytes of + each file. NUM 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 [-]NUM’ +‘--lines=[-]NUM’ + Output the first NUM lines. However, if NUM is prefixed with a + ‘-’, print all but the last NUM 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' +‘-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'. +‘-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). + + For compatibility ‘head’ also supports an obsolete option syntax +‘-[NUM][bkm][cqv]’, which is recognized only if it is specified first. +NUM 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 NUM’ or ‘-n +NUM’ 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. @@ -2028,173 +2201,224 @@ indicates failure. File: coreutils.info, Node: tail invocation, Next: split invocation, Prev: head invocation, Up: Output of parts of files -5.2 `tail': Output the last part of files +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’ 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]... + tail [OPTION]… [FILE]… - If more than one FILE is specified, `tail' prints a one-line header -consisting of: + If more than one FILE is specified, ‘tail’ prints a one-line header +before the output for each FILE, consisting of: ==> FILE NAME <== -before the output for each FILE. + For further processing of tail output, it can be useful to convert +the file headers to line prefixes, which can be done like: + + tail … | + awk ' + /^==> .* <==$/ {prefix=substr($0,5,length-8)":"; next} + {print prefix$0} + ' | … - GNU `tail' can output any amount of data (some other versions of -`tail' cannot). It also has no `-r' option (print in reverse), since + 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 +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' +more reliable and versatile way to reverse files is the GNU ‘tac’ command. - If any option-argument is a number N starting with a `+', `tail' -begins printing with the Nth item from the start of each file, instead -of from the end. - - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-c BYTES' -`--bytes=BYTES' - Output the last BYTES bytes, instead of final lines. Appending - `b' multiplies BYTES by 512, `k' by 1024, and `m' by 1048576. - -`-f' -`--follow[=HOW]' +‘-c [+]NUM’ +‘--bytes=[+]NUM’ + Output the last NUM bytes, instead of final lines. However, if NUM + is prefixed with a ‘+’, start printing with byte NUM from the start + of each file, instead of from the end. NUM 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 + 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 by reopening it - periodically to see if it has been removed and recreated by some - other program. + 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 + 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'. - - If `POSIXLY_CORRECT' is set, the `-f' option is ignored if no FILE - operand is specified and standard input is a FIFO or a pipe. - -`-F' - This option is the same as `--follow=name --retry'. That is, tail + 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 (using a period - before any fractional digits). - -`--pid=PID' +‘--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 [+]NUM’ +‘--lines=[+]’ + Output the last NUM lines. However, if NUM is prefixed with a ‘+’, + start printing with line NUM from the start of each file, instead + of from the end. Size multiplier suffixes are the same as with the + ‘-c’ option. + +‘--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 + ‘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. + 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 + 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 following by name. - -`-n N' -`--lines=N' - Output the last N lines. - -`-q' -`--quiet' -`--silent' + that ‘--pid’ cannot be supported on some systems; ‘tail’ will print + a warning if this is the case. + +‘-q’ +‘--quiet’ +‘--silent’ Never print file name headers. -`-v' -`--verbose' - Always print file name headers. +‘--retry’ + Indefinitely try to open the specified file. This option is useful + mainly when following (and otherwise issues a warning). + When following by file descriptor (i.e., with + ‘--follow=descriptor’), this option only affects the initial open + of the file, as after a successful open, ‘tail’ will start + following the file descriptor. - 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'. + When following by name (i.e., with ‘--follow=name’), ‘tail’ + infinitely retries to re-open the given files until killed. + + 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. + +‘-s NUMBER’ +‘--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. + +‘-v’ +‘--verbose’ + Always print file name headers. - On older systems, the leading `-' can be replaced by `+' in the +‘-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). + + For compatibility ‘tail’ also supports an obsolete usage ‘tail +-[NUM][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, NUM 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' +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 and should use ‘-c NUM[b]’, ‘-n NUM’, 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 >/dev/null 2>&1; -then ...' to decide which syntax to use. +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 >/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'. +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. @@ -2202,74 +2426,224 @@ indicates failure. File: coreutils.info, Node: split invocation, Next: csplit invocation, Prev: tail invocation, Up: Output of parts of files -5.3 `split': Split a file into fixed-size pieces -================================================ +5.3 ‘split’: Split a file into pieces. +====================================== -`split' creates output files containing consecutive sections of INPUT -(standard input if none is given or INPUT is `-'). Synopsis: +‘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 + 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 + 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. If 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 +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::. -`-a LENGTH' -`--suffix-length=LENGTH' - Use suffixes of length LENGTH. The default LENGTH is 2. +‘-l LINES’ +‘--lines=LINES’ + Put LINES lines of INPUT into each output file. If ‘--separator’ + is specified, then LINES determines the number of records. + + 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 or records + longer than SIZE bytes are broken into multiple files. SIZE has + the same format as for the ‘--bytes’ option. If ‘--separator’ is + specified, then LINES determines the number of records. + +‘--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 or records + 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 or records 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/record 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. + + FROM is supported with the long form option, and is used to either + set the initial suffix for a single run, or to set the suffix + offset for independently split inputs, and consequently the auto + suffix length expansion described above is disabled. Therefore you + may also want to use option ‘-a’ to allow suffixes beyond ‘99’. + Note if option ‘--number’ is specified and the number of files is + less than FROM, a single run is assumed and the minimum suffix + length required is automatically determined. + +‘--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. + +‘-t SEPARATOR’ +‘--separator=SEPARATOR’ + Use character SEPARATOR as the record separator instead of the + default newline character (ASCII LF). To specify ASCII NUL as the + separator, use the two-character string ‘\0’, e.g., ‘split -t + '\0'’. + +‘-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. -`-l LINES' -`--lines=LINES' - Put LINES lines of INPUT into each output file. + An exit status of zero indicates success, and a nonzero value +indicates failure. - For compatibility `split' also supports an obsolete option syntax - `-LINES'. New scripts should use `-l LINES' instead. + Here are a few examples to illustrate how the ‘--number’ (‘-n’) +option works: -`-b BYTES' -`--bytes=BYTES' - Put the first BYTES bytes of INPUT into each output file. - Appending `b' multiplies BYTES by 512, `k' by 1024, and `m' by - 1048576. + Notice how, by default, one line may be split onto two or more: -`-C BYTES' -`--line-bytes=BYTES' - Put into each output file as many complete lines of INPUT as - possible without exceeding BYTES bytes. For lines longer than - BYTES bytes, put BYTES bytes into each output file until less than - BYTES bytes of the line are left, then continue normally. BYTES - has the same format as for the `--bytes' option. + $ seq -w 6 10 > k; split -n3 k; head xa? + ==> xaa <== + 06 + 07 + ==> xab <== -`-d' -`--numeric-suffixes' - Use digits in suffixes rather than lower-case letters. + 08 + 0 + ==> xac <== + 9 + 10 -`--verbose' - Write a diagnostic to standard error just before each output file - is opened. + Use the "l/" modifier to suppress that: + $ seq -w 6 10 > k; split -nl/3 k; head xa? + ==> xaa <== + 06 + 07 - An exit status of zero indicates success, and a nonzero value -indicates failure. + ==> 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 File: coreutils.info, Node: csplit invocation, Prev: split invocation, Up: Output of parts of files -5.4 `csplit': Split a file into context-determined pieces +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’ creates zero or more output files containing sections of INPUT +(standard input if INPUT is ‘-’). Synopsis: - csplit [OPTION]... INPUT PATTERN... + 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 @@ -2277,95 +2651,143 @@ 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 + 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' +‘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. + create an output file containing the next N lines of the input file + once for each repeat. -`/REGEXP/[OFFSET]' +‘/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. + 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]' +‘%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-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) + 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, +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, + 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 + The program accepts the following options. Also see *note Common options::. -`-f PREFIX' -`--prefix=PREFIX' +‘-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 +‘-b FORMAT’ +‘--suffix-format=FORMAT’ + Use FORMAT 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 + ‘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 integer argument to readable form; - thus, only `d', `i', `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' + 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 FORMAT + 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' +‘-k’ +‘--keep-files’ Do not remove output files when errors are encountered. -`-z' -`--elide-empty-files' +‘--suppress-matched’ + Do not output lines matching the specified PATTERN. I.e., suppress + the boundary line from the start of the second and subsequent + splits. + +‘-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' + 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 + + Example of splitting input by empty lines: + + $ csplit --suppress-matched INPUT.TXT '/^$/' '{*}' + File: coreutils.info, Node: Summarizing files, Next: Operating on sorted files, Prev: Output of parts of files, Up: Top @@ -2387,28 +2809,28 @@ of files. File: coreutils.info, Node: wc invocation, Next: sum invocation, Up: Summarizing files -6.1 `wc': Print newline, word, and byte counts +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’ 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 [OPTION]… [FILE]… - `wc' prints one line of counts for each file, and if the file was + ‘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 +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. +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 + 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 @@ -2416,50 +2838,54 @@ Options do not undo others previously given, so prints both the byte counts and the word counts. - With the `--max-line-length' option, `wc' prints the length of the + 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. +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 + The program accepts the following options. Also see *note Common options::. -`-c' -`--bytes' +‘-c’ +‘--bytes’ Print only the byte counts. -`-m' -`--chars' +‘-m’ +‘--chars’ Print only the character counts. -`-w' -`--words' +‘-w’ +‘--words’ Print only the word counts. -`-l' -`--lines' +‘-l’ +‘--lines’ Print only the newline counts. -`-L' -`--max-line-length' - Print only the maximum line lengths. - -`--files0-from=FILE' - Rather than processing files named on the command line, process - those named in file FILE; each name is terminated by a null byte. - 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 - null-byte-terminated file names is with GNU `find', using its - `-print0' predicate. 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 - - Do not specify any FILE on the command line when using this option. - +‘-L’ +‘--max-line-length’ + Print only the maximum display widths. Tabs are set at every 8th + column. Display widths of wide characters are considered. + Non-printable characters are given 0 width. + +‘--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. @@ -2467,39 +2893,38 @@ indicates failure. File: coreutils.info, Node: sum invocation, Next: cksum invocation, Prev: wc invocation, Up: Summarizing files -6.2 `sum': Print checksum and block counts +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’ 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 [OPTION]… [FILE]… - `sum' prints the checksum for each FILE followed by the number of + ‘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, +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 + 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 + The program accepts the following options. Also see *note Common options::. -`-r' +‘-r’ Use the default (BSD compatible) algorithm. This option is - included for compatibility with the System V `sum'. Unless `-s' + included for compatibility with the System V ‘sum’. Unless ‘-s’ was also given, it has no effect. -`-s' -`--sysv' +‘-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’’s default, and print file sizes in units of 512-byte blocks. - `sum' is provided for compatibility; the `cksum' program (see next + ‘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 @@ -2508,28 +2933,28 @@ indicates failure. File: coreutils.info, Node: cksum invocation, Next: md5sum invocation, Prev: sum invocation, Up: Summarizing files -6.3 `cksum': Print CRC checksum and byte counts +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 `-'. +‘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 [OPTION]… [FILE]… - `cksum' prints the CRC checksum for each file along with the number + ‘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 + ‘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 ‘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 +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 + The only options are ‘--help’ and ‘--version’. *Note Common options::. An exit status of zero indicates success, and a nonzero value @@ -2538,95 +2963,126 @@ indicates failure. File: coreutils.info, Node: md5sum invocation, Next: sha1sum invocation, Prev: cksum invocation, Up: Summarizing files -6.4 `md5sum': Print or check MD5 digests +6.4 ‘md5sum’: Print or check MD5 digests ======================================== -`md5sum' computes a 128-bit checksum (or "fingerprint" or -"message-digest") for each specified FILE. +‘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 +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 truly secure -against malicious tampering: although finding a file with a given MD5 -fingerprint, or modifying a file so as to retain its MD5 are considered -infeasible at the moment, it is known how to produce different files -with identical MD5 (a "collision"), something which can be a security -issue in certain contexts. For more secure hashes, consider using -SHA-1 or SHA-2. *Note sha1sum invocation::, and *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 +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]... + md5sum [OPTION]… [FILE]… - For each FILE, `md5sum' outputs the MD5 checksum, a flag indicating -a binary or text input file, 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. + For each FILE, ‘md5sum’ outputs by default, the MD5 checksum, a +space, a flag indicating binary or text input mode, and the file name. +Binary mode is indicated with ‘*’, text mode with ‘ ’ (space). Binary +mode is the default on systems where it’s significant, otherwise text +mode is the default. 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 + The program accepts the following options. Also see *note Common options::. -`-b' -`--binary' +‘-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 + 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 file 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. + 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' +‘-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 files are marked with `*', text with ` '. 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. - -`--status' + 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’. Three input formats are + supported. Either the default output format described above, the + ‘--tag’ output format, or the BSD reversed mode format which is + similar to the default mode, but doesn’t use a character to + distinguish binary and text modes. + + 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. + +‘--ignore-missing’ + This option is useful only when verifying checksums. When + verifying checksums, don’t fail or report any status for missing + files. This is useful when verifying a subset of downloaded files + given a larger list of checksums. + +‘--quiet’ 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. + 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. -`-t' -`--text' +‘--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 + 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. + 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' +‘-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. @@ -2634,16 +3090,16 @@ indicates failure. File: coreutils.info, Node: sha1sum invocation, Next: sha2 utilities, Prev: md5sum invocation, Up: Summarizing files -6.5 `sha1sum': Print or check SHA-1 digests +6.5 ‘sha1sum’: Print or check SHA-1 digests =========================================== -`sha1sum' computes a 160-bit checksum for each specified FILE. The +‘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::. +‘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 +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::. @@ -2654,17 +3110,14 @@ File: coreutils.info, Node: sha2 utilities, Prev: sha1sum invocation, Up: Sum 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'. +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’ and ‘sha1sum’. *Note md5sum invocation::. - Note: The SHA384 and SHA512 digests are considerably slower to -compute, especially on 32-bit computers, than SHA224 or SHA256. - -File: coreutils.info, Node: Operating on sorted files, Next: Operating on fields within a line, Prev: Summarizing files, Up: Top +File: coreutils.info, Node: Operating on sorted files, Next: Operating on fields, Prev: Summarizing files, Up: Top 7 Operating on sorted files *************************** @@ -2679,75 +3132,74 @@ These commands work with (or produce) sorted files. * comm invocation:: Compare two sorted files line by line. * ptx invocation:: Produce a permuted index of file contents. * tsort invocation:: Topological sort. -* tsort background:: Where tsort came from. File: coreutils.info, Node: sort invocation, Next: shuf invocation, Up: Operating on sorted files -7.1 `sort': Sort text 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’ 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]… + + Many options affect how ‘sort’ compares lines; if the results are +unexpected, try the ‘--debug’ option to see what happened. 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. - `sort' has three modes of operation: sort (the default), merge, and + Unless otherwise specified, all comparisons use the character +collating sequence specified by the ‘LC_COLLATE’ locale.(1) A line’s +trailing newline is not part of the line for comparison purposes. If +the final byte of an input file is not a newline, GNU ‘sort’ silently +supplies one. GNU ‘sort’ (as specified for all GNU utilities) has no +limit on input line length or restrictions on bytes allowed within +lines. + + ‘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' +‘-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' +‘-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. + This is like ‘-c’, except it does not print a diagnostic. -`-m' -`--merge' +‘-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 + 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 + 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 @@ -2755,281 +3207,366 @@ 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 +‘sort’, global options affect only later key fields, so portable shell scripts should specify global options first. -`-b' -`--ignore-leading-blanks' +‘-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. - -`-d' -`--dictionary-order' - Sort in "phone directory" order: ignore all characters except + 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. + ‘LC_CTYPE’ locale can change this. -`-f' -`--ignore-case' +‘-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. - -`-g' -`--general-numeric-sort' - Sort numerically, using the standard C function `strtod' to convert - a prefix of each line to a double-precision floating point number. - This allows floating point numbers to be specified in scientific - notation, like `1.0e-34' and `10e100'. The `LC_NUMERIC' locale - determines the decimal-point character. Do not report overflow, - underflow, or conversion errors. Use the following collating - sequence: - - * Lines that do not start with numbers (all considered to be + 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 + • 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 + • Minus infinity. + • Finite numbers in ascending numeric order (with -0 and +0 equal). - - * Plus infinity. + • 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 + than ‘--numeric-sort’ (‘-n’) and it can lose information when converting to floating point. -`-i' -`--ignore-nonprinting' - Ignore nonprinting characters. The `LC_CTYPE' locale determines +‘-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. Note also the ‘numfmt’ command, + which can be used to reformat numbers to human format _after_ the + sort, thus often allowing sort to operate on more accurate numbers. + +‘-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. + ‘--dictionary-order’ (‘-d’) option is also given. -`-M' -`--month-sort' +‘-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' + 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 + 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 + 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 + 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. + 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' +‘-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' +‘-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 + 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 + functions for different fields, you can invoke ‘sort’ more than once. - The choice of hash function is affected by the `--random-source' + The choice of hash function is affected by the ‘--random-source’ option. - Other options are: -`--compress-program=PROG' +‘--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 + 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. - Whitespace and the backslash character should not appear in PROG; + White space and the backslash character should not appear in PROG; they are reserved for future use. -`-k POS1[,POS2]' -`--key=POS1[,POS2]' +‘--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 + 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 + 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 examples. - -`-o OUTPUT-FILE' -`--output=OUTPUT-FILE' + 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' + ‘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::. + hash function to use with the ‘-R’ option. *Note Random sources::. + +‘-s’ +‘--stable’ -`-s' -`--stable' - Make `sort' stable by disabling its last-resort comparison. This + 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. + than ‘--reverse’ (‘-r’) are specified. -`-S SIZE' -`--buffer-size=SIZE' +‘-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 + 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 + 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 + buffer grows beyond SIZE if ‘sort’ encounters input lines larger than SIZE. -`-t SEPARATOR' -`--field-separator=SEPARATOR' +‘-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 + 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. + 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 a null character (ASCII NUL) as the field separator, - use the two-character string `\0', e.g., `sort -t '\0''. + To specify ASCII NUL as the field separator, use the two-character + string ‘\0’, e.g., ‘sort -t '\0'’. -`-T TEMPDIR' -`--temporary-directory=TEMPDIR' +‘-T TEMPDIR’ +‘--temporary-directory=TEMPDIR’ Use directory TEMPDIR to store temporary files, overriding the - `TMPDIR' environment variable. If this option is given more than + ‘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. -`-u' -`--unique' +‘--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. + 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' - Treat the input as a set of lines, each terminated by a null - character (ASCII NUL) instead of a line feed (ASCII LF). 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 + 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'. +‘-b’. - A position in a sort field specified with `-k' may have any of the -option letters `Mbdfinr' appended to it, in which case the global -ordering options are not used for that particular field. The `-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', `-g', `-M', or `-n'; otherwise the varying numbers -of leading blanks in fields can cause confusing results. +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 +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. 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. + 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 >/dev/null -2>&1; then ...' to decide which syntax to use. +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 >/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 in descending (reverse) numeric order. sort -n -r - * Sort alphabetically, omitting the first and second fields and the + • 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 @@ -3037,46 +3574,46 @@ syntax, it can use a test like `if sort -k 1 </dev/null >/dev/null sort -k 3b - * Sort numerically on the second field and resolve ties by sorting + • 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. + 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' + 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. + 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 + 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 + 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 + • 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 `:'. + 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 + 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' + 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: + • 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 @@ -3088,102 +3625,115 @@ syntax, it can use a test like `if sort -k 1 </dev/null >/dev/null 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 + 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 + ‘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 + 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 + ‘-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. + • 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 + 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. - * Shuffle a list of directories, but preserve the order of files + • 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 + (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'. +if ‘LC_CTYPE’ is ‘ja_JP.PCK’ but ‘LC_COLLATE’ is ‘en_US.UTF-8’. File: coreutils.info, Node: shuf invocation, Next: uniq invocation, Prev: sort invocation, Up: Operating on sorted files -7.2 `shuf': Shuffling text +7.2 ‘shuf’: Shuffling text ========================== -`shuf' shuffles its input by outputting a random permutation of its +‘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 [OPTION]… [FILE] + shuf -e [OPTION]… [ARG]… + shuf -i LO-HI [OPTION]… - `shuf' has three modes of operation that affect where it obtains its + ‘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' +‘-e’ +‘--echo’ Treat each command-line operand as an input line. -`-i LO-HI' -`--input-range=LO-HI' +‘-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. + decimal integers LO…HI, one per line. - - `shuf''s other options can affect its behavior in all operation + ‘shuf’’s other options can affect its behavior in all operation modes: -`-n LINES' -`--head-lines=LINES' - Output at most LINES lines. By default, all input lines are +‘-n COUNT’ +‘--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' +‘-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 <F' and - `cat F | shuf -o F'. + shuffle a file in place by using commands like ‘shuf -o F <F’ and + ‘cat F | shuf -o F’. -`--random-source=FILE' +‘--random-source=FILE’ Use FILE as a source of random data used to determine which permutation to generate. *Note Random sources::. -`-z' -`--zero-terminated' - Treat the input and output as a set of lines, each terminated by a - zero byte (ASCII NUL (Null) character) instead of an ASCII LF - (Line Feed). 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). - +‘-r’ +‘--repeat’ + Repeat output values, that is, select with replacement. With this + option the output is not a permutation of the input; instead, each + output line is randomly chosen from all the inputs. This option is + typically combined with ‘--head-count’; if ‘--head-count’ is not + given, ‘shuf’ repeats indefinitely. + +‘-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). For example: @@ -3212,17 +3762,25 @@ might output: spades hearts -and the command `shuf -i 1-4' might output: +and the command ‘shuf -i 1-4’ might output: 4 2 1 3 -These examples all have four input lines, so `shuf' might produce any -of the twenty-four possible permutations of the input. In general, if -there are N input lines, there are N! (i.e., N factorial, or N * (N - -1) * ... * 1) possible output permutations. +The above examples all have four input lines, so ‘shuf’ might produce +any of the twenty-four possible permutations of the input. In general, +if there are N input lines, there are N! (i.e., N factorial, or N * (N +- 1) * … * 1) possible output permutations. + +To output 50 random numbers each in the range 0 through 9, use: + + shuf -r -n 50 -i 0-9 + +To simulate 100 coin flips, use: + + shuf -r -n 100 -e Head Tail An exit status of zero indicates success, and a nonzero value indicates failure. @@ -3230,110 +3788,149 @@ indicates failure. File: coreutils.info, Node: uniq invocation, Next: comm invocation, Prev: shuf invocation, Up: Operating on sorted files -7.3 `uniq': Uniquify files +7.3 ‘uniq’: Uniquify files ========================== -`uniq' writes the unique lines in the given `input', or standard input -if nothing is given or for an INPUT name of `-'. Synopsis: +‘uniq’ writes the unique lines in the given ‘input’, or standard input +if nothing is given or for an INPUT name of ‘-’. Synopsis: - uniq [OPTION]... [INPUT [OUTPUT]] + uniq [OPTION]… [INPUT [OUTPUT]] - By default, `uniq' prints its input lines, except that it discards + By default, ‘uniq’ prints its input lines, except that it discards all but the first of adjacent repeated lines, so that no output lines are repeated. Optionally, it can instead discard lines that are not repeated, or all repeated lines. The input need not be sorted, but repeated input lines are detected only if they are adjacent. If you want to discard non-adjacent -duplicate lines, perhaps you want to use `sort -u'. *Note sort +duplicate lines, perhaps you want to use ‘sort -u’. *Note sort invocation::. - Comparisons use the character collating sequence specified by the -`LC_COLLATE' locale category. + Comparisons honor the rules specified by the ‘LC_COLLATE’ locale +category. - If no OUTPUT file is specified, `uniq' writes to standard output. + If no OUTPUT file is specified, ‘uniq’ writes to standard output. - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-f N' -`--skip-fields=N' +‘-f N’ +‘--skip-fields=N’ Skip N fields on each line before checking for uniqueness. Use a null string for comparison if a line has fewer than N fields. Fields are sequences of non-space non-tab characters that are separated from each other by at least one space or tab. - For compatibility `uniq' supports an obsolete option syntax `-N'. - New scripts should use `-f N' instead. + For compatibility ‘uniq’ supports an obsolete option syntax ‘-N’. + New scripts should use ‘-f N’ instead. -`-s N' -`--skip-chars=N' +‘-s N’ +‘--skip-chars=N’ Skip N characters before checking for uniqueness. Use a null string for comparison if a line has fewer than N characters. If you use both the field and character skipping options, fields are skipped over first. - On older systems, `uniq' supports an obsolete option syntax `+N'. + On older systems, ‘uniq’ supports an obsolete option syntax ‘+N’. This obsolete behavior can be enabled or disabled with the - `_POSIX2_VERSION' environment variable (*note Standards + ‘_POSIX2_VERSION’ environment variable (*note Standards conformance::), but portable scripts should avoid commands whose - behavior depends on this variable. For example, use `uniq ./+10' - or `uniq -s 10' rather than the ambiguous `uniq +10'. + behavior depends on this variable. For example, use ‘uniq ./+10’ + or ‘uniq -s 10’ rather than the ambiguous ‘uniq +10’. -`-c' -`--count' +‘-c’ +‘--count’ Print the number of times each line occurred along with the line. -`-i' -`--ignore-case' +‘-i’ +‘--ignore-case’ Ignore differences in case when comparing lines. -`-d' -`--repeated' +‘-d’ +‘--repeated’ Discard lines that are not repeated. When used by itself, this - option causes `uniq' to print the first copy of each repeated line, + option causes ‘uniq’ to print the first copy of each repeated line, and nothing else. -`-D' -`--all-repeated[=DELIMIT-METHOD]' +‘-D’ +‘--all-repeated[=DELIMIT-METHOD]’ Do not discard the second and subsequent repeated input lines, but discard lines that are not repeated. This option is useful mainly in conjunction with other options e.g., to ignore case or to - compare only selected fields. The optional DELIMIT-METHOD tells - how to delimit groups of repeated lines, and must be one of the - following: + compare only selected fields. The optional DELIMIT-METHOD, + supported with the long form option, specifies how to delimit + groups of repeated lines, and must be one of the following: - `none' + ‘none’ Do not delimit groups of repeated lines. This is equivalent - to `--all-repeated' (`-D'). + to ‘--all-repeated’ (‘-D’). + + ‘prepend’ + Output a newline before each group of repeated lines. With + ‘--zero-terminated’ (‘-z’), use a zero byte (ASCII NUL) + instead of a newline as the delimiter. + + ‘separate’ + Separate groups of repeated lines with a single newline. This + is the same as using ‘prepend’, except that no delimiter is + inserted before the first group, and hence may be better + suited for output direct to users. With ‘--zero-terminated’ + (‘-z’), use a zero byte (ASCII NUL) instead of a newline as + the delimiter. - `prepend' - Output a newline before each group of repeated lines. + Note that when groups are delimited and the input stream contains + blank lines, then the output is ambiguous. To avoid that, filter + the input through ‘tr -s '\n'’ to remove blank lines. + + This is a GNU extension. - `separate' - Separate groups of repeated lines with a single newline. - This is the same as using `prepend', except that there is no - newline before the first group, and hence may be better +‘--group[=DELIMIT-METHOD]’ + Output all lines, and delimit each unique group. With + ‘--zero-terminated’ (‘-z’), use a zero byte (ASCII NUL) instead of + a newline as the delimiter. The optional DELIMIT-METHOD specifies + how to delimit groups, and must be one of the following: + + ‘separate’ + Separate unique groups with a single delimiter. This is the + default delimiting method if none is specified, and better suited for output direct to users. + ‘prepend’ + Output a delimiter before each group of unique items. + + ‘append’ + Output a delimiter after each group of unique items. + + ‘both’ + Output a delimiter around each group of unique items. + Note that when groups are delimited and the input stream contains - two or more consecutive blank lines, then the output is ambiguous. - To avoid that, filter the input through `tr -s '\n'' to replace - each sequence of consecutive newlines with a single newline. + blank lines, then the output is ambiguous. To avoid that, filter + the input through ‘tr -s '\n'’ to remove blank lines. This is a GNU extension. -`-u' -`--unique' - Discard the first repeated line. When used by itself, this option - causes `uniq' to print unique lines, and nothing else. +‘-u’ +‘--unique’ + Discard the last line that would be output for a repeated input + group. When used by itself, this option causes ‘uniq’ to print + unique lines, and nothing else. -`-w N' -`--check-chars=N' +‘-w N’ +‘--check-chars=N’ Compare at most N characters on each line (after skipping any specified fields and characters). By default the entire rest of the lines are compared. +‘-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). Note with + ‘-z’ the newline character is treated as a field separator. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -3341,209 +3938,100 @@ indicates failure. File: coreutils.info, Node: comm invocation, Next: ptx invocation, Prev: uniq invocation, Up: Operating on sorted files -7.4 `comm': Compare two sorted files line by line +7.4 ‘comm’: Compare two sorted files line by line ================================================= -`comm' writes to standard output lines that are common, and lines that -are unique, to two input files; a file name of `-' means standard -input. Synopsis: +‘comm’ writes to standard output lines that are common, and lines that +are unique, to two input files; a file name of ‘-’ means standard input. +Synopsis: - comm [OPTION]... FILE1 FILE2 + comm [OPTION]… FILE1 FILE2 - Before `comm' can be used, the input files must be sorted using the -collating sequence specified by the `LC_COLLATE' locale. If an input + Before ‘comm’ can be used, the input files must be sorted using the +collating sequence specified by the ‘LC_COLLATE’ locale. If an input file ends in a non-newline character, a newline is silently appended. -The `sort' command with no options always outputs a file that is -suitable input to `comm'. +The ‘sort’ command with no options always outputs a file that is +suitable input to ‘comm’. - With no options, `comm' produces three-column output. Column one + With no options, ‘comm’ produces three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files. Columns are separated by a single TAB character. - The options `-1', `-2', and `-3' suppress printing of the -corresponding columns. Also see *Note Common options::. + The options ‘-1’, ‘-2’, and ‘-3’ suppress printing of the +corresponding columns (and separators). Also see *note Common +options::. - Unlike some other comparison utilities, `comm' has an exit status + Unlike some other comparison utilities, ‘comm’ has an exit status that does not depend on the result of the comparison. Upon normal -completion `comm' produces an exit code of zero. If there is an error +completion ‘comm’ produces an exit code of zero. If there is an error it exits with nonzero status. - -File: coreutils.info, Node: tsort invocation, Next: tsort background, Prev: ptx invocation, Up: Operating on sorted files - -7.5 `tsort': Topological sort -============================= - -`tsort' performs a topological sort on the given FILE, or standard -input if no input file is given or for a FILE of `-'. For more details -and some history, see *Note tsort background::. Synopsis: - - tsort [OPTION] [FILE] - - `tsort' reads its input as pairs of strings, separated by blanks, -indicating a partial ordering. The output is a total ordering that -corresponds to the given partial ordering. - - For example - - tsort <<EOF - a b c - d - e f - b c d e - EOF - -will produce the output - - a - b - c - d - e - f + If the ‘--check-order’ option is given, unsorted inputs will cause a +fatal error message. If the option ‘--nocheck-order’ is given, unsorted +inputs will never cause an error message. If neither of these options +is given, wrongly sorted inputs are diagnosed only if an input file is +found to contain unpairable lines. If an input file is diagnosed as +being unsorted, the ‘comm’ command will exit with a nonzero status (and +the output should not be used). - Consider a more realistic example. You have a large set of -functions all in one file, and they may all be declared static except -one. Currently that one (say `main') is the first function defined in -the file, and the ones it calls directly follow it, followed by those -they call, etc. Let's say that you are determined to take advantage of -prototypes, so you have to choose between declaring all of those -functions (which means duplicating a lot of information from the -definitions) and rearranging the functions so that as many as possible -are defined before they are used. One way to automate the latter -process is to get a list for each function of the functions it calls -directly. Many programs can generate such lists. They describe a call -graph. Consider the following list, in which a given line indicates -that the function on the left calls the one on the right directly. + Forcing ‘comm’ to process wrongly sorted input files containing +unpairable lines by specifying ‘--nocheck-order’ is not guaranteed to +produce any particular output. The output will probably not correspond +with whatever you hoped it would be. - main parse_options - main tail_file - main tail_forever - tail_file pretty_name - tail_file write_header - tail_file tail - tail_forever recheck - tail_forever pretty_name - tail_forever write_header - tail_forever dump_remainder - tail tail_lines - tail tail_bytes - tail_lines start_lines - tail_lines dump_remainder - tail_lines file_lines - tail_lines pipe_lines - tail_bytes xlseek - tail_bytes start_bytes - tail_bytes dump_remainder - tail_bytes pipe_bytes - file_lines dump_remainder - recheck pretty_name +‘--check-order’ + Fail with an error message if either input file is wrongly ordered. - then you can use `tsort' to produce an ordering of those functions -that satisfies your requirement. +‘--nocheck-order’ + Do not check that both input files are in sorted order. - example$ tsort call-graph | tac - dump_remainder - start_lines - file_lines - pipe_lines - xlseek - start_bytes - pipe_bytes - tail_lines - tail_bytes - pretty_name - write_header - tail - recheck - parse_options - tail_file - tail_forever - main + Other options are: - `tsort' detects any cycles in the input and writes the first cycle -encountered to standard error. +‘--output-delimiter=STR’ + Print STR between adjacent output columns, rather than the default + of a single TAB character. - Note that for a given partial ordering, generally there is no unique -total ordering. In the context of the call graph above, the function -`parse_options' may be placed anywhere in the list as long as it -precedes `main'. + The delimiter STR may not be empty. - The only options are `--help' and `--version'. *Note Common -options::. - - -File: coreutils.info, Node: tsort background, Prev: tsort invocation, Up: Operating on sorted files - -7.6 `tsort': Background -======================= - -`tsort' exists because very early versions of the Unix linker processed -an archive file exactly once, and in order. As `ld' read each object -in the archive, it decided whether it was needed in the program based on -whether it defined any symbols which were undefined at that point in -the link. - - This meant that dependencies within the archive had to be handled -specially. For example, `scanf' probably calls `read'. That means -that in a single pass through an archive, it was important for `scanf.o' -to appear before read.o, because otherwise a program which calls -`scanf' but not `read' might end up with an unexpected unresolved -reference to `read'. - - The way to address this problem was to first generate a set of -dependencies of one object file on another. This was done by a shell -script called `lorder'. The GNU tools don't provide a version of -lorder, as far as I know, but you can still find it in BSD -distributions. - - Then you ran `tsort' over the `lorder' output, and you used the -resulting sort to define the order in which you added objects to the -archive. - - This whole procedure has been obsolete since about 1980, because -Unix archives now contain a symbol table (traditionally built by -`ranlib', now generally built by `ar' itself), and the Unix linker uses -the symbol table to effectively make multiple passes over an archive -file. - - Anyhow, that's where tsort came from. To solve an old problem with -the way the linker handled archive files, which has since been solved -in different ways. - - An exit status of zero indicates success, and a nonzero value -indicates failure. +‘-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). File: coreutils.info, Node: ptx invocation, Next: tsort invocation, Prev: comm invocation, Up: Operating on sorted files -7.7 `ptx': Produce permuted indexes +7.5 ‘ptx’: Produce permuted indexes =================================== -`ptx' reads a text file and essentially produces a permuted index, with +‘ptx’ reads a text file and essentially produces a permuted index, with each keyword in its context. The calling sketch is either one of: - ptx [OPTION ...] [FILE ...] - ptx -G [OPTION ...] [INPUT [OUTPUT]] + ptx [OPTION …] [FILE …] + ptx -G [OPTION …] [INPUT [OUTPUT]] - The `-G' (or its equivalent: `--traditional') option disables all -GNU extensions and reverts to traditional mode, thus introducing some -limitations and changing several of the program's default option values. -When `-G' is not specified, GNU extensions are always enabled. GNU -extensions to `ptx' are documented wherever appropriate in this -document. For the full list, see *Note Compatibility in ptx::. + The ‘-G’ (or its equivalent: ‘--traditional’) option disables all GNU +extensions and reverts to traditional mode, thus introducing some +limitations and changing several of the program’s default option values. +When ‘-G’ is not specified, GNU extensions are always enabled. GNU +extensions to ‘ptx’ are documented wherever appropriate in this +document. *Note Compatibility in ptx::, for the full list. Individual options are explained in the following sections. When GNU extensions are enabled, there may be zero, one or several FILEs after the options. If there is no FILE, the program reads the -standard input. If there is one or several FILEs, they give the name -of input files which are all read in turn, as if all the input files -were concatenated. However, there is a full contextual break between -each file and, when automatic referencing is requested, file names and -line numbers refer to individual text input files. In all cases, the -program outputs the permuted index to the standard output. +standard input. If there is one or several FILEs, they give the name of +input files which are all read in turn, as if all the input files were +concatenated. However, there is a full contextual break between each +file and, when automatic referencing is requested, file names and line +numbers refer to individual text input files. In all cases, the program +outputs the permuted index to the standard output. When GNU extensions are _not_ enabled, that is, when the program operates in traditional mode, there may be zero, one or two parameters @@ -3554,11 +4042,11 @@ instead of the standard input. If two parameters are given, they give respectively the name of the INPUT file to read and the name of the OUTPUT file to produce. _Be very careful_ to note that, in this case, the contents of file given by the second parameter is destroyed. This -behavior is dictated by System V `ptx' compatibility; GNU Standards +behavior is dictated by System V ‘ptx’ compatibility; GNU Standards normally discourage output parameters not introduced by an option. Note that for _any_ file named as the value of an option or as an -input text file, a single dash `-' may be used, in which case standard +input text file, a single dash ‘-’ may be used, in which case standard input is assumed. However, it would not make sense to use this convention more than once per program invocation. @@ -3573,63 +4061,61 @@ convention more than once per program invocation. File: coreutils.info, Node: General options in ptx, Next: Charset selection in ptx, Up: ptx invocation -7.7.1 General options +7.5.1 General options --------------------- -`-G' -`--traditional' +‘-G’ +‘--traditional’ As already explained, this option disables all GNU extensions to - `ptx' and switches to traditional mode. + ‘ptx’ and switches to traditional mode. -`--help' +‘--help’ Print a short help on standard output, then exit without further processing. -`--version' +‘--version’ Print the program version on standard output, then exit without further processing. - An exit status of zero indicates success, and a nonzero value indicates failure. File: coreutils.info, Node: Charset selection in ptx, Next: Input processing in ptx, Prev: General options in ptx, Up: ptx invocation -7.7.2 Charset selection +7.5.2 Charset selection ----------------------- As it is set up now, the program assumes that the input file is coded using 8-bit ISO 8859-1 code, also known as Latin-1 character set, _unless_ it is compiled for MS-DOS, in which case it uses the character -set of the IBM-PC. (GNU `ptx' is not known to work on smaller MS-DOS -machines anymore.) Compared to 7-bit ASCII, the set of characters -which are letters is different; this alters the behavior of regular -expression matching. Thus, the default regular expression for a -keyword allows foreign or diacriticized letters. Keyword sorting, -however, is still crude; it obeys the underlying character set ordering -quite blindly. - -`-f' -`--ignore-case' +set of the IBM-PC. (GNU ‘ptx’ is not known to work on smaller MS-DOS +machines anymore.) Compared to 7-bit ASCII, the set of characters which +are letters is different; this alters the behavior of regular expression +matching. Thus, the default regular expression for a keyword allows +foreign or diacriticized letters. Keyword sorting, however, is still +crude; it obeys the underlying character set ordering quite blindly. + +‘-f’ +‘--ignore-case’ Fold lower case letters to upper case for sorting. - File: coreutils.info, Node: Input processing in ptx, Next: Output formatting in ptx, Prev: Charset selection in ptx, Up: ptx invocation -7.7.3 Word selection and input processing +7.5.3 Word selection and input processing ----------------------------------------- -`-b FILE' -`--break-file=FILE' - This option provides an alternative (to `-W') method of describing +‘-b FILE’ +‘--break-file=FILE’ + + This option provides an alternative (to ‘-W’) method of describing which characters make up words. It introduces the name of a file which contains a list of characters which can_not_ be part of one - word; this file is called the "Break file". Any character which - is not part of the Break file is a word constituent. If both - options `-b' and `-W' are specified, then `-W' has precedence and - `-b' is ignored. + word; this file is called the “Break file”. Any character which is + not part of the Break file is a word constituent. If both options + ‘-b’ and ‘-W’ are specified, then ‘-W’ has precedence and ‘-b’ is + ignored. When GNU extensions are enabled, the only way to avoid newline as a break character is to write all the break characters in the file @@ -3638,56 +4124,59 @@ File: coreutils.info, Node: Input processing in ptx, Next: Output formatting i considered as break characters even if not included in the Break file. -`-i FILE' -`--ignore-file=FILE' - The file associated with this option contains a list of words - which will never be taken as keywords in concordance output. It - is called the "Ignore file". The file contains exactly one word - in each line; the end of line separation of words is not subject - to the value of the `-S' option. - -`-o FILE' -`--only-file=FILE' - The file associated with this option contains a list of words - which will be retained in concordance output; any word not - mentioned in this file is ignored. The file is called the "Only - file". The file contains exactly one word in each line; the end - of line separation of words is not subject to the value of the - `-S' option. +‘-i FILE’ +‘--ignore-file=FILE’ + + The file associated with this option contains a list of words which + will never be taken as keywords in concordance output. It is + called the “Ignore file”. The file contains exactly one word in + each line; the end of line separation of words is not subject to + the value of the ‘-S’ option. + +‘-o FILE’ +‘--only-file=FILE’ + + The file associated with this option contains a list of words which + will be retained in concordance output; any word not mentioned in + this file is ignored. The file is called the “Only file”. The + file contains exactly one word in each line; the end of line + separation of words is not subject to the value of the ‘-S’ option. There is no default for the Only file. When both an Only file and an Ignore file are specified, a word is considered a keyword only if it is listed in the Only file and not in the Ignore file. -`-r' -`--references' +‘-r’ +‘--references’ + On each input line, the leading sequence of non-white space characters will be taken to be a reference that has the purpose of - identifying this input line in the resulting permuted index. For - more information about reference production, see *Note Output - formatting in ptx::. Using this option changes the default value - for option `-S'. + identifying this input line in the resulting permuted index. *Note + Output formatting in ptx::, for more information about reference + production. Using this option changes the default value for option + ‘-S’. Using this option, the program does not try very hard to remove references from contexts in output, but it succeeds in doing so - _when_ the context ends exactly at the newline. If option `-r' is - used with `-S' default value, or when GNU extensions are disabled, - this condition is always met and references are completely - excluded from the output contexts. + _when_ the context ends exactly at the newline. If option ‘-r’ is + used with ‘-S’ default value, or when GNU extensions are disabled, + this condition is always met and references are completely excluded + from the output contexts. + +‘-S REGEXP’ +‘--sentence-regexp=REGEXP’ -`-S REGEXP' -`--sentence-regexp=REGEXP' This option selects which regular expression will describe the end of a line or the end of a sentence. In fact, this regular expression is not the only distinction between end of lines or end of sentences, and input line boundaries have no special significance outside this option. By default, when GNU extensions - are enabled and if `-r' option is not used, end of sentences are + are enabled and if ‘-r’ option is not used, end of sentences are used. In this case, this REGEX is imported from GNU Emacs: [.?!][]\"')}]*\\($\\|\t\\| \\)[ \t\n]* - Whenever GNU extensions are disabled or if `-r' option is used, end + Whenever GNU extensions are disabled or if ‘-r’ option is used, end of lines are used; in this case, the default REGEXP is just: \n @@ -3696,75 +4185,76 @@ File: coreutils.info, Node: Input processing in ptx, Next: Output formatting i line or end of sentence recognition. In this case, the whole file is considered to be a single big line or sentence. The user might want to disallow all truncation flag generation as well, through - option `-F ""'. *Note Syntax of Regular Expressions: + option ‘-F ""’. *Note Syntax of Regular Expressions: (emacs)Regexps. - When the keywords happen to be near the beginning of the input - line or sentence, this often creates an unused area at the - beginning of the output context line; when the keywords happen to - be near the end of the input line or sentence, this often creates - an unused area at the end of the output context line. The program - tries to fill those unused areas by wrapping around context in - them; the tail of the input line or sentence is used to fill the - unused area on the left of the output line; the head of the input - line or sentence is used to fill the unused area on the right of - the output line. + When the keywords happen to be near the beginning of the input line + or sentence, this often creates an unused area at the beginning of + the output context line; when the keywords happen to be near the + end of the input line or sentence, this often creates an unused + area at the end of the output context line. The program tries to + fill those unused areas by wrapping around context in them; the + tail of the input line or sentence is used to fill the unused area + on the left of the output line; the head of the input line or + sentence is used to fill the unused area on the right of the output + line. As a matter of convenience to the user, many usual backslashed escape sequences from the C language are recognized and converted - to the corresponding characters by `ptx' itself. + to the corresponding characters by ‘ptx’ itself. + +‘-W REGEXP’ +‘--word-regexp=REGEXP’ -`-W REGEXP' -`--word-regexp=REGEXP' This option selects which regular expression will describe each keyword. By default, if GNU extensions are enabled, a word is a - sequence of letters; the REGEXP used is `\w+'. When GNU - extensions are disabled, a word is by default anything which ends - with a space, a tab or a newline; the REGEXP used is `[^ \t\n]+'. + sequence of letters; the REGEXP used is ‘\w+’. When GNU extensions + are disabled, a word is by default anything which ends with a + space, a tab or a newline; the REGEXP used is ‘[^ \t\n]+’. An empty REGEXP is equivalent to not using this option. *Note Syntax of Regular Expressions: (emacs)Regexps. As a matter of convenience to the user, many usual backslashed escape sequences, as found in the C language, are recognized and - converted to the corresponding characters by `ptx' itself. - + converted to the corresponding characters by ‘ptx’ itself. File: coreutils.info, Node: Output formatting in ptx, Next: Compatibility in ptx, Prev: Input processing in ptx, Up: ptx invocation -7.7.4 Output formatting +7.5.4 Output formatting ----------------------- -Output format is mainly controlled by the `-O' and `-T' options -described in the table below. When neither `-O' nor `-T' are selected, +Output format is mainly controlled by the ‘-O’ and ‘-T’ options +described in the table below. When neither ‘-O’ nor ‘-T’ are selected, and if GNU extensions are enabled, the program chooses an output format suitable for a dumb terminal. Each keyword occurrence is output to the center of one line, surrounded by its left and right contexts. Each field is properly justified, so the concordance output can be readily -observed. As a special feature, if automatic references are selected -by option `-A' and are output before the left context, that is, if -option `-R' is _not_ selected, then a colon is added after the -reference; this nicely interfaces with GNU Emacs `next-error' -processing. In this default output format, each white space character, -like newline and tab, is merely changed to exactly one space, with no -special attempt to compress consecutive spaces. This might change in -the future. Except for those white space characters, every other -character of the underlying set of 256 characters is transmitted -verbatim. +observed. As a special feature, if automatic references are selected by +option ‘-A’ and are output before the left context, that is, if option +‘-R’ is _not_ selected, then a colon is added after the reference; this +nicely interfaces with GNU Emacs ‘next-error’ processing. In this +default output format, each white space character, like newline and tab, +is merely changed to exactly one space, with no special attempt to +compress consecutive spaces. This might change in the future. Except +for those white space characters, every other character of the +underlying set of 256 characters is transmitted verbatim. Output format is further controlled by the following options. -`-g NUMBER' -`--gap-size=NUMBER' +‘-g NUMBER’ +‘--gap-size=NUMBER’ + Select the size of the minimum white space gap between the fields on the output line. -`-w NUMBER' -`--width=NUMBER' +‘-w NUMBER’ +‘--width=NUMBER’ + Select the maximum output width of each final line. If references are used, they are included or excluded from the maximum output - width depending on the value of option `-R'. If this option is not + width depending on the value of option ‘-R’. If this option is not selected, that is, when references are output before the left context, the maximum output width takes into account the maximum length of all references. If this option is selected, that is, @@ -3772,93 +4262,99 @@ verbatim. output width does not take into account the space taken by references, nor the gap that precedes them. -`-A' -`--auto-reference' +‘-A’ +‘--auto-reference’ + Select automatic references. Each input line will have an automatic reference made up of the file name and the line ordinal, with a single colon between them. However, the file name will be - empty when standard input is being read. If both `-A' and `-r' - are selected, then the input reference is still read and skipped, - but the automatic reference is used at output time, overriding the + empty when standard input is being read. If both ‘-A’ and ‘-r’ are + selected, then the input reference is still read and skipped, but + the automatic reference is used at output time, overriding the input reference. -`-R' -`--right-side-refs' - In the default output format, when option `-R' is not used, any - references produced by the effect of options `-r' or `-A' are +‘-R’ +‘--right-side-refs’ + + In the default output format, when option ‘-R’ is not used, any + references produced by the effect of options ‘-r’ or ‘-A’ are placed to the far right of output lines, after the right context. - With default output format, when the `-R' option is specified, + With default output format, when the ‘-R’ option is specified, references are rather placed at the beginning of each output line, - before the left context. For any other output format, option `-R' - is ignored, with one exception: with `-R' the width of references - is _not_ taken into account in total output width given by `-w'. + before the left context. For any other output format, option ‘-R’ + is ignored, with one exception: with ‘-R’ the width of references + is _not_ taken into account in total output width given by ‘-w’. This option is automatically selected whenever GNU extensions are disabled. -`-F STRING' -`--flac-truncation=STRING' +‘-F STRING’ +‘--flag-truncation=STRING’ + This option will request that any truncation in the output be - reported using the string STRING. Most output fields - theoretically extend towards the beginning or the end of the - current line, or current sentence, as selected with option `-S'. - But there is a maximum allowed output line width, changeable - through option `-w', which is further divided into space for - various output fields. When a field has to be truncated because - it cannot extend beyond the beginning or the end of the current - line to fit in, then a truncation occurs. By default, the string - used is a single slash, as in `-F /'. - - STRING may have more than one character, as in `-F ...'. Also, in - the particular case when STRING is empty (`-F ""'), truncation + reported using the string STRING. Most output fields theoretically + extend towards the beginning or the end of the current line, or + current sentence, as selected with option ‘-S’. But there is a + maximum allowed output line width, changeable through option ‘-w’, + which is further divided into space for various output fields. + When a field has to be truncated because it cannot extend beyond + the beginning or the end of the current line to fit in, then a + truncation occurs. By default, the string used is a single slash, + as in ‘-F /’. + + STRING may have more than one character, as in ‘-F …’. Also, in + the particular case when STRING is empty (‘-F ""’), truncation flagging is disabled, and no truncation marks are appended in this case. As a matter of convenience to the user, many usual backslashed escape sequences, as found in the C language, are recognized and - converted to the corresponding characters by `ptx' itself. + converted to the corresponding characters by ‘ptx’ itself. -`-M STRING' -`--macro-name=STRING' - Select another STRING to be used instead of `xx', while generating - output suitable for `nroff', `troff' or TeX. +‘-M STRING’ +‘--macro-name=STRING’ -`-O' -`--format=roff' - Choose an output format suitable for `nroff' or `troff' - processing. Each output line will look like: + Select another STRING to be used instead of ‘xx’, while generating + output suitable for ‘nroff’, ‘troff’ or TeX. + +‘-O’ +‘--format=roff’ + + Choose an output format suitable for ‘nroff’ or ‘troff’ processing. + Each output line will look like: .xx "TAIL" "BEFORE" "KEYWORD_AND_AFTER" "HEAD" "REF" - so it will be possible to write a `.xx' roff macro to take care of + so it will be possible to write a ‘.xx’ roff macro to take care of the output typesetting. This is the default output format when GNU - extensions are disabled. Option `-M' can be used to change `xx' - to another macro name. + extensions are disabled. Option ‘-M’ can be used to change ‘xx’ to + another macro name. In this output format, each non-graphical character, like newline and tab, is merely changed to exactly one space, with no special - attempt to compress consecutive spaces. Each quote character: `"' - is doubled so it will be correctly processed by `nroff' or `troff'. + attempt to compress consecutive spaces. Each quote character ‘"’ + is doubled so it will be correctly processed by ‘nroff’ or ‘troff’. + +‘-T’ +‘--format=tex’ -`-T' -`--format=tex' Choose an output format suitable for TeX processing. Each output line will look like: \xx {TAIL}{BEFORE}{KEYWORD}{AFTER}{HEAD}{REF} - so it will be possible to write a `\xx' definition to take care of + so it will be possible to write a ‘\xx’ definition to take care of the output typesetting. Note that when references are not being - produced, that is, neither option `-A' nor option `-r' is - selected, the last parameter of each `\xx' call is inhibited. - Option `-M' can be used to change `xx' to another macro name. - - In this output format, some special characters, like `$', `%', - `&', `#' and `_' are automatically protected with a backslash. - Curly brackets `{', `}' are protected with a backslash and a pair - of dollar signs (to force mathematical mode). The backslash - itself produces the sequence `\backslash{}'. Circumflex and tilde - diacritical marks produce the sequence `^\{ }' and `~\{ }' + produced, that is, neither option ‘-A’ nor option ‘-r’ is selected, + the last parameter of each ‘\xx’ call is inhibited. Option ‘-M’ + can be used to change ‘xx’ to another macro name. + + In this output format, some special characters, like ‘$’, ‘%’, ‘&’, + ‘#’ and ‘_’ are automatically protected with a backslash. Curly + brackets ‘{’, ‘}’ are protected with a backslash and a pair of + dollar signs (to force mathematical mode). The backslash itself + produces the sequence ‘\backslash{}’. Circumflex and tilde + diacritical marks produce the sequence ‘^\{ }’ and ‘~\{ }’ respectively. Other diacriticized characters of the underlying character set produce an appropriate TeX sequence as far as possible. The other non-graphical characters, like newline and @@ -3867,78 +4363,225 @@ verbatim. compress consecutive spaces. Let me know how to improve this special character processing for TeX. - File: coreutils.info, Node: Compatibility in ptx, Prev: Output formatting in ptx, Up: ptx invocation -7.7.5 The GNU extensions to `ptx' +7.5.5 The GNU extensions to ‘ptx’ --------------------------------- -This version of `ptx' contains a few features which do not exist in -System V `ptx'. These extra features are suppressed by using the `-G' +This version of ‘ptx’ contains a few features which do not exist in +System V ‘ptx’. These extra features are suppressed by using the ‘-G’ command line option, unless overridden by other command line options. Some GNU extensions cannot be recovered by overriding, so the simple -rule is to avoid `-G' if you care about GNU extensions. Here are the -differences between this program and System V `ptx'. +rule is to avoid ‘-G’ if you care about GNU extensions. Here are the +differences between this program and System V ‘ptx’. - * This program can read many input files at once, it always writes + • This program can read many input files at once, it always writes the resulting concordance on standard output. On the other hand, - System V `ptx' reads only one file and sends the result to - standard output or, if a second FILE parameter is given on the - command, to that FILE. + System V ‘ptx’ reads only one file and sends the result to standard + output or, if a second FILE parameter is given on the command, to + that FILE. Having output parameters not introduced by options is a dangerous - practice which GNU avoids as far as possible. So, for using `ptx' + practice which GNU avoids as far as possible. So, for using ‘ptx’ portably between GNU and System V, you should always use it with a - single input file, and always expect the result on standard - output. You might also want to automatically configure in a `-G' - option to `ptx' calls in products using `ptx', if the configurator - finds that the installed `ptx' accepts `-G'. - - * The only options available in System V `ptx' are options `-b', - `-f', `-g', `-i', `-o', `-r', `-t' and `-w'. All other options - are GNU extensions and are not repeated in this enumeration. - Moreover, some options have a slightly different meaning when GNU - extensions are enabled, as explained below. - - * By default, concordance output is not formatted for `troff' or - `nroff'. It is rather formatted for a dumb terminal. `troff' or - `nroff' output may still be selected through option `-O'. - - * Unless `-R' option is used, the maximum reference width is + single input file, and always expect the result on standard output. + You might also want to automatically configure in a ‘-G’ option to + ‘ptx’ calls in products using ‘ptx’, if the configurator finds that + the installed ‘ptx’ accepts ‘-G’. + + • The only options available in System V ‘ptx’ are options ‘-b’, + ‘-f’, ‘-g’, ‘-i’, ‘-o’, ‘-r’, ‘-t’ and ‘-w’. All other options are + GNU extensions and are not repeated in this enumeration. Moreover, + some options have a slightly different meaning when GNU extensions + are enabled, as explained below. + + • By default, concordance output is not formatted for ‘troff’ or + ‘nroff’. It is rather formatted for a dumb terminal. ‘troff’ or + ‘nroff’ output may still be selected through option ‘-O’. + + • Unless ‘-R’ option is used, the maximum reference width is subtracted from the total output line width. With GNU extensions disabled, width of references is not taken into account in the output line width computations. - * All 256 bytes, even null bytes, are always read and processed from - input file with no adverse effect, even if GNU extensions are - disabled. However, System V `ptx' does not accept 8-bit + • All 256 bytes, even ASCII NUL bytes, are always read and processed + from input file with no adverse effect, even if GNU extensions are + disabled. However, System V ‘ptx’ does not accept 8-bit characters, a few control characters are rejected, and the tilde - `~' is also rejected. + ‘~’ is also rejected. - * Input line length is only limited by available memory, even if GNU - extensions are disabled. However, System V `ptx' processes only + • Input line length is only limited by available memory, even if GNU + extensions are disabled. However, System V ‘ptx’ processes only the first 200 characters in each line. - * The break (non-word) characters default to be every character + • The break (non-word) characters default to be every character except all letters of the underlying character set, diacriticized or not. When GNU extensions are disabled, the break characters default to space, tab and newline only. - * The program makes better use of output line width. If GNU - extensions are disabled, the program rather tries to imitate - System V `ptx', but still, there are some slight disposition - glitches this program does not completely reproduce. + • The program makes better use of output line width. If GNU + extensions are disabled, the program rather tries to imitate System + V ‘ptx’, but still, there are some slight disposition glitches this + program does not completely reproduce. + + • The user can specify both an Ignore file and an Only file. This is + not allowed with System V ‘ptx’. + + +File: coreutils.info, Node: tsort invocation, Prev: ptx invocation, Up: Operating on sorted files + +7.6 ‘tsort’: Topological sort +============================= + +‘tsort’ performs a topological sort on the given FILE, or standard input +if no input file is given or for a FILE of ‘-’. For more details and +some history, see *note tsort background::. Synopsis: + + tsort [OPTION] [FILE] + + ‘tsort’ reads its input as pairs of strings, separated by blanks, +indicating a partial ordering. The output is a total ordering that +corresponds to the given partial ordering. + + For example + + tsort <<EOF + a b c + d + e f + b c d e + EOF + +will produce the output + + a + b + c + d + e + f + + Consider a more realistic example. You have a large set of functions +all in one file, and they may all be declared static except one. +Currently that one (say ‘main’) is the first function defined in the +file, and the ones it calls directly follow it, followed by those they +call, etc. Let’s say that you are determined to take advantage of +prototypes, so you have to choose between declaring all of those +functions (which means duplicating a lot of information from the +definitions) and rearranging the functions so that as many as possible +are defined before they are used. One way to automate the latter +process is to get a list for each function of the functions it calls +directly. Many programs can generate such lists. They describe a call +graph. Consider the following list, in which a given line indicates +that the function on the left calls the one on the right directly. + + main parse_options + main tail_file + main tail_forever + tail_file pretty_name + tail_file write_header + tail_file tail + tail_forever recheck + tail_forever pretty_name + tail_forever write_header + tail_forever dump_remainder + tail tail_lines + tail tail_bytes + tail_lines start_lines + tail_lines dump_remainder + tail_lines file_lines + tail_lines pipe_lines + tail_bytes xlseek + tail_bytes start_bytes + tail_bytes dump_remainder + tail_bytes pipe_bytes + file_lines dump_remainder + recheck pretty_name + + then you can use ‘tsort’ to produce an ordering of those functions +that satisfies your requirement. + + example$ tsort call-graph | tac + dump_remainder + start_lines + file_lines + pipe_lines + xlseek + start_bytes + pipe_bytes + tail_lines + tail_bytes + pretty_name + write_header + tail + recheck + parse_options + tail_file + tail_forever + main + + ‘tsort’ detects any cycles in the input and writes the first cycle +encountered to standard error. + + Note that for a given partial ordering, generally there is no unique +total ordering. In the context of the call graph above, the function +‘parse_options’ may be placed anywhere in the list as long as it +precedes ‘main’. + + The only options are ‘--help’ and ‘--version’. *Note Common +options::. + + An exit status of zero indicates success, and a nonzero value +indicates failure. + +* Menu: + +* tsort background:: Where tsort came from. + + +File: coreutils.info, Node: tsort background, Up: tsort invocation + +7.6.1 ‘tsort’: Background +------------------------- + +‘tsort’ exists because very early versions of the Unix linker processed +an archive file exactly once, and in order. As ‘ld’ read each object in +the archive, it decided whether it was needed in the program based on +whether it defined any symbols which were undefined at that point in the +link. + + This meant that dependencies within the archive had to be handled +specially. For example, ‘scanf’ probably calls ‘read’. That means that +in a single pass through an archive, it was important for ‘scanf.o’ to +appear before read.o, because otherwise a program which calls ‘scanf’ +but not ‘read’ might end up with an unexpected unresolved reference to +‘read’. - * The user can specify both an Ignore file and an Only file. This - is not allowed with System V `ptx'. + The way to address this problem was to first generate a set of +dependencies of one object file on another. This was done by a shell +script called ‘lorder’. The GNU tools don’t provide a version of +lorder, as far as I know, but you can still find it in BSD +distributions. + Then you ran ‘tsort’ over the ‘lorder’ output, and you used the +resulting sort to define the order in which you added objects to the +archive. + + This whole procedure has been obsolete since about 1980, because Unix +archives now contain a symbol table (traditionally built by ‘ranlib’, +now generally built by ‘ar’ itself), and the Unix linker uses the symbol +table to effectively make multiple passes over an archive file. + + Anyhow, that’s where tsort came from. To solve an old problem with +the way the linker handled archive files, which has since been solved in +different ways. -File: coreutils.info, Node: Operating on fields within a line, Next: Operating on characters, Prev: Operating on sorted files, Up: Top +File: coreutils.info, Node: Operating on fields, Next: Operating on characters, Prev: Operating on sorted files, Up: Top -8 Operating on fields within a line -*********************************** +8 Operating on fields +********************* * Menu: @@ -3947,100 +4590,121 @@ File: coreutils.info, Node: Operating on fields within a line, Next: Operating * join invocation:: Join lines on a common field. -File: coreutils.info, Node: cut invocation, Next: paste invocation, Up: Operating on fields within a line +File: coreutils.info, Node: cut invocation, Next: paste invocation, Up: Operating on fields -8.1 `cut': Print selected parts of lines +8.1 ‘cut’: Print selected parts of lines ======================================== -`cut' writes to standard output selected parts of each line of each +‘cut’ writes to standard output selected parts of each line of each input file, or standard input if no files are given or for a file name -of `-'. Synopsis: +of ‘-’. Synopsis: - cut [OPTION]... [FILE]... + cut OPTION… [FILE]… In the table which follows, the BYTE-LIST, CHARACTER-LIST, and -FIELD-LIST are one or more numbers or ranges (two numbers separated by -a dash) separated by commas. Bytes, characters, and fields are -numbered starting at 1. Incomplete ranges may be given: `-M' means -`1-M'; `N-' means `N' through end of line or last field. The list -elements can be repeated, can overlap, and can be specified in any -order; but the selected input is written in the same order that it is -read, and is written exactly once. - - The program accepts the following options. Also see *Note Common +FIELD-LIST are one or more numbers or ranges (two numbers separated by a +dash) separated by commas. Bytes, characters, and fields are numbered +starting at 1. Incomplete ranges may be given: ‘-M’ means ‘1-M’; ‘N-’ +means ‘N’ through end of line or last field. The list elements can be +repeated, can overlap, and can be specified in any order; but the +selected input is written in the same order that it is read, and is +written exactly once. + + The program accepts the following options. Also see *note Common options::. -`-b BYTE-LIST' -`--bytes=BYTE-LIST' +‘-b BYTE-LIST’ +‘--bytes=BYTE-LIST’ Select for printing only the bytes in positions listed in BYTE-LIST. Tabs and backspaces are treated like any other character; they take up 1 byte. If an output delimiter is - specified, (see the description of `--output-delimiter'), then + specified, (see the description of ‘--output-delimiter’), then output that string between ranges of selected bytes. -`-c CHARACTER-LIST' -`--characters=CHARACTER-LIST' +‘-c CHARACTER-LIST’ +‘--characters=CHARACTER-LIST’ Select for printing only the characters in positions listed in - CHARACTER-LIST. The same as `-b' for now, but - internationalization will change that. Tabs and backspaces are - treated like any other character; they take up 1 character. If an - output delimiter is specified, (see the description of - `--output-delimiter'), then output that string between ranges of - selected bytes. - -`-f FIELD-LIST' -`--fields=FIELD-LIST' + CHARACTER-LIST. The same as ‘-b’ for now, but internationalization + will change that. Tabs and backspaces are treated like any other + character; they take up 1 character. If an output delimiter is + specified, (see the description of ‘--output-delimiter’), then + output that string between ranges of selected bytes. + +‘-f FIELD-LIST’ +‘--fields=FIELD-LIST’ Select for printing only the fields listed in FIELD-LIST. Fields are separated by a TAB character by default. Also print any line - that contains no delimiter character, unless the - `--only-delimited' (`-s') option is specified - -`-d INPUT_DELIM_BYTE' -`--delimiter=INPUT_DELIM_BYTE' - With `-f', use the first byte of INPUT_DELIM_BYTE as the input + that contains no delimiter character, unless the ‘--only-delimited’ + (‘-s’) option is specified. + + Note ‘awk’ supports more sophisticated field processing, and by + default will use (and discard) runs of blank characters to separate + fields, and ignore leading and trailing blanks. + awk '{print $2}' # print the second field + awk '{print $NF-1}' # print the penultimate field + awk '{print $2,$1}' # reorder the first two fields + + In the unlikely event that ‘awk’ is unavailable, one can use the + ‘join’ command, to process blank characters as ‘awk’ does above. + join -a1 -o 1.2 - /dev/null # print the second field + join -a1 -o 1.2,1.1 - /dev/null # reorder the first two fields + +‘-d INPUT_DELIM_BYTE’ +‘--delimiter=INPUT_DELIM_BYTE’ + With ‘-f’, use the first byte of INPUT_DELIM_BYTE as the input fields separator (default is TAB). -`-n' +‘-n’ Do not split multi-byte characters (no-op for now). -`-s' -`--only-delimited' - For `-f', do not print lines that do not contain the field +‘-s’ +‘--only-delimited’ + For ‘-f’, do not print lines that do not contain the field separator character. Normally, any line without a field separator is printed verbatim. -`--output-delimiter=OUTPUT_DELIM_STRING' - With `-f', output fields are separated by OUTPUT_DELIM_STRING. - The default with `-f' is to use the input delimiter. When using - `-b' or `-c' to select ranges of byte or character offsets (as - opposed to ranges of fields), output OUTPUT_DELIM_STRING between +‘--output-delimiter=OUTPUT_DELIM_STRING’ + With ‘-f’, output fields are separated by OUTPUT_DELIM_STRING. The + default with ‘-f’ is to use the input delimiter. When using ‘-b’ + or ‘-c’ to select ranges of byte or character offsets (as opposed + to ranges of fields), output OUTPUT_DELIM_STRING between non-overlapping ranges of selected bytes. -`--complement' - This option is a GNU extension. Select for printing the - complement of the bytes, characters or fields selected with the - `-b', `-c' or `-f' options. In other words, do _not_ print the - bytes, characters or fields specified via those options. This - option is useful when you have many fields and want to print all - but a few of them. - +‘--complement’ + This option is a GNU extension. Select for printing the complement + of the bytes, characters or fields selected with the ‘-b’, ‘-c’ or + ‘-f’ options. In other words, do _not_ print the bytes, characters + or fields specified via those options. This option is useful when + you have many fields and want to print all but a few of them. + +‘-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). An exit status of zero indicates success, and a nonzero value indicates failure. -File: coreutils.info, Node: paste invocation, Next: join invocation, Prev: cut invocation, Up: Operating on fields within a line +File: coreutils.info, Node: paste invocation, Next: join invocation, Prev: cut invocation, Up: Operating on fields -8.2 `paste': Merge lines of files +8.2 ‘paste’: Merge lines of files ================================= -`paste' writes to standard output lines consisting of sequentially +‘paste’ writes to standard output lines consisting of sequentially corresponding lines of each given file, separated by a TAB character. -Standard input is used for a file name of `-' or if no input files are +Standard input is used for a file name of ‘-’ or if no input files are given. - For example: + Synopsis: + paste [OPTION]… [FILE]… + + For example, with: $ cat num2 1 2 @@ -4048,20 +4712,35 @@ given. a b c + + Take lines sequentially from each file: $ paste num2 let3 1 a 2 b c - Synopsis: + Duplicate lines from a file: + $ paste num2 let3 num2 + 1 a 1 + 2 b 2 + c + + Intermix lines from stdin: + $ paste - let3 - < num2 + 1 a 2 + b + c - paste [OPTION]... [FILE]... + Join consecutive lines with a space: + $ seq 4 | paste -d ' ' - - + 1 2 + 3 4 - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-s' -`--serial' +‘-s’ +‘--serial’ Paste the lines of one file at a time rather than one line from each file. Using the above example data: @@ -4069,8 +4748,8 @@ options::. 1 2 a b c -`-d DELIM-LIST' -`--delimiters=DELIM-LIST' +‘-d DELIM-LIST’ +‘--delimiters=DELIM-LIST’ Consecutively use the characters in DELIM-LIST instead of TAB to separate merged lines. When DELIM-LIST is exhausted, start again at its beginning. Using the above example data: @@ -4080,41 +4759,50 @@ options::. 2%b_2 %c_ +‘-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). An exit status of zero indicates success, and a nonzero value indicates failure. -File: coreutils.info, Node: join invocation, Prev: paste invocation, Up: Operating on fields within a line +File: coreutils.info, Node: join invocation, Prev: paste invocation, Up: Operating on fields -8.3 `join': Join lines on a common field +8.3 ‘join’: Join lines on a common field ======================================== -`join' writes to standard output a line for each pair of input lines +‘join’ writes to standard output a line for each pair of input lines that have identical join fields. Synopsis: - join [OPTION]... FILE1 FILE2 + join [OPTION]… FILE1 FILE2 - Either FILE1 or FILE2 (but not both) can be `-', meaning standard + Either FILE1 or FILE2 (but not both) can be ‘-’, meaning standard input. FILE1 and FILE2 should be sorted on the join fields. Normally, the sort order is that of the collating sequence specified -by the `LC_COLLATE' locale. Unless the `-t' option is given, the sort -comparison ignores blanks at the start of the join field, as in `sort --b'. If the `--ignore-case' option is given, the sort comparison -ignores the case of characters in the join field, as in `sort -f'. - - The `sort' and `join' commands should use consistent locales and -options if the output of `sort' is fed to `join'. You can use a -command like `sort -k 1b,1' to sort a file on its default join field, -but if you select a non-default locale, join field, separator, or -comparison options, then you should do so consistently between `join' -and `sort'. - - As a GNU extension, if the input has no unpairable lines the sort -order can be any order that considers two fields to be equal if and -only if the sort comparison described above considers them to be equal. -For example: +by the ‘LC_COLLATE’ locale. Unless the ‘-t’ option is given, the sort +comparison ignores blanks at the start of the join field, as in ‘sort +-b’. If the ‘--ignore-case’ option is given, the sort comparison +ignores the case of characters in the join field, as in ‘sort -f’. + + The ‘sort’ and ‘join’ commands should use consistent locales and +options if the output of ‘sort’ is fed to ‘join’. You can use a command +like ‘sort -k 1b,1’ to sort a file on its default join field, but if you +select a non-default locale, join field, separator, or comparison +options, then you should do so consistently between ‘join’ and ‘sort’. +If ‘join -t ''’ is specified then the whole line is considered which +matches the default operation of sort. + + If the input has no unpairable lines, a GNU extension is available; +the sort order can be any order that considers two fields to be equal if +and only if the sort comparison described above considers them to be +equal. For example: $ cat file1 a a1 @@ -4129,87 +4817,133 @@ For example: c c1 c2 b b1 b2 - The defaults are: - * the join field is the first field in each line; - - * fields in the input are separated by one or more blanks, with - leading blanks on the line ignored; + If the ‘--check-order’ option is given, unsorted inputs will cause a +fatal error message. If the option ‘--nocheck-order’ is given, unsorted +inputs will never cause an error message. If neither of these options +is given, wrongly sorted inputs are diagnosed only if an input file is +found to contain unpairable lines, and when both input files are non +empty. If an input file is diagnosed as being unsorted, the ‘join’ +command will exit with a nonzero status (and the output should not be +used). - * fields in the output are separated by a space; + Forcing ‘join’ to process wrongly sorted input files containing +unpairable lines by specifying ‘--nocheck-order’ is not guaranteed to +produce any particular output. The output will probably not correspond +with whatever you hoped it would be. - * each output line consists of the join field, the remaining fields + The defaults are: + • the join field is the first field in each line; + • fields in the input are separated by one or more blanks, with + leading blanks on the line ignored; + • fields in the output are separated by a space; + • each output line consists of the join field, the remaining fields from FILE1, then the remaining fields from FILE2. - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-a FILE-NUMBER' +‘-a FILE-NUMBER’ Print a line for each unpairable line in file FILE-NUMBER (either - `1' or `2'), in addition to the normal output. + ‘1’ or ‘2’), in addition to the normal output. -`-e STRING' - Replace those output fields that are missing in the input with - STRING. +‘--check-order’ + Fail with an error message if either input file is wrongly ordered. + +‘--nocheck-order’ + Do not check that both input files are in sorted order. This is + the default. -`-i' -`--ignore-case' +‘-e STRING’ + Replace those output fields that are missing in the input with + STRING. I.e., missing fields specified with the ‘-12jo’ options. + +‘--header’ + Treat the first line of each input file as a header line. The + header lines will be joined and printed as the first output line. + If ‘-o’ is used to specify output format, the header line will be + printed according to the specified format. The header lines will + not be checked for ordering even if ‘--check-order’ is specified. + Also if the header lines from each file do not match, the heading + fields from the first file will be used. + +‘-i’ +‘--ignore-case’ Ignore differences in case when comparing keys. With this option, the lines of the input files must be ordered in the same way. Use - `sort -f' to produce this ordering. + ‘sort -f’ to produce this ordering. -`-1 FIELD' +‘-1 FIELD’ Join on field FIELD (a positive integer) of file 1. -`-2 FIELD' +‘-2 FIELD’ Join on field FIELD (a positive integer) of file 2. -`-j FIELD' - Equivalent to `-1 FIELD -2 FIELD'. +‘-j FIELD’ + Equivalent to ‘-1 FIELD -2 FIELD’. + +‘-o FIELD-LIST’ +‘-o auto’ + If the keyword ‘auto’ is specified, infer the output format from + the first line in each file. This is the same as the default + output format but also ensures the same number of fields are output + for each line. Missing fields are replaced with the ‘-e’ option + and extra fields are discarded. -`-o FIELD-LIST' - Construct each output line according to the format in FIELD-LIST. - Each element in FIELD-LIST is either the single character `0' or - has the form M.N where the file number, M, is `1' or `2' and N is - a positive field number. + Otherwise, construct each output line according to the format in + FIELD-LIST. Each element in FIELD-LIST is either the single + character ‘0’ or has the form M.N where the file number, M, is ‘1’ + or ‘2’ and N is a positive field number. - A field specification of `0' denotes the join field. In most - cases, the functionality of the `0' field spec may be reproduced + A field specification of ‘0’ denotes the join field. In most + cases, the functionality of the ‘0’ field spec may be reproduced using the explicit M.N that corresponds to the join field. - However, when printing unpairable lines (using either of the `-a' - or `-v' options), there is no way to specify the join field using + However, when printing unpairable lines (using either of the ‘-a’ + or ‘-v’ options), there is no way to specify the join field using M.N in FIELD-LIST if there are unpairable lines in both files. To - give `join' that functionality, POSIX invented the `0' field + give ‘join’ that functionality, POSIX invented the ‘0’ field specification notation. The elements in FIELD-LIST are separated by commas or blanks. Blank separators typically need to be quoted for the shell. For - example, the commands `join -o 1.2,2.2' and `join -o '1.2 2.2'' - are equivalent. + example, the commands ‘join -o 1.2,2.2’ and ‘join -o '1.2 2.2'’ are + equivalent. - All output lines--including those printed because of any -a or -v - option--are subject to the specified FIELD-LIST. + All output lines—including those printed because of any -a or -v + option—are subject to the specified FIELD-LIST. -`-t CHAR' +‘-t CHAR’ Use character CHAR as the input and output field separator. Treat as significant each occurrence of CHAR in the input file. Use - `sort -t CHAR', without the `-b' option of `sort', to produce this - ordering. + ‘sort -t CHAR’, without the ‘-b’ option of ‘sort’, to produce this + ordering. If ‘join -t ''’ is specified, the whole line is + considered, matching the default operation of sort. If ‘-t '\0'’ + is specified then the ASCII NUL character is used to delimit the + fields. -`-v FILE-NUMBER' +‘-v FILE-NUMBER’ Print a line for each unpairable line in file FILE-NUMBER (either - `1' or `2'), instead of the normal output. - + ‘1’ or ‘2’), instead of the normal output. + +‘-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). Note with + ‘-z’ the newline character is treated as a field separator. An exit status of zero indicates success, and a nonzero value indicates failure. -File: coreutils.info, Node: Operating on characters, Next: Directory listing, Prev: Operating on fields within a line, Up: Top +File: coreutils.info, Node: Operating on characters, Next: Directory listing, Prev: Operating on fields, Up: Top 9 Operating on characters ************************* -This commands operate on individual characters. +These commands operate on individual characters. * Menu: @@ -4220,41 +4954,38 @@ This commands operate on individual characters. File: coreutils.info, Node: tr invocation, Next: expand invocation, Up: Operating on characters -9.1 `tr': Translate, squeeze, and/or delete characters +9.1 ‘tr’: Translate, squeeze, and/or delete characters ====================================================== Synopsis: - tr [OPTION]... SET1 [SET2] + tr [OPTION]… SET1 [SET2] - `tr' copies standard input to standard output, performing one of the + ‘tr’ copies standard input to standard output, performing one of the following operations: - * translate, and optionally squeeze repeated characters in the + • translate, and optionally squeeze repeated characters in the result, - - * squeeze repeated characters, - - * delete characters, - - * delete characters, then squeeze repeated characters from the + • squeeze repeated characters, + • delete characters, + • delete characters, then squeeze repeated characters from the result. The SET1 and (if given) SET2 arguments define ordered sets of characters, referred to below as SET1 and SET2. These sets are the -characters of the input that `tr' operates on. The `--complement' -(`-c', `-C') option replaces SET1 with its complement (all of the +characters of the input that ‘tr’ operates on. The ‘--complement’ +(‘-c’, ‘-C’) option replaces SET1 with its complement (all of the characters that are not in SET1). - Currently `tr' fully supports only single-byte characters. -Eventually it will support multibyte characters; when it does, the `-C' -option will cause it to complement the set of characters, whereas `-c' + Currently ‘tr’ fully supports only single-byte characters. +Eventually it will support multibyte characters; when it does, the ‘-C’ +option will cause it to complement the set of characters, whereas ‘-c’ will cause it to complement the set of values. This distinction will matter only when some values are not characters, and this is possible only in locales using multibyte encodings when the input contains encoding errors. - The program accepts the `--help' and `--version' options. *Note + The program accepts the ‘--help’ and ‘--version’ options. *Note Common options::. Options must precede operands. An exit status of zero indicates success, and a nonzero value @@ -4264,7 +4995,7 @@ indicates failure. * Character sets:: Specifying sets of characters. * Translating:: Changing one set of characters to another. -* Squeezing:: Squeezing repeats and deleting. +* Squeezing and deleting:: Removing characters. File: coreutils.info, Node: Character sets, Next: Translating, Up: tr invocation @@ -4280,136 +5011,122 @@ for convenience. Some of them can be used only in SET1 or SET2, as noted below. Backslash escapes + The following backslash escape sequences are recognized: - `\a' + ‘\a’ Control-G. - - `\b' + ‘\b’ Control-H. - - `\f' + ‘\f’ Control-L. - - `\n' + ‘\n’ Control-J. - - `\r' + ‘\r’ Control-M. - - `\t' + ‘\t’ Control-I. - - `\v' + ‘\v’ Control-K. - - `\OOO' - The character with the value given by OOO, which is 1 to 3 - octal digits, - - `\\' + ‘\OOO’ + The 8-bit character with the value given by OOO, which is 1 to + 3 octal digits. Note that ‘\400’ is interpreted as the + two-byte sequence, ‘\040’ ‘0’. + ‘\\’ A backslash. While a backslash followed by a character not listed above is interpreted as that character, the backslash also effectively - removes any special significance, so it is useful to escape `[', - `]', `*', and `-'. + removes any special significance, so it is useful to escape ‘[’, + ‘]’, ‘*’, and ‘-’. Ranges - The notation `M-N' expands to all of the characters from M through - N, in ascending order. M should collate before N; if it doesn't, - an error results. As an example, `0-9' is the same as - `0123456789'. - GNU `tr' does not support the System V syntax that uses square + The notation ‘M-N’ expands to all of the characters from M through + N, in ascending order. M should collate before N; if it doesn’t, + an error results. As an example, ‘0-9’ is the same as + ‘0123456789’. + + GNU ‘tr’ does not support the System V syntax that uses square brackets to enclose ranges. Translations specified in that format sometimes work as expected, since the brackets are often transliterated to themselves. However, they should be avoided - because they sometimes behave unexpectedly. For example, `tr -d - '[0-9]'' deletes brackets as well as digits. + because they sometimes behave unexpectedly. For example, ‘tr -d + '[0-9]'’ deletes brackets as well as digits. Many historically common and even accepted uses of ranges are not - portable. For example, on EBCDIC hosts using the `A-Z' range will - not do what most would expect because `A' through `Z' are not + portable. For example, on EBCDIC hosts using the ‘A-Z’ range will + not do what most would expect because ‘A’ through ‘Z’ are not contiguous as they are in ASCII. If you can rely on a POSIX - compliant version of `tr', then the best way to work around this - is to use character classes (see below). Otherwise, it is most + compliant version of ‘tr’, then the best way to work around this is + to use character classes (see below). Otherwise, it is most portable (and most ugly) to enumerate the members of the ranges. Repeated characters - The notation `[C*N]' in SET2 expands to N copies of character C. - Thus, `[y*6]' is the same as `yyyyyy'. The notation `[C*]' in + + The notation ‘[C*N]’ in SET2 expands to N copies of character C. + Thus, ‘[y*6]’ is the same as ‘yyyyyy’. The notation ‘[C*]’ in STRING2 expands to as many copies of C as are needed to make SET2 - as long as SET1. If N begins with `0', it is interpreted in - octal, otherwise in decimal. + as long as SET1. If N begins with ‘0’, it is interpreted in octal, + otherwise in decimal. Character classes - The notation `[:CLASS:]' expands to all of the characters in the + + The notation ‘[:CLASS:]’ expands to all of the characters in the (predefined) class CLASS. The characters expand in no particular - order, except for the `upper' and `lower' classes, which expand in - ascending order. When the `--delete' (`-d') and - `--squeeze-repeats' (`-s') options are both given, any character + order, except for the ‘upper’ and ‘lower’ classes, which expand in + ascending order. When the ‘--delete’ (‘-d’) and + ‘--squeeze-repeats’ (‘-s’) options are both given, any character class can be used in SET2. Otherwise, only the character classes - `lower' and `upper' are accepted in SET2, and then only if the - corresponding character class (`upper' and `lower', respectively) + ‘lower’ and ‘upper’ are accepted in SET2, and then only if the + corresponding character class (‘upper’ and ‘lower’, respectively) is specified in the same relative position in SET1. Doing this specifies case conversion. The class names are given below; an error results when an invalid class name is given. - `alnum' + ‘alnum’ Letters and digits. - - `alpha' + ‘alpha’ Letters. - - `blank' + ‘blank’ Horizontal whitespace. - - `cntrl' + ‘cntrl’ Control characters. - - `digit' + ‘digit’ Digits. - - `graph' + ‘graph’ Printable characters, not including space. - - `lower' + ‘lower’ Lowercase letters. - - `print' + ‘print’ Printable characters, including space. - - `punct' + ‘punct’ Punctuation characters. - - `space' + ‘space’ Horizontal or vertical whitespace. - - `upper' + ‘upper’ Uppercase letters. - - `xdigit' + ‘xdigit’ Hexadecimal digits. Equivalence classes - The syntax `[=C=]' expands to all of the characters that are - equivalent to C, in no particular order. Equivalence classes are - a relatively recent invention intended to support non-English - alphabets. But there seems to be no standard way to define them - or determine their contents. Therefore, they are not fully - implemented in GNU `tr'; each character's equivalence class - consists only of that character, which is of no particular use. + The syntax ‘[=C=]’ expands to all of the characters that are + equivalent to C, in no particular order. Equivalence classes are a + relatively recent invention intended to support non-English + alphabets. But there seems to be no standard way to define them or + determine their contents. Therefore, they are not fully + implemented in GNU ‘tr’; each character’s equivalence class + consists only of that character, which is of no particular use. -File: coreutils.info, Node: Translating, Next: Squeezing, Prev: Character sets, Up: tr invocation +File: coreutils.info, Node: Translating, Next: Squeezing and deleting, Prev: Character sets, Up: tr invocation 9.1.2 Translating ----------------- -`tr' performs translation when SET1 and SET2 are both given and the -`--delete' (`-d') option is not given. `tr' translates each character +‘tr’ performs translation when SET1 and SET2 are both given and the +‘--delete’ (‘-d’) option is not given. ‘tr’ translates each character of its input that is in SET1 to the corresponding character in SET2. Characters not in SET1 are passed through unchanged. When a character appears more than once in SET1 and the corresponding characters in SET2 @@ -4419,89 +5136,90 @@ two commands are equivalent: tr aaa xyz tr a z - A common use of `tr' is to convert lowercase characters to -uppercase. This can be done in many ways. Here are three of them: + A common use of ‘tr’ is to convert lowercase characters to uppercase. +This can be done in many ways. Here are three of them: tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ tr a-z A-Z tr '[:lower:]' '[:upper:]' -But note that using ranges like `a-z' above is not portable. +But note that using ranges like ‘a-z’ above is not portable. - When `tr' is performing translation, SET1 and SET2 typically have -the same length. If SET1 is shorter than SET2, the extra characters at -the end of SET2 are ignored. + When ‘tr’ is performing translation, SET1 and SET2 typically have the +same length. If SET1 is shorter than SET2, the extra characters at the +end of SET2 are ignored. On the other hand, making SET1 longer than SET2 is not portable; -POSIX says that the result is undefined. In this situation, BSD `tr' +POSIX says that the result is undefined. In this situation, BSD ‘tr’ pads SET2 to the length of SET1 by repeating the last character of SET2 -as many times as necessary. System V `tr' truncates SET1 to the length +as many times as necessary. System V ‘tr’ truncates SET1 to the length of SET2. - By default, GNU `tr' handles this case like BSD `tr'. When the -`--truncate-set1' (`-t') option is given, GNU `tr' handles this case -like the System V `tr' instead. This option is ignored for operations + By default, GNU ‘tr’ handles this case like BSD ‘tr’. When the +‘--truncate-set1’ (‘-t’) option is given, GNU ‘tr’ handles this case +like the System V ‘tr’ instead. This option is ignored for operations other than translation. - Acting like System V `tr' in this case breaks the relatively common + Acting like System V ‘tr’ in this case breaks the relatively common BSD idiom: tr -cs A-Za-z0-9 '\012' -because it converts only zero bytes (the first element in the -complement of SET1), rather than all non-alphanumerics, to newlines. +because it converts only zero bytes (the first element in the complement +of SET1), rather than all non-alphanumerics, to newlines. By the way, the above idiom is not portable because it uses ranges, and it assumes that the octal code for newline is 012. Assuming a POSIX -compliant `tr', here is a better way to write it: +compliant ‘tr’, here is a better way to write it: tr -cs '[:alnum:]' '[\n*]' -File: coreutils.info, Node: Squeezing, Prev: Translating, Up: tr invocation +File: coreutils.info, Node: Squeezing and deleting, Prev: Translating, Up: tr invocation 9.1.3 Squeezing repeats and deleting ------------------------------------ -When given just the `--delete' (`-d') option, `tr' removes any input +When given just the ‘--delete’ (‘-d’) option, ‘tr’ removes any input characters that are in SET1. - When given just the `--squeeze-repeats' (`-s') option, `tr' replaces -each input sequence of a repeated character that is in SET1 with a -single occurrence of that character. + When given just the ‘--squeeze-repeats’ (‘-s’) option and not +translating, ‘tr’ replaces each input sequence of a repeated character +that is in SET1 with a single occurrence of that character. - When given both `--delete' and `--squeeze-repeats', `tr' first + When given both ‘--delete’ and ‘--squeeze-repeats’, ‘tr’ first performs any deletions using SET1, then squeezes repeats from any remaining characters using SET2. - The `--squeeze-repeats' option may also be used when translating, in -which case `tr' first performs translation, then squeezes repeats from + The ‘--squeeze-repeats’ option may also be used when translating, in +which case ‘tr’ first performs translation, then squeezes repeats from any remaining characters using SET2. Here are some examples to illustrate various combinations of options: - * Remove all zero bytes: + • Remove all zero bytes: tr -d '\0' - * Put all words on lines by themselves. This converts all + • Put all words on lines by themselves. This converts all non-alphanumeric characters to newlines, then squeezes each string of repeated newlines into a single newline: tr -cs '[:alnum:]' '[\n*]' - * Convert each sequence of repeated newlines to a single newline: + • Convert each sequence of repeated newlines to a single newline. + I.e., delete blank lines: tr -s '\n' - * Find doubled occurrences of words in a document. For example, - people often write "the the" with the repeated words separated by - a newline. The Bourne shell script below works first by - converting each sequence of punctuation and blank characters to a - single newline. That puts each "word" on a line by itself. Next - it maps all uppercase characters to lower case, and finally it - runs `uniq' with the `-d' option to print out only the words that - were repeated. + • Find doubled occurrences of words in a document. For example, + people often write “the the” with the repeated words separated by a + newline. The Bourne shell script below works first by converting + each sequence of punctuation and blank characters to a single + newline. That puts each “word” on a line by itself. Next it maps + all uppercase characters to lower case, and finally it runs ‘uniq’ + with the ‘-d’ option to print out only the words that were + repeated. #!/bin/sh cat -- "$@" \ @@ -4509,119 +5227,114 @@ any remaining characters using SET2. | tr '[:upper:]' '[:lower:]' \ | uniq -d - * Deleting a small set of characters is usually straightforward. - For example, to remove all `a's, `x's, and `M's you would do this: + • Deleting a small set of characters is usually straightforward. For + example, to remove all ‘a’s, ‘x’s, and ‘M’s you would do this: tr -d axM - However, when `-' is one of those characters, it can be tricky - because `-' has special meanings. Performing the same task as - above but also removing all `-' characters, we might try `tr -d - -axM', but that would fail because `tr' would try to interpret - `-a' as a command-line option. Alternatively, we could try - putting the hyphen inside the string, `tr -d a-xM', but that - wouldn't work either because it would make `tr' interpret `a-x' as - the range of characters `a'...`x' rather than the three. One way - to solve the problem is to put the hyphen at the end of the list - of characters: + However, when ‘-’ is one of those characters, it can be tricky + because ‘-’ has special meanings. Performing the same task as + above but also removing all ‘-’ characters, we might try ‘tr -d + -axM’, but that would fail because ‘tr’ would try to interpret ‘-a’ + as a command-line option. Alternatively, we could try putting the + hyphen inside the string, ‘tr -d a-xM’, but that wouldn’t work + either because it would make ‘tr’ interpret ‘a-x’ as the range of + characters ‘a’…‘x’ rather than the three. One way to solve the + problem is to put the hyphen at the end of the list of characters: tr -d axM- - Or you can use `--' to terminate option processing: + Or you can use ‘--’ to terminate option processing: tr -d -- -axM - More generally, use the character class notation `[=c=]' with `-' - (or any other character) in place of the `c': + More generally, use the character class notation ‘[=c=]’ with ‘-’ + (or any other character) in place of the ‘c’: tr -d '[=-=]axM' Note how single quotes are used in the above example to protect the square brackets from interpretation by a shell. - File: coreutils.info, Node: expand invocation, Next: unexpand invocation, Prev: tr invocation, Up: Operating on characters -9.2 `expand': Convert tabs to spaces +9.2 ‘expand’: Convert tabs to spaces ==================================== -`expand' writes the contents of each given FILE, or standard input if -none are given or for a FILE of `-', to standard output, with tab +‘expand’ writes the contents of each given FILE, or standard input if +none are given or for a FILE of ‘-’, to standard output, with tab characters converted to the appropriate number of spaces. Synopsis: - expand [OPTION]... [FILE]... + expand [OPTION]… [FILE]… - By default, `expand' converts all tabs to spaces. It preserves + By default, ‘expand’ converts all tabs to spaces. It preserves backspace characters in the output; they decrement the column count for -tab calculations. The default action is equivalent to `-t 8' (set tabs +tab calculations. The default action is equivalent to ‘-t 8’ (set tabs every 8 columns). - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-t TAB1[,TAB2]...' -`--tabs=TAB1[,TAB2]...' +‘-t TAB1[,TAB2]…’ +‘--tabs=TAB1[,TAB2]…’ If only one tab stop is given, set the tabs TAB1 spaces apart - (default is 8). Otherwise, set the tabs at columns TAB1, TAB2, - ... (numbered from 0), and replace any tabs beyond the last tab - stop given with single spaces. Tab stops can be separated by - blanks as well as by commas. + (default is 8). Otherwise, set the tabs at columns TAB1, TAB2, … + (numbered from 0), and replace any tabs beyond the last tab stop + given with single spaces. Tab stops can be separated by blanks as + well as by commas. - For compatibility, GNU `expand' also accepts the obsolete option - syntax, `-T1[,T2]...'. New scripts should use `-t T1[,T2]...' - instead. + For compatibility, GNU ‘expand’ also accepts the obsolete option + syntax, ‘-T1[,T2]…’. New scripts should use ‘-t T1[,T2]…’ instead. -`-i' -`--initial' +‘-i’ +‘--initial’ Only convert initial tabs (those that precede all non-space or non-tab characters) on each line to spaces. - An exit status of zero indicates success, and a nonzero value indicates failure. File: coreutils.info, Node: unexpand invocation, Prev: expand invocation, Up: Operating on characters -9.3 `unexpand': Convert spaces to tabs +9.3 ‘unexpand’: Convert spaces to tabs ====================================== -`unexpand' writes the contents of each given FILE, or standard input if -none are given or for a FILE of `-', to standard output, converting +‘unexpand’ writes the contents of each given FILE, or standard input if +none are given or for a FILE of ‘-’, to standard output, converting blanks at the beginning of each line into as many tab characters as -needed. In the default POSIX locale, a "blank" is a space or a tab; +needed. In the default POSIX locale, a “blank” is a space or a tab; other locales may specify additional blank characters. Synopsis: - unexpand [OPTION]... [FILE]... + unexpand [OPTION]… [FILE]… - By default, `unexpand' converts only initial blanks (those that + By default, ‘unexpand’ converts only initial blanks (those that precede all non-blank characters) on each line. It preserves backspace characters in the output; they decrement the column count for tab calculations. By default, tabs are set at every 8th column. - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-t TAB1[,TAB2]...' -`--tabs=TAB1[,TAB2]...' +‘-t TAB1[,TAB2]…’ +‘--tabs=TAB1[,TAB2]…’ If only one tab stop is given, set the tabs TAB1 columns apart - instead of the default 8. Otherwise, set the tabs at columns - TAB1, TAB2, ... (numbered from 0), and leave blanks beyond the tab - stops given unchanged. Tab stops can be separated by blanks as - well as by commas. This option implies the `-a' option. - - For compatibility, GNU `unexpand' supports the obsolete option - syntax, `-TAB1[,TAB2]...', where tab stops must be separated by - commas. (Unlike `-t', this obsolete option does not imply `-a'.) - New scripts should use `--first-only -t TAB1[,TAB2]...' instead. - -`-a' -`--all' + instead of the default 8. Otherwise, set the tabs at columns TAB1, + TAB2, … (numbered from 0), and leave blanks beyond the tab stops + given unchanged. Tab stops can be separated by blanks as well as + by commas. This option implies the ‘-a’ option. + + For compatibility, GNU ‘unexpand’ supports the obsolete option + syntax, ‘-TAB1[,TAB2]…’, where tab stops must be separated by + commas. (Unlike ‘-t’, this obsolete option does not imply ‘-a’.) + New scripts should use ‘--first-only -t TAB1[,TAB2]…’ instead. + +‘-a’ +‘--all’ Also convert all sequences of two or more blanks just before a tab stop, even if they occur after non-blank characters in a line. - An exit status of zero indicates success, and a nonzero value indicates failure. @@ -4631,8 +5344,8 @@ File: coreutils.info, Node: Directory listing, Next: Basic operations, Prev: 10 Directory listing ******************** -This chapter describes the `ls' command and its variants `dir' and -`vdir', which list information about files. +This chapter describes the ‘ls’ command and its variants ‘dir’ and +‘vdir’, which list information about files. * Menu: @@ -4644,56 +5357,60 @@ This chapter describes the `ls' command and its variants `dir' and File: coreutils.info, Node: ls invocation, Next: dir invocation, Up: Directory listing -10.1 `ls': List directory contents +10.1 ‘ls’: List directory contents ================================== -The `ls' program lists information about files (of any type, including -directories). Options and file arguments can be intermixed -arbitrarily, as usual. +The ‘ls’ program lists information about files (of any type, including +directories). Options and file arguments can be intermixed arbitrarily, +as usual. For non-option command-line arguments that are directories, by -default `ls' lists the contents of directories, not recursively, and -omitting files with names beginning with `.'. For other non-option -arguments, by default `ls' lists just the file name. If no non-option -argument is specified, `ls' operates on the current directory, acting -as if it had been invoked with a single argument of `.'. +default ‘ls’ lists the contents of directories, not recursively, and +omitting files with names beginning with ‘.’. For other non-option +arguments, by default ‘ls’ lists just the file name. If no non-option +argument is specified, ‘ls’ operates on the current directory, acting as +if it had been invoked with a single argument of ‘.’. By default, the output is sorted alphabetically, according to the -locale settings in effect.(1) If standard output is a terminal, the +locale settings in effect.(1) If standard output is a terminal, the output is in columns (sorted vertically) and control characters are output as question marks; otherwise, the output is listed one per line and control characters are output as-is. - Because `ls' is such a fundamental program, it has accumulated many + Because ‘ls’ is such a fundamental program, it has accumulated many options over the years. They are described in the subsections below; within each section, options are listed alphabetically (ignoring case). The division of options into the subsections is not absolute, since some -options affect more than one aspect of `ls''s operation. +options affect more than one aspect of ‘ls’’s operation. Exit status: 0 success - 1 minor problems (e.g., a subdirectory was not found) - 2 serious trouble (e.g., memory exhausted) + 1 minor problems (e.g., failure to access a file or directory not + specified as a command line argument. This happens when listing a + directory in which entries are actively being removed or renamed.) + 2 serious trouble (e.g., memory exhausted, invalid option, failure + to access a file or directory specified as a command line argument + or a directory loop) - Also see *Note Common options::. + Also see *note Common options::. * Menu: * Which files are listed:: * What information is listed:: * Sorting the output:: -* More details about version sort:: +* Details about version sort:: * General output formatting:: * Formatting file timestamps:: * Formatting the file names:: ---------- Footnotes ---------- - (1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to -`en_US'), then `ls' may produce output that is sorted differently than -you're accustomed to. In that case, set the `LC_ALL' environment -variable to `C'. + (1) If you use a non-POSIX locale (e.g., by setting ‘LC_ALL’ to +‘en_US’), then ‘ls’ may produce output that is sorted differently than +you’re accustomed to. In that case, set the ‘LC_ALL’ environment +variable to ‘C’. File: coreutils.info, Node: Which files are listed, Next: What information is listed, Up: ls invocation @@ -4701,71 +5418,71 @@ File: coreutils.info, Node: Which files are listed, Next: What information is 10.1.1 Which files are listed ----------------------------- -These options determine which files `ls' lists information for. By -default, `ls' lists files and the contents of any directories on the +These options determine which files ‘ls’ lists information for. By +default, ‘ls’ lists files and the contents of any directories on the command line, except that in directories it ignores files whose names -start with `.'. +start with ‘.’. -`-a' -`--all' - In directories, do not ignore file names that start with `.'. +‘-a’ +‘--all’ + In directories, do not ignore file names that start with ‘.’. -`-A' -`--almost-all' - In directories, do not ignore all file names that start with `.'; - ignore only `.' and `..'. The `--all' (`-a') option overrides - this option. +‘-A’ +‘--almost-all’ + In directories, do not ignore all file names that start with ‘.’; + ignore only ‘.’ and ‘..’. The ‘--all’ (‘-a’) option overrides this + option. -`-B' -`--ignore-backups' - In directories, ignore files that end with `~'. This option is - equivalent to `--ignore='*~' --ignore='.*~''. +‘-B’ +‘--ignore-backups’ + In directories, ignore files that end with ‘~’. This option is + equivalent to ‘--ignore='*~' --ignore='.*~'’. -`-d' -`--directory' +‘-d’ +‘--directory’ List just the names of directories, as with other types of files, rather than listing their contents. 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. + listed on the command line unless the ‘--dereference-command-line’ + (‘-H’), ‘--dereference’ (‘-L’), or + ‘--dereference-command-line-symlink-to-dir’ options are specified. -`-H' -`--dereference-command-line' +‘-H’ +‘--dereference-command-line’ If a command line argument specifies a symbolic link, show information for the file the link references rather than for the link itself. -`--dereference-command-line-symlink-to-dir' - Do not dereference symbolic links, with one exception: if a - command line argument specifies a symbolic link that refers to a - directory, show information for that directory rather than for the - link itself. This is the default behavior when no other - dereferencing-related option has been specified (`--classify' - (`-F'), `--directory' (`-d'), (`-l'), `--dereference' (`-L'), or - `--dereference-command-line' (`-H')). +‘--dereference-command-line-symlink-to-dir’ + Do not dereference symbolic links, with one exception: if a command + line argument specifies a symbolic link that refers to a directory, + show information for that directory rather than for the link + itself. This is the default behavior when no other + dereferencing-related option has been specified (‘--classify’ + (‘-F’), ‘--directory’ (‘-d’), (‘-l’), ‘--dereference’ (‘-L’), or + ‘--dereference-command-line’ (‘-H’)). -`--group-directories-first' +‘--group-directories-first’ Group all the directories before the files and then sort the directories and the files separately using the selected sort key - (see -sort option). That is, this option specifies a primary sort - key, and the -sort option specifies a secondary key. + (see –sort option). That is, this option specifies a primary sort + key, and the –sort option specifies a secondary key. However, any + use of ‘--sort=none’ (‘-U’) disables this option altogether. -`--hide=PATTERN' +‘--hide=PATTERN’ In directories, ignore files whose names match the shell pattern - PATTERN, unless the `--all' (`-a') or `--almost-all' (`-A') is - also given. This option acts like `--ignore=PATTERN' except that - it has no effect if `--all' (`-a') or `--almost-all' (`-A') is - also given. - - This option can be useful in shell aliases. For example, if `lx' - is an alias for `ls --hide='*~'' and `ly' is an alias for `ls - --ignore='*~'', then the command `lx -A' lists the file `README~' - even though `ly -A' would not. - -`-I PATTERN' -`--ignore=PATTERN' + PATTERN, unless the ‘--all’ (‘-a’) or ‘--almost-all’ (‘-A’) is also + given. This option acts like ‘--ignore=PATTERN’ except that it has + no effect if ‘--all’ (‘-a’) or ‘--almost-all’ (‘-A’) is also given. + + This option can be useful in shell aliases. For example, if ‘lx’ + is an alias for ‘ls --hide='*~'’ and ‘ly’ is an alias for ‘ls + --ignore='*~'’, then the command ‘lx -A’ lists the file ‘README~’ + even though ‘ly -A’ would not. + +‘-I PATTERN’ +‘--ignore=PATTERN’ In directories, ignore files whose names match the shell pattern - (not regular expression) PATTERN. As in the shell, an initial `.' + (not regular expression) PATTERN. As in the shell, an initial ‘.’ in a file name does not match a wildcard at the start of PATTERN. Sometimes it is useful to give this option several times. For example, @@ -4773,41 +5490,40 @@ start with `.'. $ ls --ignore='.??*' --ignore='.[^.]' --ignore='#*' The first option ignores names of length 3 or more that start with - `.', the second ignores all two-character names that start with `.' - except `..', and the third ignores names that start with `#'. + ‘.’, the second ignores all two-character names that start with ‘.’ + except ‘..’, and the third ignores names that start with ‘#’. -`-L' -`--dereference' +‘-L’ +‘--dereference’ When showing file information for a symbolic link, show information for the file the link references rather than the link itself. - However, even with this option, `ls' still prints the name of the + However, even with this option, ‘ls’ still prints the name of the link itself, not the name of the file that the link points to. -`-R' -`--recursive' +‘-R’ +‘--recursive’ List the contents of all directories recursively. - File: coreutils.info, Node: What information is listed, Next: Sorting the output, Prev: Which files are listed, Up: ls invocation 10.1.2 What information is listed --------------------------------- -These options affect the information that `ls' displays. By default, +These options affect the information that ‘ls’ displays. By default, only file names are shown. -`--author' - List each file's author when producing long format directory +‘--author’ + List each file’s author when producing long format directory listings. In GNU/Hurd, file authors can differ from their owners, but in other operating systems the two are the same. -`-D' -`--dired' - With the long listing (`-l') format, print an additional line after +‘-D’ +‘--dired’ + With the long listing (‘-l’) format, print an additional line after the main output: - //DIRED// BEG1 END1 BEG2 END2 ... + //DIRED// BEG1 END1 BEG2 END2 … The BEGN and ENDN are unsigned integers that record the byte position of the beginning and end of each file name in the output. @@ -4815,10 +5531,10 @@ only file names are shown. contain unusual characters such as space or newline, without fancy searching. - If directories are being listed recursively (`-R'), output a + If directories are being listed recursively (‘-R’), output a similar line with offsets for each subdirectory name: - //SUBDIRED// BEG1 END1 ... + //SUBDIRED// BEG1 END1 … Finally, output a line of the form: @@ -4854,22 +5570,22 @@ only file names are shown. //SUBDIRED// 2 3 167 172 228 240 290 296 //DIRED-OPTIONS// --quoting-style=literal - Note that the pairs of offsets on the `//DIRED//' line above - delimit these names: `f1', `f2', `sub', `sub2', `deeper', `file'. - The offsets on the `//SUBDIRED//' line delimit the following - directory names: `a', `a/sub', `a/sub/deeper', `a/sub2'. + Note that the pairs of offsets on the ‘//DIRED//’ line above + delimit these names: ‘f1’, ‘f2’, ‘sub’, ‘sub2’, ‘deeper’, ‘file’. + The offsets on the ‘//SUBDIRED//’ line delimit the following + directory names: ‘a’, ‘a/sub’, ‘a/sub/deeper’, ‘a/sub2’. Here is an example of how to extract the fifth entry name, - `deeper', corresponding to the pair of offsets, 222 and 228: + ‘deeper’, corresponding to the pair of offsets, 222 and 228: $ ls -gloRF --dired a > 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 + 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: @@ -4880,44 +5596,45 @@ only file names are shown. //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 + ‘--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::). +‘--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 +‘-g’ + Produce long format directory listings, but don’t display owner information. -`-G' -`--no-group' +‘-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. - Use the `--si' option if you prefer powers of 1000. - -`-i' -`--inode' + 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' +‘-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 @@ -4925,347 +5642,365 @@ only file names are shown. 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' + 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 + ‘--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 + ‘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. + 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' + ‘b’ block special file - - `c' + ‘c’ character special file - - `C' - high performance ("contiguous data") file - - `d' + ‘C’ + high performance (“contiguous data”) file + ‘d’ directory - - `D' + ‘D’ door (Solaris 2.5 and up) - - `l' + ‘l’ symbolic link - - `M' - off-line ("migrated") file (Cray DMF) - - `n' + ‘M’ + off-line (“migrated”) file (Cray DMF) + ‘n’ network special file (HP-UX) - - `p' + ‘p’ FIFO (named pipe) - - `P' + ‘P’ port (Solaris 10 and up) - - `s' + ‘s’ socket - - `?' + ‘?’ some other file type The file mode bits listed are similar to symbolic mode - specifications (*note Symbolic Modes::). But `ls' combines + specifications (*note Symbolic Modes::). But ‘ls’ combines multiple bits into the third character of each set of permissions as follows: - `s' + ‘s’ If the set-user-ID or set-group-ID bit and the corresponding executable bit are both set. - `S' + ‘S’ If the set-user-ID or set-group-ID bit is set but the corresponding executable bit is not set. - `t' + ‘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' + ‘T’ If the restricted deletion flag or sticky bit is set but the other-executable bit is not set. - `x' + ‘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. + 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 a security + context, but no other alternate access method. - For a file with an extended access control list, a `+' character is - listed. Basic access control lists are equivalent to the - permissions listed, and are not considered an alternate access - method. + A file with any other combination of alternate access methods is + marked with a ‘+’ character. -`-n' -`--numeric-uid-gid' +‘-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' . +‘-o’ + Produce long format directory listings, but don’t display group + information. It is equivalent to using ‘--format=long’ with + ‘--no-group’ . -`-s' -`--size' +‘-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 + 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::). + 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 + 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. -File: coreutils.info, Node: Sorting the output, Next: More details about version sort, Prev: What information is listed, Up: ls invocation +File: coreutils.info, Node: Sorting the output, Next: Details about version sort, Prev: What information is listed, Up: ls invocation 10.1.3 Sorting the output ------------------------- -These options change the order in which `ls' sorts the information it +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 +‘-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' +‘-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 +‘-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' +‘-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 + ‘-f’ does.) This is especially useful when listing very large directories, since not doing any sorting can be noticeably faster. -`-v' -`--sort=version' +‘-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 More - details about version sort::.) + treated numerically as an index/version number. (*Note Details + about version sort::.) -`-X' -`--sort=extension' +‘-X’ +‘--sort=extension’ Sort directory contents alphabetically by file extension - (characters after the last `.'); files with no extension are - sorted first. - + (characters after the last ‘.’); files with no extension are sorted + first. -File: coreutils.info, Node: More details about version sort, Next: General output formatting, Prev: Sorting the output, Up: ls invocation +File: coreutils.info, Node: Details about version sort, Next: General output formatting, Prev: Sorting the output, Up: ls invocation -10.1.4 More details about version sort --------------------------------------- +10.1.4 Details about version sort +--------------------------------- -The version sort takes into account the fact that file names frequently -include indices or version numbers. Standard sorting functions usually -do not produce the ordering that people expect because comparisons are -made on a character-by-character basis. The version sort addresses -this problem, and is especially useful when browsing directories that -contain many files with indices/version numbers in their names: +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 - foo.zml-1.gz foo.zml-1.gz - foo.zml-100.gz foo.zml-2.gz - foo.zml-12.gz foo.zml-6.gz - foo.zml-13.gz foo.zml-12.gz - foo.zml-2.gz foo.zml-13.gz - foo.zml-25.gz foo.zml-25.gz - foo.zml-6.gz foo.zml-100.gz + 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 numeric parts with leading zeros are considered as -fractional one: + Note also that leading zeros of numeric parts are ignored: $ ls -1 $ ls -1v - abc-1.007.tgz abc-1.007.tgz - abc-1.012b.tgz abc-1.01a.tgz + 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 the `strverscmp' function. -*Note String/Array Comparison: (libc)String/Array Comparison. One -result of that implementation decision is that `ls -v' does not use the -locale category, `LC_COLLATE'. As a result, non-numeric prefixes are -sorted as if `LC_COLLATE' were set to `C'. + 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 -File: coreutils.info, Node: General output formatting, Next: Formatting file timestamps, Prev: More details about version sort, Up: ls invocation +File: coreutils.info, Node: General output formatting, Next: Formatting file timestamps, Prev: Details about version sort, Up: ls invocation 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. +‘-1’ +‘--format=single-column’ + List one file per line. This is the default for ‘ls’ when standard + output is not a terminal. See also the ‘-b’ and ‘-q’ options to + suppress direct output of newline characters within a file name. -`-C' -`--format=vertical' +‘-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 + ‘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]' +‘--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. - -`-F' -`--classify' -`--indicator-style=classify' + • 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 + 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. + 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' +‘--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. + This is like ‘-F’, except that executables are not marked. -`--indicator-style=WORD' +‘--indicator-style=WORD’ Append a character indicator with style WORD to entry names, as follows: - `none' + ‘none’ Do not append any character indicator; this is the default. - - `slash' - Append `/' for directories. This is the same as the `-p' + ‘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. - `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. -`-k' - Print file sizes in 1024-byte blocks, overriding the default block - size (*note Block size::). This option is equivalent to - `--block-size=1K'. + 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' +‘-m’ +‘--format=commas’ List files horizontally, with as many as will fit on each line, - separated by `, ' (a comma and a space). + separated by ‘, ’ (a comma and a space). -`-p' -`--indicator-style=slash' - Append a `/' to directory names. +‘-p’ +‘--indicator-style=slash’ + Append a ‘/’ to directory names. -`-x' -`--format=across' -`--format=horizontal' +‘-x’ +‘--format=across’ +‘--format=horizontal’ List the files in columns, sorted horizontally. -`-T COLS' -`--tabsize=COLS' +‘-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 + ‘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. + Some terminal emulators might not properly align columns to the + right of a TAB following a non-ASCII byte. You can avoid that + issue by using the ‘-T0’ option or put ‘TABSIZE=0’ in your + environment, to tell ‘ls’ to align using spaces, not tabs. -`-w' -`--width=COLS' +‘-w COLS’ +‘--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. - + variable ‘COLUMNS’ is used if it is set; otherwise the default is + 80. With a COLS value of ‘0’, there is no limit on the length of + the output line, and that single output line will be delimited with + spaces, not tabs. File: coreutils.info, Node: Formatting file timestamps, Next: Formatting the file names, Prev: General output formatting, Up: ls invocation @@ -5273,86 +6008,84 @@ File: coreutils.info, Node: Formatting file timestamps, Next: Formatting the f 10.1.6 Formatting file timestamps --------------------------------- -By default, file timestamps are listed in abbreviated form. Most -locales use a timestamp like `2002-03-30 23:45'. However, the default -POSIX locale uses 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. +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 + 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. +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 ‘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' +‘--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. + ‘+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' + ‘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'. + zone components 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 + 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'. + ‘long-iso’ + List ISO 8601 date and time components with minute precision, + 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' + ‘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 + ‘2002-03-30 ’), and ISO 8601-like 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: + 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' + ‘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'. + 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 + ‘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' + 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=' @@ -5361,24 +6094,23 @@ Variable. 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'. + locale, ‘--time-style="locale"’ might be equivalent to + ‘--time-style="+%e. %b %Y $newline%e. %b %H:%M"’ and might + generate timestamps like ‘30. Mär 2002 ’ and ‘30. Mär 23:45’. - `posix-STYLE' - List POSIX-locale timestamps if the `LC_TIME' locale category + ‘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. + ‘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' + 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"'. +‘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. @@ -5391,145 +6123,152 @@ File: coreutils.info, Node: Formatting the file names, Prev: Formatting file t These options change how file names themselves are printed. -`-b' -`--escape' -`--quoting-style=escape' +‘-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. +‘-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' +‘-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'. + program is ‘ls’. -`-Q' -`--quote-name' -`--quoting-style=c' - Enclose file names in double quotes and quote nongraphic - characters as in C. +‘-Q’ +‘--quote-name’ +‘--quoting-style=c’ + Enclose file names in double quotes and quote nongraphic characters + as in C. -`--quoting-style=WORD' +‘--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' + ‘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' + 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' + ‘shell-escape’ + Like ‘shell’, but also quoting non-printable characters using + the POSIX proposed ‘$''’ syntax suitable for most shells. + ‘shell-escape-always’ + Like ‘shell-escape’, but quote strings 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' + 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' + the ‘-b’ or ‘--escape’ option. + ‘clocale’ Quote strings as for C character string literals, except use surrounding quotation marks appropriate for the locale. - - `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 + 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. + 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 ‘shell-escape’ when the + output is a terminal, and ‘literal’ otherwise. -`--show-control-chars' +‘--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'. - + default unless the output is a terminal and the program is ‘ls’. File: coreutils.info, Node: dir invocation, Next: vdir invocation, Prev: ls invocation, Up: Directory listing -10.2 `dir': Briefly list directory contents +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. +‘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. + *Note ‘ls’: ls invocation. File: coreutils.info, Node: vdir invocation, Next: dircolors invocation, Prev: dir invocation, Up: Directory listing -10.3 `vdir': Verbosely list directory contents +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. +‘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. + + *Note ‘ls’: ls invocation. File: coreutils.info, Node: dircolors invocation, Prev: vdir invocation, Up: Directory listing -10.4 `dircolors': Color setup for `ls' +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: +‘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]`" + eval "$(dircolors [OPTION]… [FILE])" - If FILE is specified, `dircolors' reads it to determine which colors + 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'. +‘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): - The output is a shell command to set the `LS_COLORS' environment + 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 +or ‘dircolors’ will guess it from the value of the ‘SHELL’ environment variable. - The program accepts the following options. Also see *Note Common + 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'. +‘-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'. +‘-c’ +‘--csh’ +‘--c-shell’ + Output C shell commands. This is the default if ‘SHELL’ ends with + ‘csh’ or ‘tcsh’. -`-p' -`--print-database' +‘-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. @@ -5554,298 +6293,389 @@ copying, moving (renaming), and deleting (removing). File: coreutils.info, Node: cp invocation, Next: dd invocation, Up: Basic operations -11.1 `cp': Copy files and directories +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’ 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... + 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 + • 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. + • 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. +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 + 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. - By default, `cp' follows symbolic links 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. - - By default, `cp' copies the contents of special files only when not + When copying from a symbolic link, ‘cp’ normally follows the link +only when not copying recursively or when ‘--link’ (‘-l’) is used. 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. +‘--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. + ‘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 + The program accepts the following options. Also see *note Common options::. -`-a' -`--archive' +‘-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). Equivalent to `-dpPR'. - -`-b' -`--backup[=METHOD]' + 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: + 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 -- "$i" "$i" + cp --backup --force --preserve=all -- "$i" "$i" || fail=1 done + exit $fail -`--copy-contents' +‘--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' + (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 - unlinks 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 unlinked + ‘--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'. + ‘--remove-destination’. - This option is independent of the `--interactive' or `-i' option: + This option is independent of the ‘--interactive’ or ‘-i’ option: neither cancels the effect of the other. -`-H' + 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' +‘-i’ +‘--interactive’ When copying a file other than a directory, prompt whether to - overwrite an existing destination file. + overwrite an existing destination file. The ‘-i’ option overrides + a previous ‘-n’ option. -`-l' -`--link' +‘-l’ +‘--link’ Make hard links instead of copies of non-directories. -`-L' -`--dereference' - Always follow symbolic links. - -`-P' -`--no-dereference' - Copy symbolic links as symbolic links rather than copying the - files that they point to. - -`-p' -`--preserve[=ATTRIBUTE_LIST]' +‘-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: + specified, the ATTRIBUTE_LIST must be a comma-separated list of one + or more of the following strings: - `mode' + ‘mode’ Preserve the file mode bits and access control lists. - - `ownership' + ‘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' + 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. In general, it is not possible to preserve these - attributes when the affected file is a symbolic link. - However, FreeBSD now provides the `lutimes' function, which - makes it possibile even for symbolic links. However, this - implementation does not yet take advantage of that. - - `links' + 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. - - `all' - Preserve all file attributes. Equivalent to specifying all - of the above. - - 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' + 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 ‘--no-dereference’ it would copy the symlink, but + the later ‘-H’ tells ‘cp’ to dereference the command line + arguments where it then sees two files with the same inode + number. Then the ‘--preserve=links’ option also implied by + ‘-a’ will preserve 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, the permissions of existing + destination files are unchanged. Each new file is created with the + mode of the corresponding source file minus the set-user-ID, + set-group-ID, and sticky bits as the create mode; the operating + system then applies either the umask or a default ACL, possibly + resulting in a more restrictive file mode. *Note File + permissions::. + +‘--no-preserve=ATTRIBUTE_LIST’ Do not preserve the specified attributes. The ATTRIBUTE_LIST has - the same form as for `--preserve'. + the same form as for ‘--preserve’. -`--parents' +‘--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 + 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 + copies the file ‘a/b/c’ to ‘existing_dir/a/b/c’, creating any missing intermediate directories. -`--reply=HOW' - *Deprecated: to be removed in 2008.* - Using `--reply=yes' makes `cp' act as if `yes' were given as a - response to every prompt about a destination file. That - effectively cancels any preceding `--interactive' or `-i' option. - Specify `--reply=no' to make `cp' act as if `no' were given as a - response to every prompt about a destination file. Specify - `--reply=query' to make `cp' prompt the user about each existing - destination file. - -`-R' -`-r' -`--recursive' - Copy directories recursively. Symbolic links are not followed by - default; see the `--archive' (`-a'), `-d', `--dereference' (`-L'), - `--no-dereference' (`-P'), and `-H' options. Special files are +‘-R’ +‘-r’ +‘--recursive’ + Copy directories recursively. By default, do not follow symbolic + links in the source unless used together with the ‘--link’ (‘-l’) + option; 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 + 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. -`--remove-destination' +‘--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 behavior. + + 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). + (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. +‘--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' + ‘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' + ‘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' +‘-s’ +‘--symbolic-link’ Make symbolic links instead of copies of non-directories. All - source file names must be absolute (starting with `/') unless the + 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. + 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 +‘-S SUFFIX’ +‘--suffix=SUFFIX’ + Append SUFFIX to each backup file made with ‘-b’. *Note Backup options::. -`-t DIRECTORY' -`--target-directory=DIRECTORY' +‘-t DIRECTORY’ +‘--target-directory=DIRECTORY’ Specify the destination DIRECTORY. *Note Target directory::. -`-T' -`--no-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' +‘-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. - -`-v' -`--verbose' + 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. - +‘-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. + +‘-Z’ +‘--context[=CONTEXT]’ + Without a specified CONTEXT, adjust the SELinux security context + according to the system default type for destination files, + similarly to the ‘restorecon’ command. The long form of this + option with a specific context specified, will set the context for + newly created files only. With a specified context, if both + SELinux and SMACK are disabled, a warning is issued. This option + is mutually exclusive with the ‘--preserve=context’ option, and + overrides the ‘--preserve=all’ and ‘-a’ options. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -5853,215 +6683,338 @@ indicates failure. File: coreutils.info, Node: dd invocation, Next: install invocation, Prev: cp invocation, Up: Basic operations -11.2 `dd': Convert and copy a file +11.2 ‘dd’: Convert and copy a file ================================== -`dd' copies a file (from standard input to standard output, by default) +‘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 [OPERAND]… dd OPTION - The only options are `--help' and `--version'. *Note Common -options::. `dd' accepts the following operands. + 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' +‘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='). +‘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. +‘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. +‘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. +‘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' +‘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=BLOCKS' - Skip BLOCKS `ibs'-byte blocks in the input file before copying. - -`seek=BLOCKS' - Skip BLOCKS `obs'-byte blocks in the output file before copying. - -`count=BLOCKS' - Copy BLOCKS `ibs'-byte blocks from the input file, instead of - everything until the end of the file. - -`conv=CONVERSION[,CONVERSION]...' + 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=LEVEL’ + Transfer information is normally output to stderr upon receipt of + the ‘INFO’ signal or when ‘dd’ exits. Specifying LEVEL will adjust + the amount of information printed, with the last LEVEL specified + taking precedence. + + ‘none’ + Do not print any informational or warning messages to stderr. + Error messages are output as normal. + + ‘noxfer’ + Do not print the final transfer rate and volume statistics + that normally make up the last status line. + + ‘progress’ + Print the transfer rate and volume statistics on stderr, when + processing each input block. Statistics are output on a + single line at most once every second, but updates can be + delayed when waiting on I/O. + +‘conv=CONVERSION[,CONVERSION]…’ Convert the file as specified by the CONVERSION argument(s). (No spaces around any comma(s).) Conversions: - `ascii' + ‘ascii’ Convert EBCDIC to ASCII, using the conversion table specified by POSIX. This provides a 1:1 translation for all 256 bytes. + This option implies ‘conv=unblock’; input is converted to + ASCII before trailing spaces are deleted. - `ebcdic' - Convert ASCII to EBCDIC. This is the inverse of the `ascii' - conversion. + ‘ebcdic’ + Convert ASCII to EBCDIC. This is the inverse of the ‘ascii’ + conversion. This option implies ‘conv=block’; trailing spaces + are added before being converted to EBCDIC. - `ibm' - Convert ASCII to alternate EBCDIC, using the alternate + ‘ibm’ + This acts like ‘conv=ebcdic’, except it uses the alternate conversion table specified by POSIX. This is not a 1:1 - translation, but reflects common historical practice for `~', - `[', and `]'. + translation, but reflects common historical practice for ‘~’, + ‘[’, and ‘]’. - The `ascii', `ebcdic', and `ibm' conversions are mutually - exclusive. + The ‘ascii’, ‘ebcdic’, and ‘ibm’ conversions are mutually + exclusive. If you use any of these options, you should also + use the ‘cbs=’ option. - `block' - For each line in the input, output `cbs' bytes, replacing the + ‘block’ + For each line in the input, output ‘cbs’ bytes, replacing the input newline with a space and padding with spaces as necessary. - `unblock' - Replace trailing spaces in each `cbs'-sized input block with a - newline. + ‘unblock’ + Remove any trailing spaces in each ‘cbs’-sized input block, + and append a newline. - The `block' and `unblock' conversions are mutually exclusive. + The ‘block’ and ‘unblock’ conversions are mutually exclusive. - `lcase' + ‘lcase’ Change uppercase letters to lowercase. - `ucase' + ‘ucase’ Change lowercase letters to uppercase. - The `lcase' and `ucase' conversions are mutually exclusive. - - `swab' - Swap every pair of input bytes. GNU `dd', unlike others, - works when an odd number of bytes are read--the last byte is + 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). - `noerror' - Continue after read errors. + ‘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. - `nocreat' - Do not create the output file; the output file must already - exist. + 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 + ‘excl’ + Fail if the output file already exists; ‘dd’ must create the output file itself. - The `excl' and `nocreat' conversions are mutually exclusive. + ‘nocreat’ + Do not create the output file; the output file must already + exist. + + The ‘excl’ and ‘nocreat’ conversions are mutually exclusive. - `notrunc' + ‘notrunc’ Do not truncate the output file. - `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. + ‘noerror’ + Continue after read errors. - `fdatasync' + ‘fdatasync’ Synchronize output data just before finishing. This forces a physical write of output data. - `fsync' + ‘fsync’ Synchronize output data and metadata just before finishing. This forces a physical write of output data and metadata. - -`iflag=FLAG[,FLAG]...' +‘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]...' +‘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' + ‘append’ Write in append mode, so that even if some other process is - writing to this file, every `dd' write will append to the + 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. 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. - `direct' - Use direct I/O for data, avoiding the buffer cache. + ‘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’ - `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' + ‘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. + 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' + ‘sync’ Use synchronized I/O for both data and metadata. - `nonblock' + ‘nocache’ + Request to discard the system data cache for a file. When + count=0 all cached data for the file is specified, 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. + + Note data that is not already persisted to storage will not be + discarded from cache, so note the use of the “sync” options in + the examples below, which are used to maximize the + effectiveness of the ‘nocache’ flag. + + Here are 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. + # See also the ‘direct’ flag. + dd if=ifile of=ofile iflag=nocache oflag=nocache,sync + + ‘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. + ‘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'. + ‘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' + ‘nofollow’ Do not follow symbolic links. - `nolinks' + ‘nolinks’ Fail if the file has multiple hard links. - `binary' + ‘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 + ‘text’ + Use text I/O. Like ‘binary’, this option has no effect on standard platforms. - - These flags are not supported on all systems, and `dd' rejects + ‘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 (BYTES and BLOCKS) 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::). - - Use different `dd' invocations to use different block sizes for -skipping and I/O. 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: + 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 @@ -6072,23 +7025,52 @@ a 4 KiB label at the start of the disk: # 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, 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 + For failing disks, other tools come with a great variety of extra +functionality to ease the saving of as much data as possible before the +disk finally dies, e.g. GNU ‘ddrescue’ +(http://www.gnu.org/software/ddrescue/). However, in some cases such a +tool is not available or the administrator feels more comfortable with +the handling of ‘dd’. As a simple rescue method, call ‘dd’ as shown in +the following example: the options ‘conv=noerror,sync’ are used to +continue after read errors and to pad out bad reads with NULs, while +‘iflag=fullblock’ caters for short reads (which traditionally never +occur on disk based devices): + + # Rescue data from an (unmounted!) partition of a failing disk. + dd conv=noerror,sync iflag=fullblock </dev/sda1 > /mnt/rescue.img + + Sending an ‘INFO’ signal (or ‘USR1’ signal where that is unavailable) +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 5GB of data. 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. + + # Ignore the signal so we never inadvertently terminate the dd child. + # Note this is not needed when SIGINFO is available. + trap '' USR1 + + # Run dd with the fullblock iflag to avoid short reads + # which can be triggered by reception of signals. + dd iflag=fullblock if=/dev/zero of=/dev/null count=5000000 bs=1000 & pid=$! + + # Output stats every second. + while kill -s USR1 $pid 2>/dev/null; do sleep 1; done + + The above script will output in the following format: + + 3441325+0 records in + 3441325+0 records out + 3441325000 bytes (3.4 GB, 3.2 GiB) copied, 1.00036 s, 3.4 GB/s + 5000000+0 records in + 5000000+0 records out + 5000000000 bytes (5.0 GB, 4.7 GiB) copied, 1.44433 s, 3.5 GB/s + + The ‘status=progress’ option periodically updates the last line of +the transfer statistics above. + + 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 @@ -6097,81 +7079,106 @@ indicates failure. File: coreutils.info, Node: install invocation, Next: mv invocation, Prev: dd invocation, Up: Basic operations -11.3 `install': Copy files and set attributes +11.3 ‘install’: Copy files and set attributes ============================================= -`install' copies files while setting their file mode bits and, if +‘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... + 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 + • 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 ‘--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. + • 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 + ‘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. - The program accepts the following options. Also see *Note Common + ‘install’ never preserves extended attributes (xattr). + + The program accepts the following options. Also see *note Common options::. -`-b' -`--backup[=METHOD]' +‘-b’ +‘--backup[=METHOD]’ *Note Backup options::. Make a backup of each file that would otherwise be overwritten or removed. -`-c' - Ignored; for compatibility with old Unix versions of `install'. - -`-d' -`--directory' +‘-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. Note this option is best used in conjunction + with ‘--user’, ‘--group’ and ‘--mode’ options, lest ‘install’ + incorrectly determines the default attributes that installed files + would have (as it doesn’t consider setgid directories and POSIX + default ACLs for example). This could result in redundant copies + or attributes that are not reset to the correct defaults. + +‘-c’ + Ignored; for compatibility with old Unix versions of ‘install’. + +‘-D’ + Create any missing parent directories of DEST, then copy SOURCE to + DEST. Explicitly specifying the ‘--target-directory=DIR’ will + similarly ensure the presence of that hierarchy before copying + SOURCE arguments. + +‘-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. +‘-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' +‘-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 + ‘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 + ‘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. + 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' +‘-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 @@ -6180,28 +7187,41 @@ options::. modification times of installed files to keep track of when they were last built as opposed to when they were last installed. -`-s' -`--strip' +‘-s’ +‘--strip’ Strip the symbol tables from installed binary executables. -`-S SUFFIX' -`--suffix=SUFFIX' - Append SUFFIX to each backup file made with `-b'. *Note Backup +‘--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 DIRECTORY’ +‘--target-directory=DIRECTORY’ + Specify the destination DIRECTORY. *Note Target directory::. Also + specifying the ‘-D’ option will ensure the directory is present. -`-T' -`--no-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' +‘-v’ +‘--verbose’ Print the name of each file before copying it. +‘-Z’ +‘--context[=CONTEXT]’ + Without a specified CONTEXT, adjust the SELinux security context + according to the system default type for destination files, + similarly to the ‘restorecon’ command. The long form of this + option with a specific context specified, will set the context for + newly created files only. With a specified context, if both + SELinux and SMACK are disabled, a warning is issued. This option + is mutually exclusive with the ‘--preserve-context’ option. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -6209,109 +7229,121 @@ indicates failure. File: coreutils.info, Node: mv invocation, Next: rm invocation, Prev: install invocation, Up: Basic operations -11.4 `mv': Move (rename) files +11.4 ‘mv’: Move (rename) files ============================== -`mv' moves or renames files (or directories). Synopses: +‘mv’ moves or renames files (or directories). Synopses: - mv [OPTION]... [-T] SOURCE DEST - mv [OPTION]... SOURCE... DIRECTORY - mv [OPTION]... -t DIRECTORY SOURCE... + 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 + • 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 + • 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. - - 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. +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. - _Warning_: If you try to move a symlink that points to a directory, -and you specify the symlink with a trailing slash, then `mv' doesn't -move the symlink but instead moves the directory referenced by the -symlink. *Note Trailing slashes::. + ‘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. - The program accepts the following options. Also see *Note Common + 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::. + + _Note_: ‘mv’ will only replace empty directories in the destination. +Conflicting populated directories are skipped with a diagnostic. + + The program accepts the following options. Also see *note Common options::. -`-b' -`--backup[=METHOD]' +‘-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. +‘-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' +‘-i’ +‘--interactive’ Prompt whether to overwrite each existing destination file, - regardless of its permissions. If the response is not - affirmative, the file is skipped. - -`--reply=HOW' - *Deprecated: to be removed in 2008.* - Specifying `--reply=yes' is equivalent to using `--force'. - Specify `--reply=no' to make `mv' act as if `no' were given as a - response to every prompt about a destination file. Specify - `--reply=query' to make `mv' prompt the user about each existing - destination file. Note that `--reply=no' has an effect only when - `mv' would prompt without `-i' or equivalent, i.e., when a - destination file exists and is not writable, standard input is a - terminal, and no `-f' (or equivalent) option is specified. - -`-u' -`--update' + 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 + work if several ‘mv -u’ commands are executed with the same source and destination. -`-v' -`--verbose' +‘-v’ +‘--verbose’ Print the name of each file before moving it. -`--strip-trailing-slashes' +‘--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 +‘-S SUFFIX’ +‘--suffix=SUFFIX’ + Append SUFFIX to each backup file made with ‘-b’. *Note Backup options::. -`-t DIRECTORY' -`--target-directory=DIRECTORY' +‘-t DIRECTORY’ +‘--target-directory=DIRECTORY’ Specify the destination DIRECTORY. *Note Target directory::. -`-T' -`--no-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::. +‘-Z’ +‘--context’ + This option functions similarly to the ‘restorecon’ command, by + adjusting the SELinux security context according to the system + default type for destination files. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -6319,105 +7351,106 @@ indicates failure. File: coreutils.info, Node: rm invocation, Next: shred invocation, Prev: mv invocation, Up: Basic operations -11.5 `rm': Remove files or directories +11.5 ‘rm’: Remove files or directories ====================================== -`rm' removes each given FILE. By default, it does not remove +‘rm’ removes each given FILE. By default, it does not remove directories. Synopsis: - rm [OPTION]... [FILE]... + 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 + 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 +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. + Any attempt to remove a file whose last file name component is ‘.’ or +‘..’ is rejected without any prompting, as mandated by POSIX. - _Warning_: If you use `rm' to remove a file, it is usually possible + _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 contents are truly unrecoverable, consider using ‘shred’. - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-f' -`--force' - Ignore nonexistent files and never prompt the user. Ignore any - previous `--interactive' (`-i') option. +‘-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' +‘-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'. + affirmative, the file is skipped. Ignore any previous ‘--force’ + (‘-f’) option. Equivalent to ‘--interactive=always’. -`-I' +‘-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'. + previous ‘--force’ (‘-f’) option. Equivalent to + ‘--interactive=once’. -`--interactive [=WHEN]' +‘--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'. - Specifying `--interactive' and no WHEN is equivalent to - `--interactive=always'. - -`--one-file-system' + • 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, + 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 + 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. + 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 +‘--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' +‘-r’ +‘-R’ +‘--recursive’ Remove the listed directories and their contents recursively. -`-v' -`--verbose' +‘-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 +‘-’. 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 @@ -6426,8 +7459,8 @@ or: rm ./-f - The Unix `rm' program's use of a single `-' for this purpose -predates the development of the getopt standard syntax. + 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. @@ -6435,73 +7468,73 @@ indicates failure. File: coreutils.info, Node: shred invocation, Prev: rm invocation, Up: Basic operations -11.6 `shred': Remove files more securely +11.6 ‘shred’: Remove files more securely ======================================== -`shred' overwrites devices or files, to help prevent even very -expensive hardware from recovering the data. +‘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. +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. +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 +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. +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' +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). +California, July 22–25, 1996). - *Please note* that `shred' relies on a very important assumption: + *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 + • 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 + ‘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 + • 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 + • 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. + • File systems that cache in temporary locations, such as NFS version + 3 clients. - * Compressed file systems. + • 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). +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 @@ -6511,81 +7544,90 @@ cannot reliably operate on regular files in your file system. 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. +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 + ‘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 +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[...] + shred [OPTION]… FILE[…] - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-f' -`--force' +‘-f’ +‘--force’ Override file permissions if necessary to allow overwriting. -`-NUMBER' -`-n NUMBER' -`--iterations=NUMBER' - By default, `shred' uses 25 passes of overwrite. This is enough - for all of the useful overwrite patterns to be used at least once. - You can reduce this to save time, or increase it if you have a lot - of time to waste. +‘-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::. +‘--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' +‘-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::. + ‘K’, ‘M’, or ‘G’ to specify a multiple. *Note Block size::. -`-u' -`--remove' +‘-u’ +‘--remove[=HOW]’ 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 status updates as sterilization proceeds. - -`-x' -`--exact' - By default, `shred' rounds the size of a regular file up to the + removed. Often the file name is less sensitive than the file data, + in which case the optional HOW parameter, supported with the long + form option, gives control of how to more efficiently remove each + directory entry. The ‘unlink’ parameter will just use a standard + unlink call, ‘wipe’ will also first obfuscate bytes in the name, + and ‘wipesync’ will also sync each obfuscated byte in the name to + disk. Note ‘wipesync’ is the default method, but can be expensive, + requiring a sync for every character in every file. This can + become significant with many files, or is redundant if your file + system provides synchronous metadata updates. + +‘-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 + slack space in the last block of the file. This space may contain + portions of the current system memory on some systems for example. + 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 + 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. - + 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) +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 @@ -6595,20 +7637,32 @@ disk, you could give a command like this: shred --verbose /dev/sda5 - A FILE of `-' denotes standard output. The intended use of this is + 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=`tempfile -m 0600` + 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. + 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. @@ -6620,19 +7674,19 @@ File: coreutils.info, Node: Special file types, Next: Changing file attributes ********************* This chapter describes commands which create special types of files (and -`rmdir', which removes directories, one special file type). +‘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 +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. +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". +(FIFOs), symbolic links, sockets, and so-called “special files”. * Menu: @@ -6641,31 +7695,36 @@ on the bytes of the file. Thus it is a "special" type of file. * mkdir invocation:: Make directories. * mkfifo invocation:: Make FIFOs (named pipes). * mknod invocation:: Make block or character special files. -* readlink invocation:: Print the referent of a symbolic link. +* readlink invocation:: Print value of a symlink or canonical file name. * rmdir invocation:: Remove empty directories. * unlink invocation:: Remove files via the unlink syscall File: coreutils.info, Node: link invocation, Next: ln invocation, Up: Special file types -12.1 `link': Make a hard link via the link syscall +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’ creates a single hard link at a time. It is a minimalist +interface to the system-provided ‘link’ function. *Note (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. +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. - 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. @@ -6673,119 +7732,188 @@ indicates failure. File: coreutils.info, Node: ln invocation, Next: mkdir invocation, Prev: link invocation, Up: Special file types -12.2 `ln': Make links between files +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’ 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... + 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 + • 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 + • 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. + • 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. - 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 + 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. -On all existing implementations, you cannot make a hard link to a -directory, and 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 +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. *Note Symbolic Links: -(libc)Symbolic Links. - - The program accepts the following options. Also see *Note Common +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 (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]' +‘-b’ +‘--backup[=METHOD]’ *Note Backup options::. Make a backup of each file that would otherwise be overwritten or removed. -`-d' -`-F' -`--directory' +‘-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' +‘-f’ +‘--force’ Remove existing destination files. -`-i' -`--interactive' +‘-i’ +‘--interactive’ Prompt whether to remove existing destination files. -`-n' -`--no-dereference' +‘-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 + 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') + This option is weaker than the ‘--no-target-directory’ (‘-T’) option, so it has no effect if both options are given. -`-s' -`--symbolic' +‘-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' + + Relative symbolic links are generated based on their canonicalized + containing directory, and canonicalized targets. I.e., all + symbolic links in these file names will be resolved. *Note + realpath invocation::, which gives greater control over relative + file name generation, as demonstrated in the following example: + + ln--relative() { + test "$1" = --no-symlinks && { nosym=$1; shift; } + target="$1"; + test -d "$2" && link="$2/." || link="$2" + rtarget="$(realpath $nosym -m "$target" \ + --relative-to "$(dirname "$link")")" + ln -s -v "$rtarget" "$link" + } + +‘-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 +‘-S SUFFIX’ +‘--suffix=SUFFIX’ + Append SUFFIX to each backup file made with ‘-b’. *Note Backup options::. -`-t DIRECTORY' -`--target-directory=DIRECTORY' +‘-t DIRECTORY’ +‘--target-directory=DIRECTORY’ Specify the destination DIRECTORY. *Note Target directory::. -`-T' -`--no-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' +‘-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. @@ -6819,56 +7947,65 @@ indicates failure. File: coreutils.info, Node: mkdir invocation, Next: mkfifo invocation, Prev: ln invocation, Up: Special file types -12.3 `mkdir': Make directories +12.3 ‘mkdir’: Make directories ============================== -`mkdir' creates directories with the specified names. Synopsis: +‘mkdir’ creates directories with the specified names. Synopsis: - mkdir [OPTION]... NAME... + 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 + ‘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 + The program accepts the following options. Also see *note Common options::. -`-m MODE' -`--mode=MODE' +‘-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 + 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. + 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' +‘-p’ +‘--parents’ Make any missing parent directories for each argument, setting - their file permission bits to the umask modified by `u+wx'. Ignore + 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'. + 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' +‘-v’ +‘--verbose’ Print a message for each created directory. This is most useful - with `--parents'. + with ‘--parents’. + +‘-Z’ +‘--context[=CONTEXT]’ + Without a specified CONTEXT, adjust the SELinux security context + according to the system default type for destination files, + similarly to the ‘restorecon’ command. The long form of this + option with a specific context specified, will set the context for + newly created files only. With a specified context, if both + SELinux and SMACK are disabled, a warning is issued. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -6876,29 +8013,37 @@ indicates failure. File: coreutils.info, Node: mkfifo invocation, Next: mknod invocation, Prev: mkdir invocation, Up: Special file types -12.4 `mkfifo': Make FIFOs (named pipes) +12.4 ‘mkfifo’: Make FIFOs (named pipes) ======================================= -`mkfifo' creates FIFOs (also called "named pipes") with the specified +‘mkfifo’ creates FIFOs (also called “named pipes”) with the specified names. Synopsis: - mkfifo [OPTION] NAME... + 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. + 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 + The program accepts the following options. Also see *note Common options::. -`-m MODE' -`--mode=MODE' +‘-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 + ‘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]’ + Without a specified CONTEXT, adjust the SELinux security context + according to the system default type for destination files, + similarly to the ‘restorecon’ command. The long form of this + option with a specific context specified, will set the context for + newly created files only. With a specified context, if both + SELinux and SMACK are disabled, a warning is issued. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -6906,50 +8051,62 @@ indicates failure. File: coreutils.info, Node: mknod invocation, Next: readlink invocation, Prev: mkfifo invocation, Up: Special file types -12.5 `mknod': Make block or character special files +12.5 ‘mknod’: Make block or character special files =================================================== -`mknod' creates a FIFO, character special file, or block special file +‘mknod’ creates a FIFO, character special file, or block special file with the specified name. Synopsis: - mknod [OPTION]... NAME TYPE [MAJOR MINOR] + mknod [OPTION]… NAME TYPE [MAJOR MINOR] - Unlike the phrase "special file type" above, the term "special file" + 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 +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. +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' +‘p’ for a FIFO -`b' +‘b’ for a block special file -`c' +‘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 +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 + The program accepts the following options. Also see *note Common options::. -`-m MODE' -`--mode=MODE' +‘-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 + ‘chmod’ and uses ‘a=rw’ as the point of departure. MODE should specify only file permission bits. *Note File permissions::. +‘-Z’ +‘--context[=CONTEXT]’ + Without a specified CONTEXT, adjust the SELinux security context + according to the system default type for destination files, + similarly to the ‘restorecon’ command. The long form of this + option with a specific context specified, will set the context for + newly created files only. With a specified context, if both + SELinux and SMACK are disabled, a warning is issued. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -6957,63 +8114,75 @@ indicates failure. File: coreutils.info, Node: readlink invocation, Next: rmdir invocation, Prev: mknod invocation, Up: Special file types -12.6 `readlink': Print the referent of a symbolic link -====================================================== +12.6 ‘readlink’: Print value of a symlink or canonical file name +================================================================ -`readlink' may work in one of two supported modes: +‘readlink’ may work in one of two supported modes: -`Readlink mode' - `readlink' outputs the value of the given symbolic link. If - `readlink' is invoked with an argument other than the name of a +‘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 file which - contains no `.', `..' components nor any repeated separators (`/') - or symbolic links. +‘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 + readlink [OPTION]… FILE… - By default, `readlink' operates in readlink mode. + By default, ‘readlink’ operates in readlink mode. - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-f' -`--canonicalize' +‘-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. + 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' +‘-e’ +‘--canonicalize-existing’ Activate canonicalize mode. If any component is missing or - unavailable, `readlink' produces no output and exits with a - nonzero exit code. + 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' +‘-m’ +‘--canonicalize-missing’ Activate canonicalize mode. If any component is missing or - unavailable, `readlink' treats it as a directory. + unavailable, ‘readlink’ treats it as a directory. -`-n' -`--no-newline' - Do not output the trailing newline. +‘-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' +‘-s’ +‘-q’ +‘--silent’ +‘--quiet’ Suppress most error messages. -`-v' -`--verbose' +‘-v’ +‘--verbose’ Report error messages. +‘-z’ +‘--zero’ + 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 + even when that output would contain data with embedded newlines. + + The ‘readlink’ utility first appeared in OpenBSD 2.1. - 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. @@ -7021,38 +8190,37 @@ indicates failure. File: coreutils.info, Node: rmdir invocation, Next: unlink invocation, Prev: readlink invocation, Up: Special file types -12.7 `rmdir': Remove empty directories +12.7 ‘rmdir’: Remove empty directories ====================================== -`rmdir' removes empty directories. Synopsis: +‘rmdir’ removes empty directories. Synopsis: - rmdir [OPTION]... DIRECTORY... + rmdir [OPTION]… DIRECTORY… If any DIRECTORY argument does not refer to an existing empty directory, it is an error. - The program accepts the following option. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`--ignore-fail-on-non-empty' +‘--ignore-fail-on-non-empty’ Ignore each failure to remove a directory that is solely because the directory is non-empty. -`-p' -`--parents' +‘-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' + 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). @@ -7062,24 +8230,24 @@ indicates failure. File: coreutils.info, Node: unlink invocation, Prev: rmdir invocation, Up: Special file types -12.8 `unlink': Remove files via the unlink syscall +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’ deletes a single specified file name. It is a minimalist +interface to the system-provided ‘unlink’ function. *Note +(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 + 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 +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'. + 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. @@ -7091,32 +8259,32 @@ File: coreutils.info, Node: Changing file attributes, Next: Disk usage, Prev: *************************** 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". +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. * Menu: +* chown invocation:: Change file owners and groups. * chgrp invocation:: Change file groups. * chmod invocation:: Change access permissions. -* chown invocation:: Change file owners and groups. * touch invocation:: Change file timestamps. -File: coreutils.info, Node: chown invocation, Next: touch invocation, Prev: chmod invocation, Up: Changing file attributes +File: coreutils.info, Node: chown invocation, Next: chgrp invocation, Up: Changing file attributes -13.1 `chown': Change file owner and group +13.1 ‘chown’: Change file owner and group ========================================= -`chown' changes the user and/or group ownership of each given FILE to +‘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... + 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): @@ -7127,76 +8295,79 @@ Synopsis: 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 + user is made the owner of each given file, and the files’ group is not changed. -OWNER`:'GROUP +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). + numeric group ID), with no spaces between them, the group ownership + of the files is changed as well (to GROUP). -OWNER`:' +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. + owner of the files and the group of the files is changed to OWNER’s + login group. -`:'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'. + ‘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 +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. + 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 `.'. +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 + It is system dependent whether a user can change the group to an +arbitrary one, or the more portable behavior of being restricted to +setting a group of which the user is a member. + + 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 +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' +‘-c’ +‘--changes’ Verbosely describe the action for each FILE whose ownership actually changes. -`-f' -`--silent' -`--quiet' +‘-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 +‘--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 + 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 + 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: @@ -7208,59 +8379,58 @@ options::. chown -h -R --from=OLDUSER NEWUSER / -`--dereference' +‘--dereference’ Do not act on symbolic links themselves but rather on what they point to. This is the default. -`-h' -`--no-dereference' +‘-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 + 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'. + recursive traversal, but see ‘--verbose’. -`--preserve-root' +‘--preserve-root’ Fail upon any attempt to recursively change the root directory, - `/'. Without `--recursive', this option has no effect. *Note + ‘/’. 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::. +‘--no-preserve-root’ + Cancel the effect of any preceding ‘--preserve-root’ option. *Note + Treating / specially::. -`--reference=REF_FILE' +‘--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' +‘-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 + 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' +‘-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 +‘-H’ + If ‘--recursive’ (‘-R’) is specified and a command line argument is + a symbolic link to a directory, traverse it. *Note Traversing symlinks::. -`-L' +‘-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::. - +‘-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. @@ -7277,87 +8447,90 @@ indicates failure. chown -hR root /u -File: coreutils.info, Node: chgrp invocation, Next: chmod invocation, Up: Changing file attributes +File: coreutils.info, Node: chgrp invocation, Next: chmod invocation, Prev: chown invocation, Up: Changing file attributes -13.2 `chgrp': Change group ownership +13.2 ‘chgrp’: Change group ownership ==================================== -`chgrp' changes the group ownership of each given FILE to GROUP (which +‘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: +existing reference file. *Note chown invocation::. Synopsis: - chgrp [OPTION]... {GROUP | --reference=REF_FILE} FILE... + 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::. +specify it with a leading ‘+’. *Note Disambiguating names and IDs::. + + It is system dependent whether a user can change the group to an +arbitrary one, or the more portable behavior of being restricted to +setting a group of which the user is a member. - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-c' -`--changes' +‘-c’ +‘--changes’ Verbosely describe the action for each FILE whose group actually changes. -`-f' -`--silent' -`--quiet' +‘-f’ +‘--silent’ +‘--quiet’ Do not print error messages about files whose group cannot be changed. -`--dereference' +‘--dereference’ Do not act on symbolic links themselves but rather on what they point to. This is the default. -`-h' -`--no-dereference' +‘-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 + 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'. + recursive traversal, but see ‘--verbose’. -`--preserve-root' +‘--preserve-root’ Fail upon any attempt to recursively change the root directory, - `/'. Without `--recursive', this option has no effect. *Note + ‘/’. 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::. +‘--no-preserve-root’ + Cancel the effect of any preceding ‘--preserve-root’ option. *Note + Treating / specially::. -`--reference=REF_FILE' +‘--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' +‘-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 + 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' +‘-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 +‘-H’ + If ‘--recursive’ (‘-R’) is specified and a command line argument is + a symbolic link to a directory, traverse it. *Note Traversing symlinks::. -`-L' +‘-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::. - +‘-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. @@ -7371,185 +8544,228 @@ indicates failure. chgrp -hR staff /u -File: coreutils.info, Node: chmod invocation, Next: chown invocation, Prev: chgrp invocation, Up: Changing file attributes +File: coreutils.info, Node: chmod invocation, Next: touch invocation, Prev: chgrp invocation, Up: Changing file attributes -13.3 `chmod': Change access permissions +13.3 ‘chmod’: Change access permissions ======================================= -`chmod' changes the access permissions of the named files. Synopsis: +‘chmod’ changes the access permissions of the named files. Synopsis: - chmod [OPTION]... {MODE | --reference=REF_FILE} FILE... + 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 + ‘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' +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 + 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 +‘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. + 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 + The program accepts the following options. Also see *note Common options::. -`-c' -`--changes' +‘-c’ +‘--changes’ Verbosely describe the action for each FILE whose permissions actually changes. -`-f' -`--silent' -`--quiet' +‘-f’ +‘--silent’ +‘--quiet’ Do not print error messages about files whose permissions cannot be changed. -`--preserve-root' +‘--preserve-root’ Fail upon any attempt to recursively change the root directory, - `/'. Without `--recursive', this option has no effect. *Note + ‘/’. 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::. +‘--no-preserve-root’ + Cancel the effect of any preceding ‘--preserve-root’ option. *Note + Treating / specially::. -`-v' -`--verbose' +‘-v’ +‘--verbose’ Verbosely describe the action or non-action taken for every FILE. -`--reference=REF_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' +‘-R’ +‘--recursive’ Recursively change permissions of directories and their contents. - An exit status of zero indicates success, and a nonzero value indicates failure. -File: coreutils.info, Node: touch invocation, Prev: chown invocation, Up: Changing file attributes +File: coreutils.info, Node: touch invocation, Prev: chmod invocation, Up: Changing file attributes -13.4 `touch': Change file timestamps +13.4 ‘touch’: Change file timestamps ==================================== -`touch' changes the access and/or modification times of the specified +‘touch’ changes the access and/or modification times of the specified files. Synopsis: - touch [OPTION]... FILE... - - Any FILE that does not exist is created empty. - - A FILE of `-' causes `touch' to change the times of the file -associated with standard output. - - If changing both the access and modification times to the current -time, `touch' can change the timestamps for files that the user running -it does not own but has write permission for. Otherwise, the user must -own the files. - - Although `touch' provides options for changing two of the times--the -times of last access and modification--of a file, there is actually a -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 + 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. +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. + 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 + The program accepts the following options. Also see *note Common options::. -`-a' -`--time=atime' -`--time=access' -`--time=use' +‘-a’ +‘--time=atime’ +‘--time=access’ +‘--time=use’ Change the access time only. -`-c' -`--no-create' - Do not create files that do not exist. +‘-c’ +‘--no-create’ + Do not warn about or create files that do not exist. -`-d' -`--date=TIME' +‘-d TIME’ +‘--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 + 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 + 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'. - -`-m' -`--time=mtime' -`--time=modify' +‘-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' +‘-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'. - -`-t [[CC]YY]MMDDHHMM[.SS]' + 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 older systems, `touch' supports an obsolete syntax, as follows. -If no timestamp is given with any of the `-d', `-r', or `-t' options, + 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'. +‘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. @@ -7569,371 +8785,522 @@ status information, and write buffers to disk. * df invocation:: Report file system disk space usage. * du invocation:: Estimate file space usage. * stat invocation:: Report file or file system status. -* sync invocation:: Synchronize memory and disk. +* sync invocation:: Synchronize cached writes to persistent storage. +* truncate invocation:: Shrink or extend the size of a file. File: coreutils.info, Node: df invocation, Next: du invocation, Up: Disk usage -14.1 `df': Report file system disk space usage +14.1 ‘df’: Report file system disk space usage ============================================== -`df' reports the amount of disk space used and available on file +‘df’ reports the amount of disk space used and available on file systems. Synopsis: - df [OPTION]... [FILE]... + 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 + 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. - 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 + 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 pseudo +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 resolves to a special 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. 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. - -`-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. - Use the `--si' option if you prefer powers of 1000. - -`-H' - Equivalent to `--si'. - -`-i' -`--inodes' +‘-a’ +‘--all’ + Include in the listing dummy, duplicate, or inaccessible file + systems, which are omitted by default. Dummy file systems are + typically special purpose pseudo file systems such as ‘/proc’, with + no associated storage. Duplicate file systems are local or remote + file systems that are mounted at separate locations in the local + file hierarchy, or bind mounted locations. Inaccessible file + systems are those which are mounted but subsequently over-mounted + by another file system at that point, or otherwise inaccessible due + to permissions of the mount point etc. + +‘-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. + +‘-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' +‘-k’ Print sizes in 1024-byte blocks, overriding the default block size (*note Block size::). This option is equivalent to - `--block-size=1K'. + ‘--block-size=1K’. -`-l' -`--local' +‘-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 +‘--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. -`-P' -`--portability' +‘--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. + + ‘file’ + The file name if specified on the command line. + ‘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 split 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 + 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. + 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 + ‘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, + 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 +‘--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 +‘--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, + results, but in general this option makes ‘df’ much slower, especially when there are many or very busy file systems. -`-t FSTYPE' -`--type=FSTYPE' +‘--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. If no arguments are + specified df will try harder to elide file systems insignificant to + the total available space, by suppressing duplicate remote file + systems. + + 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. + +‘-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 + 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): +‘-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' + ‘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...' + ‘ext2, ext3, ext4, xfs, btrfs…’ 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. + ‘iso9660, cdfs’ + A file system on a CD or DVD drive. HP-UX uses ‘cdfs’, most + other systems use ‘iso9660’. + ‘ntfs,fat’ + File systems used by MS-Windows / MS-DOS. -`-x FSTYPE' -`--exclude-type=FSTYPE' +‘-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' + 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'. +‘-v’ + Ignored; for compatibility with System V versions of ‘df’. + ‘df’ is installed only on systems that have usable mount tables, so +portable scripts should not rely on its existence. 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'. +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. File: coreutils.info, Node: du invocation, Next: stat invocation, Prev: df invocation, Up: Disk usage -14.2 `du': Estimate file space usage +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’ reports the amount of disk space used by the set of specified files +and for each subdirectory (of directory arguments). Synopsis: - du [OPTION]... [FILE]... + du [OPTION]… [FILE]… - With no arguments, `du' reports the disk space for the current + 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. +but this can be overridden (*note Block size::). Non-integer quantities +are rounded up to the next higher unit. - The program accepts the following options. Also see *Note Common + 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 and +entries that ‘du’ outputs. + + The program accepts the following options. Also see *note Common options::. -`-a' -`--all' +‘-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 + 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: +‘--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' -`--bytes' - Equivalent to `--apparent-size --block-size=1'. +‘-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 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' +‘-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' +‘-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 + the disk usage of directories, such as ‘/usr/tmp’, which are often symbolic links. -`--files0-from=FILE' - Rather than processing files named on the command line, process - those named in file FILE; each name is terminated by a null byte. - This is useful with the `--total' (`-c') option 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 a - total for each sublist rather than for the entire list. One way - to produce a list of null-byte-terminated file names is with GNU - `find', using its `-print0' predicate. Do not specify any FILE on - the command line when using this option. - -`-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. - Use the `--si' option if you prefer powers of 1000. - -`-H' - Currently, `-H' is the same as `--si', except that `-H' evokes a - warning. This option will be changed to be equivalent to - `--dereference-args' (`-D'). - -`-k' +‘-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. + +‘--inodes’ + List inode usage information instead of block usage. This option + is useful for finding directories which contain many files, and + therefore eat up most of the inodes space of a file system (see + ‘df’, option ‘--inodes’). It can well be combined with the options + ‘-a’, ‘-c’, ‘-h’, ‘-l’, ‘-s’, ‘-S’, ‘-t’ and ‘-x’; however, passing + other options regarding the block size, for example ‘-b’, ‘-m’ and + ‘--apparent-size’, is ignored. + +‘-k’ Print sizes in 1024-byte blocks, overriding the default block size (*note Block size::). This option is equivalent to - `--block-size=1K'. + ‘--block-size=1K’. -`-l' -`--count-links' - Count the size of all files, even if they have appeared already - (as a hard link). +‘-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' -`--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' +‘-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'. + ‘--block-size=1M’. -`-P' -`--no-dereference' - For each symbolic links encountered by `du', consider the disk +‘-P’ +‘--no-dereference’ + For each symbolic links encountered by ‘du’, consider the disk space used by the symbolic link. -`--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'. - -`-0' -`--null' - Output a null byte 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 file names with embedded - newlines. - -`--si' - Append an SI-style abbreviation to each size, such as `MB' for - megabytes. Powers of 1000 are used, not 1024; `MB' stands for - 1,000,000 bytes. Use the `-h' or `--human-readable' option if you - prefer powers of 1024. - -`-s' -`--summarize' +‘-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, + will exclude the size of any subdirectories. + +‘--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. -`-S' -`--separate-dirs' - Report the size of each directory separately, not including the - sizes of subdirectories. +‘-t SIZE’ +‘--threshold=SIZE’ + Exclude entries based on a given SIZE. The SIZE refers to used + blocks in normal mode (*note Block size::), or inodes count in + conjunction with the ‘--inodes’ option. + + 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. + + Please note that the ‘--threshold’ option can be combined with the + ‘--inodes’ option, and in this case would elide entries based on + its inodes count. + + 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' + Here’s how you would use ‘--threshold’ to find directories on the + root file system with more than 20000 inodes used in the directory + tree below: + + du --inodes -x --threshold=20000 / + +‘--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) +‘--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 +‘--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' +‘--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 ‘--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. + ‘+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' + ‘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' -`--one-file-system' - Skip directories that are on different file systems from the one - that the argument being processed is on. - -`--exclude=PATTERN' - When recursing, skip subdirectories or files matching PATTERN. - For example, `du --exclude='*.o'' excludes files whose names end - in `.o'. - -`-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 + zone components 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 components with minute precision, + 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’. - 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 +‘-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. +affects the HP-UX ‘du’ program. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -7941,160 +9308,274 @@ indicates failure. File: coreutils.info, Node: stat invocation, Next: sync invocation, Prev: du invocation, Up: Disk usage -14.3 `stat': Report file or file system status +14.3 ‘stat’: Report file or file system status ============================================== -`stat' displays information about the specified file(s). Synopsis: +‘stat’ displays information about the specified file(s). Synopsis: - stat [OPTION]... [FILE]... + stat [OPTION]… [FILE]… - With no option, `stat' reports all information about the given files. + 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. +the given files are located on. If the files are links, ‘stat’ can also +give information about the files the links point to. -`-L' -`--dereference' - Change how `stat' treats symbolic links. With this option, `stat' + 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. - -`-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: + 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': +‘--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' +‘-t’ +‘--terse’ Print the information in terse form, suitable for parsing by other programs. - The valid format sequences for files 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' - - * %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 - - * %n - File name - - * %N - Quoted file name with dereference if symbolic link + The output of the following commands are identical and the + ‘--format’ also identifies the items printed (in fuller form) in + the default format. Note the format string would include another + ‘%C’ at the end with an active SELinux security context. + $ stat --format="%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o" ... + $ stat --terse ... + + The same illustrating terse output in ‘--file-system’ mode: + $ stat -f --format="%n %i %l %t %s %S %b %f %a %c %d" ... + $ stat -f --terse ... + + The valid FORMAT directives for files with ‘--format’ and ‘--printf’ +are: + + • %a - Access rights in octal (note ‘#’ and ‘0’ printf flags) + • %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 (see below) + • %T - Minor device type in hex (see below) + • %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 data modification + • %Y - Time of last data modification as seconds since Epoch + • %z - Time of last status change + • %Z - Time of last status change as seconds since Epoch + + The ‘%a’ format prints the octal mode, and so it is useful to control +the zero padding of the output with the ‘#’ and ‘0’ printf flags. For +example to pad to at least 3 wide while making larger numbers +unambiguously octal, you can use ‘%#03a’. + + The ‘%t’ and ‘%T’ formats operate on the st_rdev member of the +stat(2) structure, and are only defined for character and block special +files. On some systems or file types, st_rdev may be used to represent +other quantities. + + 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 - * %o - I/O block size - - * %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 - - * %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 valid format sequences for file systems are: - - * %a - Free blocks available to non-super-user - - * %b - Total data blocks in file system + 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. - * %c - Total file nodes in file system + An exit status of zero indicates success, and a nonzero value +indicates failure. - * %d - Free file nodes in file system + +File: coreutils.info, Node: sync invocation, Next: truncate invocation, Prev: stat invocation, Up: Disk usage - * %f - Free blocks in file system +14.4 ‘sync’: Synchronize cached writes to persistent storage +============================================================ - * %i - File System ID in hex +‘sync’ synchronizes in memory files or file systems to persistent +storage. Synopsis: - * %l - Maximum length of file names + sync [OPTION] [FILE]… - * %n - File name + ‘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’, ‘syncfs’, +‘fsync’, and ‘fdatasync’ system calls. - * %s - Block size (for faster transfers) + 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 instructs the kernel to write data in memory to +persistent storage. + + If any argument is specified then only those files will be +synchronized using the fsync(2) syscall by default. + + If at least one file is specified, it is possible to change the +synchronization method with the following options. Also see *note +Common options::. + +‘-d’ +‘--data’ + Use fdatasync(2) to sync only the data for the file, and any + metadata required to maintain file system consistency. + +‘-f’ +‘--file-system’ + Synchronize all the I/O waiting for the file systems that contain + the file, using the syscall syncfs(2). Note you would usually + _not_ specify this option if passing a device node like ‘/dev/sda’ + for example, as that would sync the containing file system rather + than the referenced one. Note also that depending on the system, + passing individual device nodes or files may have different sync + characteristics than using no arguments. I.e., arguments passed to + fsync(2) may provide greater guarantees through write barriers, + than a global sync(2) used when no arguments are provided. - * %S - Fundamental block size (for block counts) + An exit status of zero indicates success, and a nonzero value +indicates failure. - * %t - Type in hex + +File: coreutils.info, Node: truncate invocation, Prev: sync invocation, Up: Disk usage - * %T - Type in human readable form +14.5 ‘truncate’: Shrink or extend the size of a file +==================================================== - 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. +‘truncate’ shrinks or extends the size of each FILE to the specified +size. Synopsis: - An exit status of zero indicates success, and a nonzero value -indicates failure. + truncate OPTION… FILE… - -File: coreutils.info, Node: sync invocation, Prev: stat invocation, Up: Disk usage + Any FILE that does not exist is created. -14.4 `sync': Synchronize data on disk with memory -================================================= + 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. -`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 program accepts the following options. Also see *note Common +options::. - 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. +‘-c’ +‘--no-create’ + Do not create files that do not exist. - Any arguments are ignored, except for a lone `--help' or `--version' -(*note Common options::). +‘-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 is in + bytes unless ‘--io-blocks’ is specified. 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 its 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. @@ -8116,80 +9597,77 @@ This section describes commands that display text strings. File: coreutils.info, Node: echo invocation, Next: printf invocation, Up: Printing text -15.1 `echo': Print a line of text +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’ writes each given STRING to standard output, with a space between +each and a newline after the last one. Synopsis: + + echo [OPTION]… [STRING]… - 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 + 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 +argument ‘--’ has no special meaning and is treated like any other STRING. -`-n' +‘-n’ Do not output the trailing newline. -`-e' - Enable interpretation of the following backslash-escaped - characters in each STRING: +‘-e’ + Enable interpretation of the following backslash-escaped characters + in each STRING: - `\a' + ‘\a’ alert (bell) - - `\b' + ‘\b’ backspace - - `\c' - suppress trailing newline - - `\f' + ‘\c’ + produce no further output + ‘\e’ + escape + ‘\f’ form feed - - `\n' - new line - - `\r' + ‘\n’ + newline + ‘\r’ carriage return - - `\t' + ‘\t’ horizontal tab - - `\v' + ‘\v’ vertical tab - - `\\' + ‘\\’ backslash - - `\0NNN' + ‘\0NNN’ the eight-bit value that is the octal number NNN (zero to - three octal digits) - - `\NNN' - the eight-bit value that is the octal number NNN (one to - three octal digits) - - `\xHH' + 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' +‘-E’ Disable interpretation of backslash escapes in each STRING. This - is the default. If `-e' and `-E' are both specified, the last one + 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'. + 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 +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 @@ -8198,97 +9676,113 @@ indicates failure. File: coreutils.info, Node: printf invocation, Next: yes invocation, Prev: echo invocation, Up: Printing text -15.2 `printf': Format and print data +15.2 ‘printf’: Format and print data ==================================== -`printf' does formatted printing of text. Synopsis: +‘printf’ does formatted printing of text. Synopsis: - printf FORMAT [ARGUMENT]... + 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. The differences are as -follows: + ‘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. - * The FORMAT argument is reused as necessary to convert all the - given ARGUMENTs. For example, the command `printf %s a b' outputs - `ab'. + 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. - * Missing ARGUMENTs are treated as null strings or as zeros, + • 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'. + 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'. + • 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 + • 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 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 + example, the command ‘printf '\x07e'’ prints two bytes, whereas the + C statement ‘printf ("\x07e")’ prints just one. + + • An additional directive ‘%b’, 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. + + • An additional directive ‘%q’, prints its argument string in a + format that can be reused as input by most shells. Non-printable + characters are escaped with the POSIX proposed ‘$''’ syntax, and + shell metacharacters are quoted appropriately. This is an + equivalent format to ‘ls --quoting=shell-escape’ output. + + • 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. - + ‘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 +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. +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 character to print, and `\xHH' as a + ‘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. - - `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. - - 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 +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 - $ /usr/local/bin/printf '\u20AC 14.95' + $ 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 - $ /usr/local/bin/printf '\u4e2d\u6587' + $ env printf '\u4e2d\u6587' will be output correctly in all Chinese locales (GB2312, BIG5, UTF-8, etc). - Note that in these examples, the full name of `printf' has been -given, to distinguish it from the GNU `bash' built-in function `printf'. + 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 + 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. @@ -8307,18 +9801,18 @@ indicates failure. File: coreutils.info, Node: yes invocation, Prev: printf invocation, Up: Printing text -15.3 `yes': Print a string until interrupted +15.3 ‘yes’: Print a string until interrupted ============================================ -`yes' prints the command line arguments, separated by spaces and +‘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. +given, it prints ‘y’ followed by a newline forever until killed. - Upon a write error, `yes' exits with status `1'. + 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::. + 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::. File: coreutils.info, Node: Conditions, Next: Redirection, Prev: Printing text, Up: Top @@ -8328,7 +9822,7 @@ File: coreutils.info, Node: Conditions, Next: Redirection, Prev: Printing tex 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 +condition of shell ‘if’ statements, or as the last command in a pipeline. * Menu: @@ -8341,44 +9835,44 @@ pipeline. File: coreutils.info, Node: false invocation, Next: true invocation, Up: Conditions -16.1 `false': Do nothing, unsuccessfully +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 +‘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. + ‘false’ honors the ‘--help’ and ‘--version’ options. - This version of `false' is implemented as a C program, and is thus + 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'. + 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' + Portable programs should not assume that the exit status of ‘false’ is 1, as it is greater than 1 on some non-GNU hosts. File: coreutils.info, Node: true invocation, Next: test invocation, Prev: false invocation, Up: Conditions -16.2 `true': Do nothing, successfully +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 +‘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. + ‘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 + 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: @@ -8387,28 +9881,28 @@ I/O error. For example, using a Bourne-compatible shell: $ ./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 + 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. File: coreutils.info, Node: test invocation, Next: expr invocation, Prev: true invocation, Up: Conditions -16.3 `test': Check file types and compare values +16.3 ‘test’: Check file types and compare values ================================================ -`test' returns a status of 0 (true) or 1 (false) depending on the +‘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 + ‘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 + ‘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: @@ -8419,16 +9913,17 @@ form is discussed below. [ ] [ OPTION - Because most shells have a built-in `test' command, using an -unadorned `test' in a script or interactively may get you different -functionality than that described here. - - 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 + 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: @@ -8442,7 +9937,7 @@ brackets. *Note Common options::. * File type tests:: -[bcdfhLpSt] * Access permission tests:: -[gkruwxOG] * File characteristic tests:: -e -s -nt -ot -ef -* String tests:: -z -n = != +* String tests:: -z -n = == != * Numeric tests:: -eq -ne -lt -le -gt -ge * Connectives for test:: ! -a -o @@ -8452,37 +9947,36 @@ File: coreutils.info, Node: File type tests, Next: Access permission tests, U 16.3.1 File type tests ---------------------- -These options test for particular types of files. (Everything's a file, +These options test for particular types of files. (Everything’s a file, but not all files are the same!) -`-b FILE' +‘-b FILE’ True if FILE exists and is a block special device. -`-c FILE' +‘-c FILE’ True if FILE exists and is a character special device. -`-d FILE' +‘-d FILE’ True if FILE exists and is a directory. -`-f FILE' +‘-f FILE’ True if FILE exists and is a regular file. -`-h FILE' -`-L 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' +‘-p FILE’ True if FILE exists and is a named pipe. -`-S FILE' +‘-S FILE’ True if FILE exists and is a socket. -`-t FD' +‘-t FD’ True if FD is a file descriptor that is associated with a terminal. - File: coreutils.info, Node: Access permission tests, Next: File characteristic tests, Prev: File type tests, Up: test invocation @@ -8491,32 +9985,31 @@ File: coreutils.info, Node: Access permission tests, Next: File characteristic These options test for particular access permissions. -`-g FILE' +‘-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. +‘-k FILE’ + True if FILE exists and has its “sticky” bit set. -`-r FILE' +‘-r FILE’ True if FILE exists and read permission is granted. -`-u FILE' +‘-u FILE’ True if FILE exists and has its set-user-ID bit set. -`-w FILE' +‘-w FILE’ True if FILE exists and write permission is granted. -`-x FILE' +‘-x FILE’ True if FILE exists and execute permission is granted (or search permission, if it is a directory). -`-O FILE' +‘-O FILE’ True if FILE exists and is owned by the current effective user ID. -`-G FILE' +‘-G FILE’ True if FILE exists and is owned by the current effective group ID. - File: coreutils.info, Node: File characteristic tests, Next: String tests, Prev: Access permission tests, Up: test invocation @@ -8525,52 +10018,53 @@ File: coreutils.info, Node: File characteristic tests, Next: String tests, Pr These options test other file characteristics. -`-e FILE' +‘-e FILE’ True if FILE exists. -`-s FILE' +‘-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 -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 -ot FILE2’ + True if FILE1 is older (according to modification date) than FILE2, + or if FILE2 exists and FILE1 does not. -`FILE1 -ef FILE2' +‘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. - File: coreutils.info, Node: String tests, Next: Numeric tests, Prev: File characteristic tests, Up: test invocation 16.3.4 String tests ------------------- -These options test string characteristics. You may need to quote -STRING arguments for the shell. For example: +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. +‘test’ if ‘$V’ is empty or contains special characters. -`-z STRING' +‘-z STRING’ True if the length of STRING is zero. -`-n STRING' -`STRING' +‘-n STRING’ +‘STRING’ True if the length of STRING is nonzero. -`STRING1 = STRING2' +‘STRING1 = STRING2’ True if the strings are equal. -`STRING1 != STRING2' - True if the strings are not equal. +‘STRING1 == STRING2’ + True if the strings are equal (synonym for =). +‘STRING1 != STRING2’ + True if the strings are not equal. File: coreutils.info, Node: Numeric tests, Next: Connectives for test, Prev: String tests, Up: test invocation @@ -8578,74 +10072,90 @@ File: coreutils.info, Node: Numeric tests, Next: Connectives for test, Prev: 16.3.5 Numeric tests -------------------- -Numeric relationals. The arguments must be entirely numeric (possibly -negative), or the special expression `-l STRING', which evaluates to -the length of STRING. +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' +‘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 + ⇒ yes test -l abc -gt 1 && echo yes - => yes + ⇒ yes test 0x100 -eq 1 - error--> test: integer expression expected before -eq + error→ test: integer expression expected before -eq File: coreutils.info, Node: Connectives for test, Prev: Numeric tests, Up: test invocation -16.3.6 Connectives for `test' +16.3.6 Connectives for ‘test’ ----------------------------- -The usual logical connectives. +Note it’s preferred to use shell logical primitives rather than these +logical connectives internal to ‘test’, because an expression may become +ambiguous depending on the expansion of its parameters. + + For example, this becomes ambiguous when ‘$1’ is set to ‘'!'’ and +‘$2’ to the empty string ‘''’: + + test "$1" -a "$2" -`! EXPR' - True if EXPR is false. + and should be written as: -`EXPR1 -a EXPR2' - True if both EXPR1 and EXPR2 are true. + test "$1" && test "$2" -`EXPR1 -o EXPR2' - True if either EXPR1 or EXPR2 is true. + Note the shell logical primitives also benefit from short circuit +operation, which can be significant for file attribute tests. +‘! EXPR’ + True if EXPR is false. ‘!’ has lower precedence than all parts of + EXPR. Note ‘!’ needs to be specified to the left of a binary + expression, I.e., ‘'!' 1 -gt 2’ rather than ‘1 '!' -gt 2’. Also + ‘!’ is often a shell special character and is best used quoted. + +‘EXPR1 -a EXPR2’ + True if both EXPR1 and EXPR2 are true. ‘-a’ is left associative, + and has a higher precedence than ‘-o’. + +‘EXPR1 -o EXPR2’ + True if either EXPR1 or EXPR2 is true. ‘-o’ is left associative. File: coreutils.info, Node: expr invocation, Prev: test invocation, Up: Conditions -16.4 `expr': Evaluate expressions +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. +‘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 +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 + 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; +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 @@ -8656,7 +10166,11 @@ Parentheses may be used for grouping in the usual manner. You must quote parentheses and many operators to avoid the shell evaluating them, however. - The only options are `--help' and `--version'. *Note Common + 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: @@ -8679,63 +10193,62 @@ File: coreutils.info, Node: String expressions, Next: Numeric expressions, Up 16.4.1 String expressions ------------------------- -`expr' supports pattern matching and other string operators. These -have lower precedence than both the numeric and relational operators (in -the next sections). +‘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' +‘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 + 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 `:' + 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. + 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; + 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 + 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::. + syntax. Some examples are in *note Examples of expr::. -`match STRING REGEX' +‘match STRING REGEX’ An alternative way to do pattern matching. This is the same as - `STRING : REGEX'. + ‘STRING : REGEX’. -`substr STRING POSITION LENGTH' +‘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. + at most LENGTH. If either POSITION or LENGTH is negative, zero, or + non-numeric, returns the null string. -`index STRING CHARSET' +‘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' +‘length STRING’ Returns the length of STRING. -`+ TOKEN' +‘+ 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"'. + 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. + To make ‘expr’ interpret keywords as strings, you must use the +‘quote’ operator. File: coreutils.info, Node: Numeric expressions, Next: Relations for expr, Prev: String expressions, Up: expr invocation @@ -8743,79 +10256,78 @@ File: coreutils.info, Node: Numeric expressions, Next: Relations for expr, Pr 16.4.2 Numeric expressions -------------------------- -`expr' supports the usual numeric operators, in order of increasing -precedence. The string operators (previous section) have lower -precedence, the connectives (next section) have higher. +‘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. - File: coreutils.info, Node: Relations for expr, Next: Examples of expr, Prev: Numeric expressions, Up: expr invocation -16.4.3 Relations for `expr' +16.4.3 Relations for ‘expr’ --------------------------- -`expr' supports the usual logical connectives and relations. These are -higher precedence than either the string or numeric operators (previous +‘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. + 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. + 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 + 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' + the character collating sequence specified by the ‘LC_COLLATE’ locale. - File: coreutils.info, Node: Examples of expr, Prev: Relations for expr, Up: expr invocation -16.4.4 Examples of using `expr' +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: + To add 1 to the shell variable ‘foo’, in Bourne-compatible shells: - foo=`expr $foo + 1` + foo=$(expr $foo + 1) - To print the non-directory part of the file name stored in `$fname', -which need not contain a `/': + 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: + An example showing that ‘\+’ is an operator: expr aaa : 'a\+' - => 3 + ⇒ 3 expr abc : 'a\(.\)c' - => b + ⇒ b expr index abcdef cz - => 3 + ⇒ 3 expr index index a - error--> expr: syntax error - expr index quote index a - => 0 + error→ expr: syntax error + expr index + index a + ⇒ 0 File: coreutils.info, Node: Redirection, Next: File name manipulation, Prev: Conditions, Up: Top @@ -8823,47 +10335,172 @@ File: coreutils.info, Node: Redirection, Next: File name manipulation, Prev: 17 Redirection ************** -Unix shells commonly provide several forms of "redirection"--ways to +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. +it’s described here. * Menu: -* tee invocation:: Redirect output to multiple files. +* tee invocation:: Redirect output to multiple files or processes. File: coreutils.info, Node: tee invocation, Up: Redirection -17.1 `tee': Redirect output to multiple files -============================================= +17.1 ‘tee’: Redirect output to multiple files or processes +========================================================== -The `tee' command copies standard input to standard output and also to +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]... + 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. + 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. + In previous versions of GNU coreutils (v5.3.0 - v8.23), a FILE of ‘-’ +caused ‘tee’ to send another copy of input to standard output. However, +as the interleaved output was not very useful, ‘tee’ now conforms to +POSIX which explicitly mandates it to treat ‘-’ as a file with such +name. - The program accepts the following options. Also see *Note Common + The program accepts the following options. Also see *note Common options::. -`-a' -`--append' +‘-a’ +‘--append’ Append standard input to the given files rather than overwriting them. -`-i' -`--ignore-interrupts' +‘-i’ +‘--ignore-interrupts’ Ignore interrupt signals. +‘-p’ +‘--output-error[=MODE]’ + Adjust the behavior with errors on the outputs, with the long form + option supporting selection between the following MODEs: + + ‘warn’ + Warn on error opening or writing any output, including pipes. + Writing is continued to still open files/pipes. Exit status + indicates failure if any output has an error. + + ‘warn-nopipe’ + This is the default MODE when not specified, or when the short + form ‘-p’ is used. Warn on error opening or writing any + output, except pipes. Writing is continued to still open + files/pipes. Exit status indicates failure if any non pipe + output had an error. + + ‘exit’ + Exit on error opening or writing any output, including pipes. + + ‘exit-nopipe’ + Exit on error opening or writing any output, except pipes. + + 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’. + + Note also that if any of the process substitutions (or piped stdout) +might exit early without consuming all the data, the ‘-p’ option is +needed to allow ‘tee’ to continue to process the input to any remaining +outputs. + + 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 + + If you want to further process the output from process substitutions, +and those processes write atomically (i.e., write less than the system’s +PIPE_BUF size at a time), that’s possible with a construct like: + + tardir=your-pkg-M.N + tar chof - "$tardir" \ + | tee >(md5sum --tag) > >(sha256sum --tag) \ + | sort | gpg --clearsign > your-pkg-M.N.tar.sig An exit status of zero indicates success, and a nonzero value indicates failure. @@ -8879,38 +10516,57 @@ This section describes commands that manipulate file names. * Menu: * basename invocation:: Strip directory and suffix from a file name. -* dirname invocation:: Strip non-directory suffix from a file name. -* pathchk invocation:: Check file name portability. +* dirname invocation:: Strip last file name component. +* pathchk invocation:: Check file name validity and portability. +* mktemp invocation:: Create temporary file or directory. +* realpath invocation:: Print resolved file names. File: coreutils.info, Node: basename invocation, Next: dirname invocation, Up: File name manipulation -18.1 `basename': Strip directory and suffix from a file name +18.1 ‘basename’: Strip directory and suffix from a file name ============================================================ -`basename' removes any leading directory components from 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. +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 + 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. +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 only options are `--help' and `--version'. *Note Common + 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’ + 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 + even when that output would contain data with embedded newlines. + An exit status of zero indicates success, and a nonzero value indicates failure. @@ -8922,32 +10578,47 @@ indicates failure. # 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 + File: coreutils.info, Node: dirname invocation, Next: pathchk invocation, Prev: basename invocation, Up: File name manipulation -18.2 `dirname': Strip non-directory suffix from a file name -=========================================================== +18.2 ‘dirname’: Strip last file name component +============================================== -`dirname' prints all but the final slash-delimited component of a -string (presumably a file name). Synopsis: +‘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 NAME + dirname [OPTION] NAME… - If NAME is a single component, `dirname' prints `.' (meaning the -current directory). + 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 + 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. +‘//’. With GNU ‘dirname’, the result is ‘//’ on platforms where // is +distinct from /, and ‘/’ on platforms where there is no difference. - The only options are `--help' and `--version'. *Note Common + The program accepts the following option. Also see *note Common options::. +‘-z’ +‘--zero’ + 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 + even when that output would contain data with embedded newlines. + An exit status of zero indicates success, and a nonzero value indicates failure. @@ -8955,63 +10626,282 @@ indicates failure. # Output "/usr/bin". dirname /usr/bin/sort + dirname /usr/bin//.// + + # Output "dir1" followed by "dir2" + dirname dir1/str dir2/str # Output ".". dirname stdio.h -File: coreutils.info, Node: pathchk invocation, Prev: dirname invocation, Up: File name manipulation +File: coreutils.info, Node: pathchk invocation, Next: mktemp invocation, Prev: dirname invocation, Up: File name manipulation -18.3 `pathchk': Check file name portability -=========================================== +18.3 ‘pathchk’: Check file name validity and portability +======================================================== -`pathchk' checks portability of file names. Synopsis: +‘pathchk’ checks validity and portability of file names. Synopsis: - pathchk [OPTION]... NAME... + pathchk [OPTION]… NAME… - For each NAME, `pathchk' prints a message if any of these conditions -is true: + 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. + 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 + The program accepts the following options. Also see *note Common options::. Options must precede operands. -`-p' +‘-p’ Instead of performing checks based on the underlying file system, - print a message if any of these conditions is true: + print an error message if any of these conditions is true: 1. A file name is empty. - 2. The length of a file name or one of its components exceeds the + 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. - 3. A file name contains a character outside the portable file - name character set, namely, the ASCII letters and digits, `-', - `.', `/', and `_'. +‘-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. + + +File: coreutils.info, Node: mktemp invocation, Next: realpath invocation, Prev: pathchk invocation, Up: File name manipulation + +18.4 ‘mktemp’: Create temporary file or directory +================================================= -`-P' - Print a message if a file name is empty, or if it contains a - component that begins with `-'. +‘mktemp’ manages the creation of temporary files and directories. +Synopsis: -`--portability' - Print a message if a file name is not portable to all POSIX hosts. - This option is equivalent to `-p -P'. + 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 all specified file names passed all checks, + 0 if the file was created, + 1 otherwise. + + +File: coreutils.info, Node: realpath invocation, Prev: mktemp invocation, Up: File name manipulation + +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. + +‘--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 + +‘-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’ + 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 + even when that output would contain data with embedded newlines. + + Exit status: + + 0 if all file names were printed without issue. 1 otherwise. @@ -9034,81 +10924,101 @@ so forth. See also the user-related commands in the next section. File: coreutils.info, Node: pwd invocation, Next: stty invocation, Up: Working context -19.1 `pwd': Print working directory +19.1 ‘pwd’: Print working directory =================================== -`pwd' prints the fully resolved name of the current directory. That -is, all components of the printed name will be actual directory -names--none will be symbolic links. +‘pwd’ prints the name of the current directory. Synopsis: - Because most shells have a built-in `pwd' command, using an -unadorned `pwd' in a script or interactively may get you different -functionality than that described here. + pwd [OPTION]… - The only options are a lone `--help' or `--version'. *Note Common + 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. File: coreutils.info, Node: stty invocation, Next: printenv invocation, Prev: pwd invocation, Up: Working context -19.2 `stty': Print or change terminal characteristics +19.2 ‘stty’: Print or change terminal characteristics ===================================================== -`stty' prints or changes terminal characteristics, such as baud rate. +‘stty’ prints or changes terminal characteristics, such as baud rate. Synopses: - stty [OPTION] [SETTING]... + stty [OPTION] [SETTING]… stty [OPTION] - If given no line settings, `stty' prints the baud rate, line + 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 +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. +input, although this can be modified by the ‘--file’ option. - `stty' accepts many non-option arguments that change aspects of the + ‘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 + 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. +‘-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' +‘-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 + 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 + 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' +‘-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. + 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. + 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 +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 +be available, but it’s not feasible to document all the variations: just try it and see. + ‘stty’ is installed only on platforms with the POSIX terminal +interface, so portable scripts should not rely on its existence on +non-POSIX platforms. + An exit status of zero indicates success, and a nonzero value indicates failure. @@ -9130,92 +11040,103 @@ File: coreutils.info, Node: Control, Next: Input, Up: stty invocation Control settings: -`parenb' +‘parenb’ Generate parity bit in output and expect parity bit in input. May be negated. -`parodd' +‘parodd’ Set odd parity (even if negated). May be negated. -`cs5' -`cs6' -`cs7' -`cs8' +‘cmspar’ + Use "stick" (mark/space) parity. If parodd is set, the parity bit + is always 1; if parodd is not set, the parity bit is always zero. + Non-POSIX. May be negated. + +‘cs5’ +‘cs6’ +‘cs7’ +‘cs8’ Set character size to 5, 6, 7, or 8 bits. -`hup' -`hupcl' +‘hup’ +‘hupcl’ Send a hangup signal when the last process closes the tty. May be negated. -`cstopb' +‘cstopb’ Use two stop bits per character (one if negated). May be negated. -`cread' +‘cread’ Allow input to be received. May be negated. -`clocal' +‘clocal’ Disable modem control signals. May be negated. -`crtscts' +‘crtscts’ Enable RTS/CTS flow control. Non-POSIX. May be negated. +‘cdtrdsr’ + Enable DTR/DSR flow control. Non-POSIX. May be negated. + File: coreutils.info, Node: Input, Next: Output, Prev: Control, Up: stty invocation 19.2.2 Input settings --------------------- -`ignbrk' +These settings control operations on data received from the terminal. + +‘ignbrk’ Ignore break characters. May be negated. -`brkint' +‘brkint’ Make breaks cause an interrupt signal. May be negated. -`ignpar' +‘ignpar’ Ignore characters with parity errors. May be negated. -`parmrk' +‘parmrk’ Mark parity errors (with a 255-0-character sequence). May be negated. -`inpck' +‘inpck’ Enable input parity checking. May be negated. -`istrip' +‘istrip’ Clear high (8th) bit of input characters. May be negated. -`inlcr' +‘inlcr’ Translate newline to carriage return. May be negated. -`igncr' +‘igncr’ Ignore carriage return. May be negated. -`icrnl' +‘icrnl’ Translate carriage return to newline. May be negated. -`iutf8' +‘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 +‘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 +‘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' +‘iuclc’ Translate uppercase characters to lowercase. Non-POSIX. May be - negated. + negated. Note ilcuc is not implemented, as one would not be able + to issue almost any (lowercase) Unix command, after invoking it. -`ixany' +‘ixany’ Allow any character to restart output (only the start character if negated). Non-POSIX. May be negated. -`imaxbel' +‘imaxbel’ Enable beeping and not flushing input buffer if a character arrives when the input buffer is full. Non-POSIX. May be negated. @@ -9225,63 +11146,63 @@ File: coreutils.info, Node: Output, Next: Local, Prev: Input, Up: stty invoc 19.2.3 Output settings ---------------------- -These arguments specify output-related operations. +These settings control operations on data sent to the terminal. -`opost' +‘opost’ Postprocess output. May be negated. -`olcuc' +‘olcuc’ Translate lowercase characters to uppercase. Non-POSIX. May be - negated. + negated. (Note ouclc is not currently implemented.) -`ocrnl' +‘ocrnl’ Translate carriage return to newline. Non-POSIX. May be negated. -`onlcr' +‘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. +‘onocr’ + Do not print carriage returns in the first column. Non-POSIX. May + be negated. -`onlret' +‘onlret’ Newline performs a carriage return. Non-POSIX. May be negated. -`ofill' +‘ofill’ Use fill (padding) characters instead of timing for delays. Non-POSIX. May be negated. -`ofdel' - Use delete characters for fill instead of null characters. +‘ofdel’ + Use ASCII DEL characters for fill instead of ASCII NUL characters. Non-POSIX. May be negated. -`nl1' -`nl0' +‘nl1’ +‘nl0’ Newline delay style. Non-POSIX. -`cr3' -`cr2' -`cr1' -`cr0' +‘cr3’ +‘cr2’ +‘cr1’ +‘cr0’ Carriage return delay style. Non-POSIX. -`tab3' -`tab2' -`tab1' -`tab0' +‘tab3’ +‘tab2’ +‘tab1’ +‘tab0’ Horizontal tab delay style. Non-POSIX. -`bs1' -`bs0' +‘bs1’ +‘bs0’ Backspace delay style. Non-POSIX. -`vt1' -`vt0' +‘vt1’ +‘vt0’ Vertical tab delay style. Non-POSIX. -`ff1' -`ff0' +‘ff1’ +‘ff0’ Form feed delay style. Non-POSIX. @@ -9290,60 +11211,69 @@ File: coreutils.info, Node: Local, Next: Combination, Prev: Output, Up: stty 19.2.4 Local settings --------------------- -`isig' - Enable `interrupt', `quit', and `suspend' special characters. May +‘isig’ + Enable ‘interrupt’, ‘quit’, and ‘suspend’ special characters. May be negated. -`icanon' - Enable `erase', `kill', `werase', and `rprnt' special characters. +‘icanon’ + Enable ‘erase’, ‘kill’, ‘werase’, and ‘rprnt’ special characters. May be negated. -`iexten' +‘iexten’ Enable non-POSIX special characters. May be negated. -`echo' +‘echo’ Echo input characters. May be negated. -`echoe' -`crterase' - Echo `erase' characters as backspace-space-backspace. May be +‘echoe’ +‘crterase’ + Echo ‘erase’ characters as backspace-space-backspace. May be negated. -`echok' - Echo a newline after a `kill' character. May be negated. +‘echok’ + Echo a newline after a ‘kill’ character. May be negated. -`echonl' +‘echonl’ Echo newline even if not echoing other characters. May be negated. -`noflsh' - Disable flushing after `interrupt' and `quit' special characters. +‘noflsh’ + Disable flushing after ‘interrupt’ and ‘quit’ special characters. May be negated. -`xcase' +‘xcase’ Enable input and output of uppercase characters by preceding their - lowercase equivalents with `\', when `icanon' is set. Non-POSIX. + lowercase equivalents with ‘\’, when ‘icanon’ is set. Non-POSIX. May be negated. -`tostop' +‘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. +‘echoprt’ +‘prterase’ + Echo erased characters backward, between ‘\’ and ‘/’. Non-POSIX. May be negated. -`echoctl' -`ctlecho' - Echo control characters in hat notation (`^C') instead of +‘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. +‘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. + +‘extproc’ + Enable ‘LINEMODE’, which is used to avoid echoing each character + over high latency links. See also Internet RFC 1116 + (ftp://ftp.rfc-editor.org/in-notes/rfc1116.txt). Non-POSIX. May + be negated. + +‘flusho’ + Discard output. Note this setting is currently ignored on + GNU/Linux systems. Non-POSIX. May be negated. File: coreutils.info, Node: Combination, Next: Characters, Prev: Local, Up: stty invocation @@ -9353,76 +11283,77 @@ File: coreutils.info, Node: Combination, Next: Characters, Prev: Local, Up: Combination settings: -`evenp' -`parity' - Same as `parenb -parodd cs7'. May be negated. If negated, same - as `-parenb cs8'. +‘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'. +‘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'. +‘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 +‘ek’ + Reset the ‘erase’ and ‘kill’ special characters to their default values. -`sane' +‘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 + cread -ignbrk brkint -inlcr -igncr icrnl + icanon iexten echo echoe echok -echonl -noflsh + -ixoff -iutf8 -iuclc -ixany imaxbel -xcase -olcuc -ocrnl + opost -ofill onlcr -onocr -onlret nl0 cr0 tab0 bs0 vt0 ff0 + isig -tostop -ofdel -echoprt echoctl echoke -extproc 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'. +‘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' +‘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 + -inlcr -igncr -icrnl -ixon -ixoff -icanon -opost + -isig -iuclc -ixany -imaxbel -xcase min 1 time 0 - May be negated. If negated, same as `cooked'. + May be negated. If negated, same as ‘cooked’. -`cbreak' - Same as `-icanon'. May be negated. If negated, same as `icanon'. +‘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'. +‘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'. +‘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. +‘decctlq’ + Same as ‘-ixany’. Non-POSIX. May be negated. -`tabs' - Same as `tab0'. Non-POSIX. May be negated. If negated, same as - `tab3'. +‘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. +‘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'. +‘crt’ + Same as ‘echoe echoctl echoke’. -`dec' - Same as `echoe echoctl echoke -ixany intr ^C erase ^? kill C-u'. +‘dec’ + Same as ‘echoe echoctl echoke -ixany intr ^C erase ^? kill C-u’. File: coreutils.info, Node: Characters, Next: Special, Prev: Combination, Up: stty invocation @@ -9430,62 +11361,66 @@ File: coreutils.info, Node: Characters, Next: Special, Prev: Combination, Up 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. +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 -<U>.) + 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 <U>.) -`intr' +‘intr’ Send an interrupt signal. -`quit' +‘quit’ Send a quit signal. -`erase' +‘erase’ Erase the last character typed. -`kill' +‘kill’ Erase the current line. -`eof' +‘eof’ Send an end of file (terminate the input). -`eol' +‘eol’ End the line. -`eol2' +‘eol2’ Alternate character to end the line. Non-POSIX. -`swtch' +‘discard’ + Alternate character to toggle discarding of output. Non-POSIX. + +‘swtch’ Switch to a different shell layer. Non-POSIX. -`start' +‘status’ + Send an info signal. Not currently supported on Linux. Non-POSIX. + +‘start’ Restart the output after stopping it. -`stop' +‘stop’ Stop the output. -`susp' +‘susp’ Send a terminal stop signal. -`dsusp' +‘dsusp’ Send a terminal stop signal after flushing the input. Non-POSIX. -`rprnt' +‘rprnt’ Redraw the current line. Non-POSIX. -`werase' +‘werase’ Erase the last word typed. Non-POSIX. -`lnext' +‘lnext’ Enter the next character typed literally, even if it is a special character. Non-POSIX. @@ -9495,65 +11430,84 @@ File: coreutils.info, Node: Special, Prev: Characters, Up: stty invocation 19.2.7 Special settings ----------------------- -`min N' +‘min N’ Set the minimum number of characters that will satisfy a read until - the time value has expired, when `-icanon' is set. + the time value has expired, when ‘-icanon’ is set. -`time N' +‘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 + minimum number of characters have not been read, when ‘-icanon’ is set. -`ispeed N' +‘ispeed N’ Set the input speed to N. -`ospeed N' +‘ospeed N’ Set the output speed to N. -`rows N' +‘rows N’ Tell the tty kernel driver that the terminal has N rows. Non-POSIX. -`cols N' -`columns N' +‘cols N’ +‘columns N’ Tell the kernel that the terminal has N columns. Non-POSIX. -`size' +‘drain’ + Apply settings after first waiting for pending output to be + transmitted. This is enabled by default for GNU ‘stty’. It is + useful to disable this option in cases where the system may be in a + state where serial transmission is not possible. For example, if + the system has received the ‘DC3’ character with ‘ixon’ (software + flow control) enabled, then ‘stty’ would block without ‘-drain’ + being specified. May be negated. 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. + 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' +‘line N’ Use line discipline N. Non-POSIX. -`speed' +‘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. 0 hangs up the line if `-clocal' is set. +‘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. File: coreutils.info, Node: printenv invocation, Next: tty invocation, Prev: stty invocation, Up: Working context -19.3 `printenv': Print all or some environment variables +19.3 ‘printenv’: Print all or some environment variables ======================================================== -`printenv' prints environment variable values. Synopsis: +‘printenv’ prints environment variable values. Synopsis: - printenv [OPTION] [VARIABLE]... + printenv [OPTION] [VARIABLE]… - If no VARIABLEs are specified, `printenv' prints the value of every + 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 only options are a lone `--help' or `--version'. *Note Common + 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 + even when that output would contain data with embedded newlines. + Exit status: 0 if all variables specified were found @@ -9563,24 +11517,23 @@ options::. File: coreutils.info, Node: tty invocation, Prev: printenv invocation, Up: Working context -19.4 `tty': Print file name of terminal on standard input +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. +‘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]... + tty [OPTION]… - The program accepts the following option. Also see *Note Common + The program accepts the following option. Also see *note Common options::. -`-s' -`--silent' -`--quiet' +‘-s’ +‘--silent’ +‘--quiet’ Print nothing; only return an exit status. - Exit status: 0 if standard input is a terminal @@ -9609,46 +11562,74 @@ logins, groups, and so forth. File: coreutils.info, Node: id invocation, Next: logname invocation, Up: User information -20.1 `id': Print user identity +20.1 ‘id’: Print user identity ============================== -`id' prints information about the given user, or the process running it +‘id’ prints information about the given user, or the process running it if no user is specified. Synopsis: - id [OPTION]... [USERNAME] + id [OPTION]… [USER] - 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. + USER can be either a user ID or a name, with name look-up taking +precedence unless the ID is specified with a leading ‘+’. *Note +Disambiguating names and IDs::. + + 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::. + The options cause ‘id’ to print only part of the above information. +Also see *note Common options::. -`-g' -`--group' +‘-g’ +‘--group’ Print only the group ID. -`-G' -`--groups' +‘-G’ +‘--groups’ Print only the group ID and the supplementary groups. -`-n' -`--name' +‘-n’ +‘--name’ Print the user or group name instead of the ID number. Requires - `-u', `-g', or `-G'. + ‘-u’, ‘-g’, or ‘-G’. -`-r' -`--real' +‘-r’ +‘--real’ Print the real, instead of effective, user or group ID. Requires - `-u', `-g', or `-G'. + ‘-u’, ‘-g’, or ‘-G’. -`-u' -`--user' +‘-u’ +‘--user’ Print only the user ID. +‘-Z’ +‘--context’ + Print only the security context of the process, which is generally + the user’s security context inherited from the parent process. If + neither SELinux or SMACK is enabled then print a warning and set + the exit status to 1. + +‘-z’ +‘--zero’ + Delimit output items with NUL characters. This option is not + permitted when using the default format. + + Example: + $ id -Gn --zero + users <NUL> devs <NUL> + + 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. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -9656,15 +11637,15 @@ indicates failure. File: coreutils.info, Node: logname invocation, Next: whoami invocation, Prev: id invocation, Up: User information -20.2 `logname': Print current login name +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. +‘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 + The only options are ‘--help’ and ‘--version’. *Note Common options::. An exit status of zero indicates success, and a nonzero value @@ -9673,13 +11654,13 @@ indicates failure. File: coreutils.info, Node: whoami invocation, Next: groups invocation, Prev: logname invocation, Up: User information -20.3 `whoami': Print effective user ID +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'. +‘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 + The only options are ‘--help’ and ‘--version’. *Note Common options::. An exit status of zero indicates success, and a nonzero value @@ -9688,148 +11669,171 @@ indicates failure. File: coreutils.info, Node: groups invocation, Next: users invocation, Prev: whoami invocation, Up: User information -20.4 `groups': Print group names a user is in +20.4 ‘groups’: Print group names a user is in ============================================= -`groups' prints the names of the primary and any supplementary groups +‘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. Synopsis: +the list of that user’s groups and the user name is separated from the +group list by a colon. Synopsis: - groups [USERNAME]... + groups [USERNAME]… - The group lists are equivalent to the output of the command `id -Gn'. + The group lists are equivalent to the output of the command ‘id -Gn’. - The only options are `--help' and `--version'. *Note Common + The only options are ‘--help’ and ‘--version’. *Note Common options::. + 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. + An exit status of zero indicates success, and a nonzero value indicates failure. File: coreutils.info, Node: users invocation, Next: who invocation, Prev: groups invocation, Up: User information -20.5 `users': Print login names of users currently logged in +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’ 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 +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'. + 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 + The only options are ‘--help’ and ‘--version’. *Note Common options::. + The ‘users’ command is installed only on platforms with the POSIX +‘<utmpx.h>’ include file or equivalent, so portable scripts should not +rely on its existence on non-POSIX platforms. + An exit status of zero indicates success, and a nonzero value indicates failure. File: coreutils.info, Node: who invocation, Prev: users invocation, Up: User information -20.6 `who': Print who is currently logged in +20.6 ‘who’: Print who is currently logged in ============================================ -`who' prints information about users who are currently logged on. +‘who’ prints information about users who are currently logged on. Synopsis: - `who' [OPTION] [FILE] [am i] + who [OPTION] [FILE] [am i] - If given no non-option arguments, `who' prints the following + 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 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 + 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'. +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 ‘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 + The program accepts the following options. Also see *note Common options::. -`-a' -`--all' - Same as `-b -d --login -p -r -t -T -u'. +‘-a’ +‘--all’ + Same as ‘-b -d --login -p -r -t -T -u’. -`-b' -`--boot' +‘-b’ +‘--boot’ Print the date and time of last system boot. -`-d' -`--dead' +‘-d’ +‘--dead’ Print information corresponding to dead processes. -`-H' -`--heading' - Print column headings. - -`-m' - Same as `who am i'. - -`-q' -`--count' - Print only the login names and the number of users logged on. - Overrides all other options. - -`-s' - Ignored; for compatibility with other versions of `who'. - -`-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. +‘-H’ +‘--heading’ + Print a line of column headings. -`-l' -`--login' +‘-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'. + ‘LOGIN’. -`--lookup' +‘--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. -`-H' -`--heading' - Print a line of column headings. +‘-m’ + Same as ‘who am i’. -`-w' -`-T' -`--mesg' -`--message' -`--writable' - After each login name print a character indicating the user's +‘-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 + ‘+’ allowing ‘write’ messages + ‘-’ disallowing ‘write’ messages + ‘?’ cannot find terminal device + The ‘who’ command is installed only on platforms with the POSIX +‘<utmpx.h>’ include file or equivalent, so portable scripts should not +rely on its existence on non-POSIX platforms. An exit status of zero indicates success, and a nonzero value indicates failure. -File: coreutils.info, Node: System context, Next: Modified command invocation, Prev: User information, Up: Top +File: coreutils.info, Node: System context, Next: SELinux context, Prev: User information, Up: Top 21 System context ***************** @@ -9840,35 +11844,38 @@ information. * Menu: * date invocation:: Print or set system date and time. +* arch invocation:: Print machine hardware name. +* nproc invocation:: Print the number of processors. * uname invocation:: Print system information. * hostname invocation:: Print or set system name. * hostid invocation:: Print numeric host identifier. +* uptime invocation:: Print system uptime and load. -File: coreutils.info, Node: date invocation, Next: uname invocation, Up: System context +File: coreutils.info, Node: date invocation, Next: arch invocation, Up: System context -21.1 `date': Print or set system date and time +21.1 ‘date’: Print or set system date and time ============================================== Synopses: - date [OPTION]... [+FORMAT] + 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'. + 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. + 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' + 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 +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 @@ -9882,6 +11889,7 @@ indicates failure. * Padding and other flags:: Pad with zeros, spaces, etc. * Setting the time:: Changing the system clock. * Options for date:: Instead of the current time. +* Date input formats:: Specifying date strings. * Examples of date:: Examples. @@ -9890,82 +11898,64 @@ File: coreutils.info, Node: Time conversion specifiers, Next: Date conversion 21.1.1 Time conversion specifiers --------------------------------- -`date' conversion specifiers related to times. - -`%H' - hour (`00'...`23') - -`%I' - hour (`01'...`12') - -`%k' - hour (` 0'...`23'). This is a GNU extension. - -`%l' - hour (` 1'...`12'). 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'. +‘date’ conversion specifiers related to times. -`%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'. This is a GNU +‘%H’ + hour (‘00’…‘23’) +‘%I’ + hour (‘01’…‘12’) +‘%k’ + hour, space padded (‘ 0’…‘23’); equivalent to ‘%_H’. This is a GNU extension. - -`%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 +‘%l’ + hour, space padded (‘ 1’…‘12’); equivalent to ‘%_I’. This is a GNU extension. - -`%S' - second (`00'...`60'). This may be `60' if leap seconds are +‘%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 +‘%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 + 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. This is a GNU extension. - -`%: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 + 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. +‘%::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. File: coreutils.info, Node: Date conversion specifiers, Next: Literal conversion specifiers, Prev: Time conversion specifiers, Up: date invocation @@ -9973,102 +11963,77 @@ File: coreutils.info, Node: Date conversion specifiers, Next: Literal conversi 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 +‘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. This is - a GNU extension. - -`%g' + 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. This is a GNU - extension. - -`%G' + (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 + 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. This is a GNU extension. - -`%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' + 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' + (‘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 + 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' +‘%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'. + more. Year ‘0000’ precedes year ‘0001’, and year ‘-001’ precedes + year ‘0000’. File: coreutils.info, Node: Literal conversion specifiers, Next: Padding and other flags, Prev: Date conversion specifiers, Up: date invocation @@ -10076,15 +12041,13 @@ File: coreutils.info, Node: Literal conversion specifiers, Next: Padding and o 21.1.3 Literal conversion specifiers ------------------------------------ -`date' conversion specifiers that produce literal strings. +‘date’ conversion specifiers that produce literal strings. -`%%' +‘%%’ a literal % - -`%n' +‘%n’ a newline - -`%t' +‘%t’ a horizontal tab @@ -10093,60 +12056,55 @@ File: coreutils.info, Node: Padding and other flags, Next: Setting the time, 21.1.4 Padding and other flags ------------------------------ -Unless otherwise specified, `date' normally pads numeric fields with +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 `%': + 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' +‘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. +‘#’ + 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 + ⇒ 01/02 date +%-d/%-m -d "Feb 1" - => 1/2 + ⇒ 1/2 date +%_d/%_m -d "Feb 1" - => 1/ 2 + ⇒ 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 is -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. +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. +‘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 +‘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 @@ -10158,78 +12116,106 @@ File: coreutils.info, Node: Setting the time, Next: Options for date, Prev: P 21.1.5 Setting the time ----------------------- -If given an argument that does not start with `+', `date' sets the +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. The `--date' and `--set' options may not be used with -such an argument. 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. +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' +‘MM’ month - -`DD' +‘DD’ day within month - -`hh' +‘hh’ hour - -`mm' +‘mm’ minute - -`CC' +‘CC’ first two digits of year (optional) - -`YY' +‘YY’ last two digits of year (optional) - -`ss' +‘ss’ second (optional) - The `--set' option also sets the system clock; see the next section. + 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. File: coreutils.info, Node: Options for date, Next: Examples of date, Prev: Setting the time, Up: date invocation -21.1.6 Options for `date' +21.1.6 Options for ‘date’ ------------------------- -The program accepts the following options. Also see *Note Common +The program accepts the following options. Also see *note Common options::. -`-d DATESTR' -`--date=DATESTR' +‘-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 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 + 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 + overhead of starting up the ‘date’ executable many times can be considerable. -`-r FILE' -`--reference=FILE' - Display the date and time of the last modification of FILE, - instead of the current date and time. +‘-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. -`-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 + ‘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’. This format is always suitable as input for the + ‘--date’ (‘-d’) and ‘--file’ (‘-f’) options, regardless of the + current locale. + +‘-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 @@ -10239,99 +12225,99 @@ options::. (ftp://ftp.rfc-editor.org/in-notes/rfc822.txt), the current and previous standards for Internet email. -`--rfc-3339=TIMESPEC' +‘--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. + of the ISO 8601 format, except that it also permits applications to + use a space rather than a ‘T’ to separate dates from times. This + 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'. + ‘date’ + Print just the full-date, e.g., ‘2005-09-14’. This is + equivalent to the format ‘%Y-%m-%d’. - `seconds' + ‘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 + ‘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. - -`-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. + 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. File: coreutils.info, Node: Examples of date, Prev: Options for date, Up: date invocation -21.1.7 Examples of `date' +21.1.7 Examples of ‘date’ ------------------------- -Here are a few examples. Also see the documentation for the `-d' -option in the previous section. +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: + • 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: + • 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: + • 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: + • 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'. + 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 + • 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: + • 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: + • 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 + • 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 + • 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: @@ -10340,28 +12326,28 @@ option in the previous section. 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: + ‘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." + • 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 + 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'. + zone-dependent formats like ‘%z’. date -u --date=2000-01-01 +%s 946684800 @@ -10373,7 +12359,7 @@ option in the previous section. 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 + 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" @@ -10384,20 +12370,93 @@ option in the previous section. 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 + + +File: coreutils.info, Node: arch invocation, Next: nproc invocation, Prev: date invocation, Up: System context + +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. + + ‘arch’ is not installed by default, so portable scripts should not +rely on its existence. + + An exit status of zero indicates success, and a nonzero value +indicates failure. + + +File: coreutils.info, Node: nproc invocation, Next: uname invocation, Prev: arch invocation, Up: System context + +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. -File: coreutils.info, Node: uname invocation, Next: hostname invocation, Prev: date invocation, Up: System context +File: coreutils.info, Node: uname invocation, Next: hostname invocation, Prev: nproc invocation, Up: System context -21.2 `uname': Print system information +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 +‘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]... + uname [OPTION]… - If multiple options or `-a' are given, the selected information is + If multiple options or ‘-a’ are given, the selected information is printed in this order: KERNEL-NAME NODENAME KERNEL-RELEASE KERNEL-VERSION @@ -10405,112 +12464,301 @@ printed in this order: 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': +‘2.2.18ss.e820-bda652a #4 SMP Tue Jun 5 11:24:08 PDT 2001’: uname -a - => Linux dum 2.2.18 #4 SMP Tue Jun 5 11:24:08 PDT 2001 i686 unknown unknown GNU/Linux + ⇒ 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 + The program accepts the following options. Also see *note Common options::. -`-a' -`--all' +‘-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' +‘-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. + implementation). Print ‘unknown’ if this information is not + available. Note this is non-portable (even across GNU/Linux + distributions). -`-m' -`--machine' +‘-m’ +‘--machine’ Print the machine hardware name (sometimes called the hardware class or hardware type). -`-n' -`--nodename' +‘-n’ +‘--nodename’ Print the network node hostname. -`-p' -`--processor' +‘-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. + architecture or ISA). Print ‘unknown’ if this information is not + available. Note this is non-portable (even across GNU/Linux + distributions). -`-o' -`--operating-system' +‘-o’ +‘--operating-system’ Print the name of the operating system. -`-r' -`--kernel-release' +‘-r’ +‘--kernel-release’ Print the kernel release. -`-s' -`--kernel-name' +‘-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' + 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. File: coreutils.info, Node: hostname invocation, Next: hostid invocation, Prev: uname invocation, Up: System context -21.3 `hostname': Print or set system name +21.5 ‘hostname’: Print or set system name ========================================= -With no arguments, `hostname' prints the name of the current host +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 + The only options are ‘--help’ and ‘--version’. *Note Common options::. + ‘hostname’ is not installed by default, and other packages also +supply a ‘hostname’ command, so portable scripts should not rely on its +existence or on the exact behavior documented above. + An exit status of zero indicates success, and a nonzero value indicates failure. -File: coreutils.info, Node: hostid invocation, Prev: hostname invocation, Up: System context +File: coreutils.info, Node: hostid invocation, Next: uptime invocation, Prev: hostname invocation, Up: System context -21.4 `hostid': Print numeric host identifier. -============================================= +21.6 ‘hostid’: Print numeric host identifier +============================================ -`hostid' prints the numeric identifier of the current host in +‘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::. +‘--help’ and ‘--version’. *Note Common options::. - For example, here's what it prints on one system I use: + 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. +the system’s Internet address, but that isn’t always the case. + + ‘hostid’ is installed only on systems that have the ‘gethostid’ +function, so portable scripts should not rely on its existence. + + An exit status of zero indicates success, and a nonzero value +indicates failure. + + +File: coreutils.info, Node: uptime invocation, Prev: hostid invocation, Up: System context + +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. + + ‘uptime’ is installed only on platforms with infrastructure for +obtaining the boot time, and other packages also supply an ‘uptime’ +command, so portable scripts should not rely on its existence or on the +exact behavior documented above. + + An exit status of zero indicates success, and a nonzero value +indicates failure. + + +File: coreutils.info, Node: SELinux context, Next: Modified command invocation, Prev: System context, Up: Top + +22 SELinux context +****************** + +This section describes commands for operations with SELinux contexts. + +* Menu: + +* chcon invocation:: Change SELinux context of file +* runcon invocation:: Run a command in specified SELinux context + + +File: coreutils.info, Node: chcon invocation, Next: runcon invocation, Up: SELinux context + +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. -File: coreutils.info, Node: Modified command invocation, Next: Process control, Prev: System context, Up: Top +File: coreutils.info, Node: runcon invocation, Prev: chcon invocation, Up: SELinux context + +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 + + +File: coreutils.info, Node: Modified command invocation, Next: Process control, Prev: SELinux context, Up: Top -22 Modified command invocation +23 Modified command invocation ****************************** This section describes commands that run other commands in some context @@ -10523,115 +12771,205 @@ user, etc. * env invocation:: Modify environment variables. * nice invocation:: Modify niceness. * nohup invocation:: Immunize to hangups. -* su invocation:: Modify user and group ID. +* stdbuf invocation:: Modify buffering of standard streams. +* timeout invocation:: Run with time limit. File: coreutils.info, Node: chroot invocation, Next: env invocation, Up: Modified command invocation -22.1 `chroot': Run a command with a different root directory +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. Synopses: +‘chroot’ runs a command with a specified root directory. On many +systems, only the super-user can do this.(1). Synopses: - chroot NEWROOT [COMMAND [ARGS]...] + 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 only options are `--help' and `--version'. *Note Common +directory structure, i.e., ‘/’. ‘chroot’ changes the root to the +directory NEWROOT (which must exist), then changes the working directory +to ‘/’, and finally 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. +‘--groups=GROUPS’ + Use this option to override the supplementary GROUPS to be used by + the new process. The items in the list (names or numeric IDs) must + be separated by commas. Use ‘--groups=''’ to disable the + supplementary group look-up implicit in the ‘--userspec’ option. + +‘--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. If a USER is specified then + the supplementary groups are set according to the system defined + list for that user, unless overridden with the ‘--groups’ option. + +‘--skip-chdir’ + Use this option to not change the working directory to ‘/’ after + changing the root directory to NEWROOT, i.e., inside the chroot. + This option is only permitted when NEWROOT is the old ‘/’ + directory, and therefore is mostly useful together with the + ‘--groups’ and ‘--userspec’ options to retain the previous working + directory. + + The user and group name look-up performed by the ‘--userspec’ and +‘--groups’ options, is done both outside and inside the chroot, with +successful look-ups inside the chroot taking precedence. If the +specified user or group items are intended to represent a numeric ID, +then a name to ID resolving step is avoided by specifying a leading ‘+’. +*Note Disambiguating names and IDs::. + 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 +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: + 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: + 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. + 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. + + ‘chroot’ is installed only on systems that have the ‘chroot’ +function, so portable scripts should not rely on its existence. Exit status: - 1 if `chroot' itself fails + 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. Furthermore, the ‘chroot’ command avoids the ‘chroot’ +system call when NEWROOT is identical to the old ‘/’ directory for +consistency with systems where this is allowed for non-privileged users. + File: coreutils.info, Node: env invocation, Next: nice invocation, Prev: chroot invocation, Up: Modified command invocation -22.2 `env': Run a command in a modified environment +23.2 ‘env’: Run a command in a modified environment =================================================== -`env' runs a command with a modified environment. Synopses: +‘env’ runs a command with a modified environment. Synopses: - env [OPTION]... [NAME=VALUE]... [COMMAND [ARGS]...] + 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 + 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 the null character (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. +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' + 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. +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 - The program accepts the following options. Also see *Note Common + • 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. -`-u NAME' -`--unset=NAME' +‘-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 + 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' +‘-’ +‘-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 - 1 if `env' itself fails + 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 @@ -10639,21 +12977,24 @@ options::. Options must precede operands. File: coreutils.info, Node: nice invocation, Next: nohup invocation, Prev: env invocation, Up: Modified command invocation -22.3 `nice': Run a command with modified niceness +23.3 ‘nice’: Run a command with modified niceness ================================================= -`nice' prints or modifies a process's "niceness", a parameter that -affects whether the process is scheduled favorably. Synopsis: +‘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]...] + 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. + 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. - Nicenesses range at least from -20 (resulting in the most favorable -scheduling) through 19 (the least favorable). Some systems may have a -wider range of nicenesses; conversely, other systems may enforce more + 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. @@ -10661,38 +13002,45 @@ 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. +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 non-negative 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::). - Because many shells have a built-in `nice' command, using an -unadorned `nice' in a script or interactively may get you different -functionality than that described here. + 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. - The program accepts the following option. Also see *Note Common + 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' +‘-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. + For compatibility ‘nice’ also supports an obsolete option syntax + ‘-ADJUSTMENT’. New scripts should use ‘-n ADJUSTMENT’ instead. + ‘nice’ is installed only on systems that have the POSIX ‘setpriority’ +function, so portable scripts should not rely on its existence on +non-POSIX platforms. Exit status: 0 if no COMMAND is specified and the niceness is output - 1 if `nice' itself fails + 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 @@ -10702,10 +13050,10 @@ niceness. $ nice factor 4611686018427387903 - Since `nice' prints the current niceness, you can invoke it through + 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': + The default behavior is to increase the niceness by ‘10’: $ nice 0 @@ -10715,7 +13063,7 @@ itself to demonstrate how it works. 10 The ADJUSTMENT is relative to the current niceness. In the next -example, the first `nice' invocation runs the second one with niceness +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 @@ -10736,166 +13084,213 @@ specifying the maximum supported value: -1 -File: coreutils.info, Node: nohup invocation, Next: su invocation, Prev: nice invocation, Up: Modified command invocation +File: coreutils.info, Node: nohup invocation, Next: stdbuf invocation, Prev: nice invocation, Up: Modified command invocation -22.4 `nohup': Run a command immune to hangups +23.4 ‘nohup’: Run a command immune to hangups ============================================= -`nohup' runs the given COMMAND with hangup signals ignored, so that the +‘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]... + 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]... </dev/null' + If standard input is a terminal, redirect it so that terminal +sessions do not mistakenly consider the terminal to be used by the +command. Make the substitute file descriptor unreadable, so that +commands that mistakenly attempt to read from standard input can report +an error. This redirection is a GNU extension; programs intended to be +portable to non-GNU hosts can use ‘nohup COMMAND [ARG]… 0>/dev/null’ instead. - If standard output is a terminal, the command's standard output is -appended to the file `nohup.out'; if that cannot be written to, it is -appended to the file `$HOME/nohup.out'; and if that cannot be written -to, the command is not run. Any `nohup.out' or `$HOME/nohup.out' file -created by `nohup' is made readable and writable only to the user, + If standard output is a terminal, the command’s standard output is +appended to the file ‘nohup.out’; if that cannot be written to, it is +appended to the file ‘$HOME/nohup.out’; and if that cannot be written +to, the command is not run. Any ‘nohup.out’ or ‘$HOME/nohup.out’ file +created by ‘nohup’ is made readable and writable only to the user, regardless of the current umask settings. If standard error is a terminal, it is normally redirected to the same file descriptor as the (possibly-redirected) standard output. -However, if standard output is closed, standard error terminal output -is instead appended to the file `nohup.out' or `$HOME/nohup.out' as -above. +However, if standard output is closed, standard error terminal output is +instead appended to the file ‘nohup.out’ or ‘$HOME/nohup.out’ as above. + + To capture the command’s output to a file other than ‘nohup.out’ you +can redirect it. For example, to capture the output of ‘make’: - `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'. + nohup make > 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 + 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 `nohup' itself fails or if COMMAND cannot be found + 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. + -File: coreutils.info, Node: su invocation, Prev: nohup invocation, Up: Modified command invocation +File: coreutils.info, Node: stdbuf invocation, Next: timeout invocation, Prev: nohup invocation, Up: Modified command invocation -22.5 `su': Run a command with substitute user and group ID -========================================================== +23.5 ‘stdbuf’: Run a command with modified I/O stream buffering +=============================================================== -`su' allows one user to temporarily become another user. It runs a -command (often an interactive shell) with the real and effective user -ID, group ID, and supplemental groups of a given USER. Synopsis: +‘stdbuf’ allows one to modify the buffering operations of the three +standard I/O streams associated with a program. Synopsis: - su [OPTION]... [USER [ARG]...] + stdbuf OPTION… COMMAND - If no USER is given, the default is `root', the super-user. The -shell to use is taken from USER's `passwd' entry, or `/bin/sh' if none -is specified there. If USER has a password, `su' prompts for the -password unless run by a user with effective user ID of zero (the -super-user). + 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), - By default, `su' does not change the current directory. It sets the -environment variables `HOME' and `SHELL' from the password entry for -USER, and if USER is not the super-user, sets `USER' and `LOGNAME' to -USER. By default, the shell is not a login shell. + 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 shell. + Any additional ARGs are passed as additional arguments to the +COMMAND. - GNU `su' does not treat `/bin/sh' or any other shells specially -(e.g., by setting `argv[0]' to `-su', passing `-c' only to certain -shells, etc.). + The program accepts the following options. Also see *note Common +options::. - `su' can optionally be compiled to use `syslog' to report failed, -and optionally successful, `su' attempts. (If the system supports -`syslog'.) However, GNU `su' does not check if the user is a member of -the `wheel' group; see below. +‘-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’. + + ‘stdbuf’ is installed only on platforms that use the Executable and +Linkable Format (ELF) and support the ‘constructor’ attribute, so +portable scripts should not rely on its existence. - The program accepts the following options. Also see *Note Common -options::. + Exit status: -`-c COMMAND' -`--command=COMMAND' - Pass COMMAND, a single command line to run, to the shell with a - `-c' option instead of starting an interactive shell. - -`-f' -`--fast' - Pass the `-f' option to the shell. This probably only makes sense - if the shell run is `csh' or `tcsh', for which the `-f' option - prevents reading the startup file (`.cshrc'). With Bourne-like - shells, the `-f' option disables file name pattern expansion - (globbing), which is not likely to be useful. - -`-' -`-l' -`--login' - Make the shell a login shell. This means the following. Unset all - environment variables except `TERM', `HOME', and `SHELL' (which - are set as described above), and `USER' and `LOGNAME' (which are - set, even for the super-user, as described above), and set `PATH' - to a compiled-in default value. Change to USER's home directory. - Prepend `-' to the shell's name, intended to make it read its - login startup file(s). - -`-m' -`-p' -`--preserve-environment' - Do not change the environment variables `HOME', `USER', `LOGNAME', - or `SHELL'. Run the shell given in the environment variable - `SHELL' instead of the shell from USER's passwd entry, unless the - user running `su' is not the super-user and USER's shell is - restricted. A "restricted shell" is one that is not listed in the - file `/etc/shells', or in a compiled-in list if that file does not - exist. Parts of what this option does can be overridden by - `--login' and `--shell'. - -`-s SHELL' -`--shell=SHELL' - Run SHELL instead of the shell from USER's passwd entry, unless - the user running `su' is not the super-user and USER's shell is - restricted (see `-m' just above). + 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 + +File: coreutils.info, Node: timeout invocation, Prev: stdbuf invocation, Up: Modified command invocation - Exit status: +23.6 ‘timeout’: Run a command with a time limit +=============================================== - 1 if `su' itself fails - 126 if subshell is found but cannot be invoked - 127 if subshell cannot be found - the exit status of the subshell otherwise +‘timeout’ runs the given COMMAND and kills it if it is still running +after the specified time interval. Synopsis: -22.5.1 Why GNU `su' does not support the `wheel' group ------------------------------------------------------- + timeout [OPTION] DURATION COMMAND [ARG]… -(This section is by Richard Stallman.) + COMMAND must not be a special built-in utility (*note Special +built-in utilities::). - Sometimes a few of the users try to hold total power over all the -rest. For example, in 1984, a few users at the MIT AI lab decided to -seize power by changing the operator password on the Twenex system and -keeping it secret from everyone else. (I was able to thwart this coup -and give power back to the users by patching the kernel, but I wouldn't -know how to do that in Unix.) + The program accepts the following options. Also see *note Common +options::. Options must precede operands. - However, occasionally the rulers do tell someone. Under the usual -`su' mechanism, once someone learns the root password who sympathizes -with the ordinary users, he or she can tell the rest. The "wheel -group" feature would make this impossible, and thus cement the power of -the rulers. +‘--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 indeterminate 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. Also SIGCONT will not be sent to COMMAND, as it’s + generally not needed with foreground processes, and can cause + intermittent signal delivery issues with programs that are monitors + themselves (like GDB for example). + +‘-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. - I'm on the side of the masses, not that of the rulers. If you are -used to supporting the bosses and sysadmins in whatever they do, you -might find this idea strange at first. + 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 File: coreutils.info, Node: Process control, Next: Delaying, Prev: Modified command invocation, Up: Top -23 Process control +24 Process control ****************** * Menu: @@ -10905,35 +13300,40 @@ File: coreutils.info, Node: Process control, Next: Delaying, Prev: Modified c File: coreutils.info, Node: kill invocation, Up: Process control -23.1 `kill': Send a signal to processes +24.1 ‘kill’: Send a signal to processes ======================================= -The `kill' command sends a signal to processes, causing them to +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]... + 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 + 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 +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 +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 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 +preceded by ‘--’. However, as a common extension to POSIX, ‘--’ is not +required with ‘kill -SIGNAL -PID’. The following commands are equivalent: kill -15 -1 @@ -10941,129 +13341,33 @@ equivalent: kill -s TERM -- -1 kill -- -1 - The first form of the `kill' command succeeds if every PID argument + 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. The -following signal names and numbers are supported on all POSIX compliant -systems: + 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. -`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. + The ‘kill’ command also supports the ‘--help’ and ‘--version’ +options. *Note Common options::. -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'. + 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. File: coreutils.info, Node: Delaying, Next: Numeric operations, Prev: Process control, Up: Top -24 Delaying +25 Delaying *********** * Menu: @@ -11073,44 +13377,46 @@ File: coreutils.info, Node: Delaying, Next: Numeric operations, Prev: Process File: coreutils.info, Node: sleep invocation, Up: Delaying -24.1 `sleep': Delay for a specified time +25.1 ‘sleep’: Delay for a specified time ======================================== -`sleep' pauses for an amount of time specified by the sum of the values +‘sleep’ pauses for an amount of time specified by the sum of the values of the command line arguments. Synopsis: - sleep NUMBER[smhd]... + sleep NUMBER[smhd]… Each argument is a number followed by an optional unit; the default is seconds. The units are: -`s' +‘s’ seconds - -`m' +‘m’ minutes - -`h' +‘h’ hours - -`d' +‘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 (using a -period before any fractional digits). + 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 + 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. File: coreutils.info, Node: Numeric operations, Next: File permissions, Prev: Delaying, Up: Top -25 Numeric operations +26 Numeric operations ********************* These programs do numerically-related operations. @@ -11118,161 +13424,461 @@ These programs do numerically-related operations. * Menu: * factor invocation:: Show factors of numbers. +* numfmt invocation:: Reformat numbers. * seq invocation:: Print sequences of numbers. -File: coreutils.info, Node: factor invocation, Next: seq invocation, Up: Numeric operations +File: coreutils.info, Node: factor invocation, Next: numfmt invocation, Up: Numeric operations -25.1 `factor': Print prime factors +26.1 ‘factor’: Print prime factors ================================== -`factor' prints prime factors. Synopses: +‘factor’ prints prime factors. Synopses: - factor [NUMBER]... + 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. + If no NUMBER is specified on the command line, ‘factor’ reads numbers +from standard input, delimited by newlines, tabs, or spaces. - The only options are `--help' and `--version'. *Note Common -options::. + The ‘factor’ command supports only a small number of options: - The algorithm it uses is not very sophisticated, so for some inputs -`factor' runs for a long time. The hardest numbers to factor are the -products of large primes. Factoring the product of the two largest -32-bit prime numbers takes about 80 seconds of CPU time on a 1.6 GHz -Athlon. +‘--help’ + Print a short help on standard output, then exit without further + processing. - $ p=`echo '4294967279 * 4294967291'|bc` - $ factor $p - 18446743979220271189: 4294967279 4294967291 +‘--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. - Similarly, it takes about 80 seconds for GNU factor (from -coreutils-5.1.2) to "factor" the largest 64-bit prime: + 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 - $ factor 18446744073709551557 - 18446744073709551557: 18446744073709551557 + Similarly, factoring the eighth Fermat number 2^{256}+1 takes about +20 seconds on the same machine. - In contrast, `factor' factors the largest 64-bit number in just over -a tenth of a second: + Factoring large numbers is, in general, hard. The Pollard-Brent 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. - $ factor `echo '2^64-1'|bc` - 18446744073709551615: 3 5 17 257 641 65537 6700417 + If ‘factor’ is built without using GNU MP, only single-precision +arithmetic is available, and so large numbers (typically 2^{128} 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. -File: coreutils.info, Node: seq invocation, Prev: factor invocation, Up: Numeric operations +File: coreutils.info, Node: numfmt invocation, Next: seq invocation, Prev: factor invocation, Up: Numeric operations + +26.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. + +26.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=FIELDS’ + Convert the number in input field FIELDS (default: 1). FIELDS + supports ‘cut’ style field ranges: + + N N'th field, counted from 1 + N- from N'th field, to end of line + N-M from N'th to M'th field (inclusive) + -M from first to M'th field (inclusive) + - all fields + +‘--format=FORMAT’ + Use printf-style floating FORMAT string. The FORMAT string must + contain one ‘%f’ directive, optionally with ‘'’, ‘-’, ‘0’, width or + precision modifiers. The ‘'’ modifier will enable ‘--grouping’, + the ‘-’ modifier will enable left-aligned ‘--padding’ and the width + modifier will enable right-aligned ‘--padding’. The ‘0’ width + modifier (without the ‘-’ modifier) will generate leading zeros on + the number, up to the specified width. A precision specification + like ‘%.1f’ will override the precision determined from the input + data or set due to ‘--to’ option auto scaling. + +‘--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’). Suffixes are handled as with ‘--from=auto’. + +‘--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-unit=1000’). Suffixes are handled as with ‘--from=auto’. + +‘-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). Note with + ‘-z’ the newline character is treated as a field separator. + +26.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 Electrotechnical + 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 Electrotechnical + 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. + +26.2.3 Examples of using ‘numfmt’ +--------------------------------- + +Converting a single number from/to _human_ representation: + $ numfmt --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== + + +File: coreutils.info, Node: seq invocation, Prev: numfmt invocation, Up: Numeric operations -25.2 `seq': Print numeric sequences +26.3 ‘seq’: Print numeric sequences =================================== -`seq' prints a sequence of numbers to standard output. Synopses: +‘seq’ prints a sequence of numbers to standard output. Synopses: - seq [OPTION]... LAST - seq [OPTION]... FIRST LAST - seq [OPTION]... FIRST INCREMENT LAST + seq [OPTION]… LAST + seq [OPTION]… FIRST LAST + seq [OPTION]… FIRST INCREMENT LAST - `seq' prints the numbers from FIRST to LAST by INCREMENT. By + ‘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 -(using a period before any fractional digits). - - The program accepts the following options. Also see *Note Common +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. The sequence of numbers ends when the sum of +the current number and INCREMENT would become greater than LAST, so ‘seq +1 10 10’ only produces ‘1’. 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' +‘-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' +‘-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'). - + representation. (To have other kinds of padding, use ‘--format’). - You can get finer-grained control over output with `-f': + 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 + If you want hexadecimal integer output, you can use ‘printf’ to perform the conversion: - $ printf '%x\n' `seq 1048575 1024 1050623` + $ 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: + 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'. + 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, but a common case is -that `seq' works with integers through `2^64', and larger integers may -not be numerically correct: - - $ seq 18446744073709551616 1 18446744073709551618 - 18446744073709551616 - 18446744073709551616 - 18446744073709551618 +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: - Be careful when using `seq' with a fractional INCREMENT; otherwise -you may see surprising results. Most people would expect to see -`0.000003' printed as the last number in this example: + $ seq 50000000000000000000 2 50000000000000000004 + 50000000000000000000 + 50000000000000000000 + 50000000000000000004 - $ seq -s ' ' 0 0.000001 0.000003 - 0.000000 0.000001 0.000002 + 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. - But that doesn't happen on many systems because `seq' is implemented -using binary floating point arithmetic (via the C `long double' -type)--which means decimal fractions like `0.000001' cannot be -represented exactly. That in turn means some nonintuitive conditions -like `0.000001 * 3 > 0.000003' will end up being true. + 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: - To work around that in the above example, use a slightly larger -number as the LAST value: + seq 1 0.0000000000000000001 1.0000000000000000009 - $ seq -s ' ' 0 0.000001 0.0000031 - 0.000000 0.000001 0.000002 0.000003 - - In general, when using an INCREMENT with a fractional part, where -(LAST - FIRST) / INCREMENT is (mathematically) a whole number, specify -a slightly larger (or smaller, if INCREMENT is negative) value for LAST -to ensure that LAST is the final value printed by seq. + outputs 1.0000000000000000007 twice and skips 1.0000000000000000008. An exit status of zero indicates success, and a nonzero value indicates failure. @@ -11280,11 +13886,11 @@ indicates failure. File: coreutils.info, Node: File permissions, Next: Date input formats, Prev: Numeric operations, Up: Top -26 File permissions +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 +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. * Menu: @@ -11292,26 +13898,25 @@ symbolic form or as an octal number. * Mode Structure:: Structure of file mode bits. * Symbolic Modes:: Mnemonic representation of file mode bits. * Numeric Modes:: File mode bits as octal numbers. +* Operator Numeric Modes:: ANDing, ORing, and setting modes octally. * Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories. File: coreutils.info, Node: Mode Structure, Next: Symbolic Modes, Up: File permissions -26.1 Structure of File Mode Bits +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 +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. @@ -11319,89 +13924,84 @@ affect only some files. 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; - + 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. +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 + 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'. + 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 + 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". + 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: +(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'. + system are set using ‘chattr’. FFS On FreeBSD the file flags specific to the FFS file system are set - using `chflags'. + using ‘chflags’. - Even if a file's mode bits allow an operation on that file, that + 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-specific attributes or flags do not permit it; or - * the file system is mounted as read-only. + • 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'. +be modified, regardless of the fact that you may have just run ‘chmod +a+w FILE’. File: coreutils.info, Node: Symbolic Modes, Next: Numeric Modes, Prev: Mode Structure, Up: File permissions -26.2 Symbolic Modes +27.2 Symbolic Modes =================== -"Symbolic modes" represent changes to files' mode bits as operations on +“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 +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...[,...] + [ugoa…][-+=]PERMS…[,…] -where PERMS is either zero or more letters from the set `rwxXst', or a -single letter from the set `ugo'. +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. @@ -11418,10 +14018,10 @@ symbolic modes. File: coreutils.info, Node: Setting Permissions, Next: Copying Permissions, Up: Symbolic Modes -26.2.1 Setting Permissions +27.2.1 Setting Permissions -------------------------- -The basic symbolic operations on a file's permissions are adding, +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: @@ -11431,53 +14031,46 @@ following format: 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 + 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. +When more than one of these letters is given, the order that they are in +does not matter. -`u' +‘u’ the user who owns the file; - -`g' - other users who are in the file's group; - -`o' +‘g’ + other users who are in the file’s group; +‘o’ all other users; +‘a’ + all users; the same as ‘ugo’. -`a' - all users; the same as `ugo'. - - The OPERATION part tells how to change the affected users' access to + 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 `=' +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' +‘r’ the permission the USERS have to read the file; - -`w' +‘w’ the permission the USERS have to write to the file; - -`x' +‘x’ the permission the USERS have to execute the file, or search it if it is a directory. @@ -11486,8 +14079,8 @@ file, but not to execute it, use: a=rw - To remove write permission for all users other than the file's -owner, use: + To remove write permission for all users other than the file’s owner, +use: go-w @@ -11495,7 +14088,7 @@ 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 + 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. @@ -11508,46 +14101,45 @@ Another way to specify the same thing is: File: coreutils.info, Node: Copying Permissions, Next: Changing Special Mode Bits, Prev: Setting Permissions, Up: Symbolic Modes -26.2.2 Copying Existing Permissions +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 +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 +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. +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. File: coreutils.info, Node: Changing Special Mode Bits, Next: Conditional Executability, Prev: Copying Permissions, Up: Symbolic Modes -26.2.3 Changing Special Mode Bits +27.2.3 Changing Special Mode Bits --------------------------------- -In addition to changing a file's read, write, and execute/search +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 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 +‘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. +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. +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: @@ -11564,18 +14156,17 @@ 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 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 + 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. +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. @@ -11583,11 +14174,11 @@ set-user-ID and set-group-ID bits and directories. File: coreutils.info, Node: Conditional Executability, Next: Multiple Changes, Prev: Changing Special Mode Bits, Up: Symbolic Modes -26.2.4 Conditional Executability +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 +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: @@ -11600,12 +14191,12 @@ anyone could execute them before. File: coreutils.info, Node: Multiple Changes, Next: Umask and Protection, Prev: Conditional Executability, Up: Symbolic Modes -26.2.5 Making Multiple Changes +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. +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. @@ -11615,11 +14206,10 @@ after a USERS part in the symbolic 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: +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 @@ -11635,14 +14225,14 @@ 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.) +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 +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: @@ -11651,53 +14241,57 @@ different ways; another is: File: coreutils.info, Node: Umask and Protection, Prev: Multiple Changes, Up: Symbolic Modes -26.2.6 The Umask and Protection +27.2.6 The Umask and Protection ------------------------------- -If the USERS part of a symbolic mode is omitted, it defaults to `a' +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. +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. +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: + 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 +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 +ignores ‘umask’, and _does_ give write permission for the file to all users. -File: coreutils.info, Node: Numeric Modes, Next: Directory Setuid and Setgid, Prev: Symbolic Modes, Up: File permissions +File: coreutils.info, Node: Numeric Modes, Next: Operator Numeric Modes, Prev: Symbolic Modes, Up: File permissions -26.3 Numeric Modes +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'. +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. (As -discussed in the next section, the set-user-ID and set-group-ID bits of -directories are an exception to this general limitation.) - - 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 +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 @@ -11726,33 +14320,55 @@ the lowest valued 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='. + 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=’. -File: coreutils.info, Node: Directory Setuid and Setgid, Prev: Numeric Modes, Up: File permissions +File: coreutils.info, Node: Operator Numeric Modes, Next: Directory Setuid and Setgid, Prev: Numeric Modes, Up: File permissions + +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. -26.4 Directories and the Set-User-ID and Set-Group-ID Bits + 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. + + +File: coreutils.info, Node: Directory Setuid and Setgid, Prev: Operator Numeric Modes, Up: File permissions + +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. +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 +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 sets them in a numeric mode. For example, on systems that -support set-group-ID inheritance: +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, @@ -11770,27 +14386,37 @@ 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 H + mkdir G chmod 6755 G - chmod u=rwx,go=rx,a+s H - mkdir -m 6755 I + 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, e.g.: +explicitly in a symbolic mode, or use an operator numeric mode, or +specify a numeric mode with five or more octal digits, e.g.: - # This command tries to clear the set-user-ID + # 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. +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. File: coreutils.info, Node: Date input formats, Next: Opening the software toolbox, Prev: File permissions, Up: Top -27 Date input formats +28 Date input formats ********************* First, a quote: @@ -11798,10 +14424,10 @@ 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 + 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 @@ -11810,90 +14436,87 @@ First, a quote: 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. ... + … 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'. + —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 `get_date' -function) is not described here. +arguments to the various programs. The C interface (via the +‘parse_datetime’ function) is not described here. * Menu: * General date syntax:: Common rules. * Calendar date items:: 19 Dec 1994. * Time of day items:: 9:20pm. -* Time zone items:: EST, PDT, GMT. +* Time zone items:: EST, PDT, UTC, … +* Combined date and time of day items:: 1972-09-24T20:02:00,000000-0500. * Day of week items:: Monday and others. * Relative items in date strings:: next tuesday, 2 years ago. * Pure numbers in date strings:: 19931219, 1440. * Seconds since the Epoch:: @1078100502. * Specifying time zone rules:: TZ="America/New_York", TZ="UTC0". -* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al. +* Authors of parse_datetime:: Bellovin, Eggert, Salz, Berets, et al. File: coreutils.info, Node: General date syntax, Next: Calendar date items, Up: Date input formats -27.1 General date syntax +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. +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 - - * day of the week items - - * relative items - - * pure numbers. + • 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. +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 +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'. +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 + 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: +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 --iso-8601=ns | tr T ' ' # --iso-8601 is a GNU extension. - 2004-02-29 16:21:42,692722128-0800 + $ 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. @@ -11906,18 +14529,18 @@ 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 + 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. File: coreutils.info, Node: Calendar date items, Next: Time of day items, Prev: General date syntax, Up: Date input formats -27.2 Calendar date items +28.2 Calendar date items ======================== -A "calendar date item" specifies a day of the year. It is specified +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: @@ -11941,19 +14564,19 @@ is used, or the current year if none. For example: Here are the rules. - For numeric months, the ISO 8601 format `YEAR-MONTH-DAY' is allowed, + 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. +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 + 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'. +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: @@ -11970,10 +14593,10 @@ any of the following: File: coreutils.info, Node: Time of day items, Next: Time zone items, Prev: Calendar date items, Up: Date input formats -27.3 Time of day items +28.3 Time of day items ====================== -A "time of day item" in date strings specifies the time on a given day. +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 @@ -11981,93 +14604,114 @@ Here are some examples, all of which represent the same time: 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 + 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.) +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. 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). The MINUTE part of -the time of day may not be elided when a time zone correction is used. -This is the best way to specify a time zone correction by fractional -parts of an hour. - - Either `am'/`pm' or a time zone correction may be specified, but not +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. -File: coreutils.info, Node: Time zone items, Next: Day of week items, Prev: Time of day items, Up: Date input formats +File: coreutils.info, Node: Time zone items, Next: Combined date and time of day items, Prev: Time of day items, Up: Date input formats -27.4 Time zone items +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. +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::). -File: coreutils.info, Node: Day of week items, Next: Relative items in date strings, Prev: Time zone items, Up: Date input formats +File: coreutils.info, Node: Combined date and time of day items, Next: Day of week items, Prev: Time zone items, Up: Date input formats + +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-05:00 + 2012-12-31T23:59:59,999999999+11:00 + 1970-01-01 00:00Z + + +File: coreutils.info, Node: Day of week items, Next: Relative items in date strings, Prev: Combined date and time of day items, Up: Date input formats -27.5 Day of week items +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. +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. + 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. +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. File: coreutils.info, Node: Relative items in date strings, Next: Pure numbers in date strings, Prev: Day of week items, Up: Date input formats -27.6 Relative items in date strings +28.7 Relative items in date strings =================================== -"Relative items" adjust a date (or the current date if none) forward or +“Relative items” adjust a date (or the current date if none) forward or backward. The effects of relative items accumulate. Here are some examples: @@ -12076,38 +14720,38 @@ examples: 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 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. +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 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 + 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'. +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 +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: @@ -12120,15 +14764,15 @@ month. For example: 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. +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. File: coreutils.info, Node: Pure numbers in date strings, Next: Seconds since the Epoch, Prev: Relative items in date strings, Up: Date input formats -27.7 Pure numbers in date strings +28.8 Pure numbers in date strings ================================= The precise interpretation of a pure decimal number depends on the @@ -12151,118 +14795,123 @@ overrides the year. File: coreutils.info, Node: Seconds since the Epoch, Next: Specifying time zone rules, Prev: Pure numbers in date strings, Up: Date input formats -27.8 Seconds since the Epoch +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. +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 +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. + 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. -File: coreutils.info, Node: Specifying time zone rules, Next: Authors of get_date, Prev: Seconds since the Epoch, Up: Date input formats +File: coreutils.info, Node: Specifying time zone rules, Next: Authors of parse_datetime, Prev: Seconds since the Epoch, Up: Date input formats -27.9 Specifying time zone rules -=============================== +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 +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' + 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 +‘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.) +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' + 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"'. +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 + 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 +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 +saving regimes. *Note Specifying the Time Zone with ‘TZ’: (libc)TZ Variable. -File: coreutils.info, Node: Authors of get_date, Prev: Specifying time zone rules, Up: Date input formats +File: coreutils.info, Node: Authors of parse_datetime, Prev: Specifying time zone rules, Up: Date input formats -27.10 Authors of `get_date' -=========================== - -`get_date' was originally implemented by Steven M. Bellovin -(<smb@research.att.com>) 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 (<rsalz@bbn.com>) and -Jim Berets (<jberets@bbn.com>) in August, 1990. Various revisions for -the GNU system were made by David MacKenzie, Jim Meyering, Paul Eggert -and others. +28.11 Authors of ‘parse_datetime’ +================================= - This chapter was originally produced by Franc,ois Pinard -(<pinard@iro.umontreal.ca>) from the `getdate.y' source code, and then -edited by K. Berry (<kb@cs.umb.edu>). +‘parse_datetime’ started life as ‘getdate’, as originally implemented by +Steven M. Bellovin (<smb@research.att.com>) 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 +(<rsalz@bbn.com>) and Jim Berets (<jberets@bbn.com>) 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 François Pinard +(<pinard@iro.umontreal.ca>) from the ‘parse_datetime.y’ source code, and +then edited by K. Berry (<kb@cs.umb.edu>). -File: coreutils.info, Node: Opening the software toolbox, Next: Copying This Manual, Prev: Date input formats, Up: Top +File: coreutils.info, Node: Opening the software toolbox, Next: GNU Free Documentation License, Prev: Date input formats, Up: Top -28 Opening the Software Toolbox +29 Opening the Software Toolbox ******************************* -An earlier version of this chapter appeared in 2 (June 1994). It was -written by Arnold Robbins. +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. * Menu: * Toolbox introduction:: Toolbox introduction * I/O redirection:: I/O redirection -* The who command:: The `who' command -* The cut command:: The `cut' command -* The sort command:: The `sort' command -* The uniq command:: The `uniq' command +* The who command:: The ‘who’ command +* The cut command:: The ‘cut’ command +* The sort command:: The ‘sort’ command +* The uniq command:: The ‘uniq’ command * Putting the tools together:: Putting the tools together @@ -12271,34 +14920,34 @@ File: coreutils.info, Node: Toolbox introduction, Next: I/O redirection, Up: 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. +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. +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 +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 + 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 +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-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, @@ -12308,19 +14957,19 @@ one program to use, in practice such programs are 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 +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.) +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.) File: coreutils.info, Node: I/O redirection, Next: The who command, Prev: Toolbox introduction, Up: Opening the software toolbox @@ -12329,29 +14978,29 @@ 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: +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. +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 +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 +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 @@ -12362,88 +15011,88 @@ screen. 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 +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.) +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. + 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. File: coreutils.info, Node: The who command, Next: The cut command, Prev: I/O redirection, Up: Opening the software toolbox -The `who' Command +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: +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) + ⊣ 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'. + 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. +output of ‘who’ is nice, but the data is not all that exciting. File: coreutils.info, Node: The cut command, Next: The sort command, Prev: The who command, Up: Opening the software toolbox -The `cut' Command +The ‘cut’ Command ================= -The next program we'll look at is the `cut' command. This program cuts +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: +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: + 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 - ... + ⊣ root:Operator + … + ⊣ arnold:Arnold D. Robbins + ⊣ miriam:Miriam A. Robbins + … - With the `-c' option, `cut' will cut out specific characters (i.e., + 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 + ⊣Mo + ⊣ + ⊣ 6 + ⊣ 13 + ⊣ 20 + ⊣ 27 File: coreutils.info, Node: The sort command, Next: The uniq command, Prev: The cut command, Up: Opening the software toolbox -The `sort' Command +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. +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 + 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 @@ -12452,17 +15101,17 @@ collating sequence or based on user-supplied ordering criteria. File: coreutils.info, Node: The uniq command, Next: Putting the tools together, Prev: The sort command, Up: Opening the software toolbox -The `uniq' Command +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. +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. File: coreutils.info, Node: Putting the tools together, Prev: The uniq command, Up: Opening the software toolbox @@ -12470,11 +15119,11 @@ File: coreutils.info, Node: Putting the tools together, Prev: The uniq command 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. +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 @@ -12483,33 +15132,33 @@ 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 + ⊣ arnold + ⊣ miriam + ⊣ bill + ⊣ arnold Next, sort the list: $ who | cut -c1-8 | sort - -| arnold - -| arnold - -| bill - -| miriam + ⊣ arnold + ⊣ arnold + ⊣ bill + ⊣ miriam - Finally, run the sorted list through `uniq', to weed out duplicates: + Finally, run the sorted list through ‘uniq’, to weed out duplicates: $ who | cut -c1-8 | sort | uniq - -| arnold - -| bill - -| miriam + ⊣ 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 ‘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): +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 @@ -12521,16 +15170,16 @@ 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 +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. + 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 + 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. @@ -12539,81 +15188,81 @@ 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, + 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 + 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! + ⊣ this example has mixed case! There are several options of interest: -`-c' +‘-c’ work on the complement of the listed characters, i.e., operations apply to characters not in the given set -`-d' +‘-d’ delete characters in the first set from the output -`-s' +‘-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: + 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 + ⊣ 11111 + ⊣ 22222 + ⊣ 33333 + ⊣ 44444 $ cat f2 - -| 00000 - -| 22222 - -| 33333 - -| 55555 + ⊣ 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 + ⊣ 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 + 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 +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 +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 + 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 +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 @@ -12625,14 +15274,14 @@ 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.) + This command turns blanks into newlines. The ‘-s’ option squeezes +multiple newline characters in the output into just one, removing 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: + 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 | ... @@ -12650,37 +15299,37 @@ all one case. We're ready to count each word: 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: +with the help of two more ‘sort’ options: -`-n' +‘-n’ do a numeric sort, not a textual one -`-r' +‘-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. + ⊣ 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 +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 is a sorted, 45,402 word 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: @@ -12688,14 +15337,14 @@ 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. + 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 + 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 @@ -12704,26 +15353,26 @@ spelling checker on Unix. There are some other tools that deserve brief mention. -`grep' +‘grep’ search files for text that matches a regular expression -`wc' +‘wc’ count lines, words, characters -`tee' +‘tee’ a T-fitting for data pipes, copies data to files and to standard output -`sed' +‘sed’ the stream editor, an advanced tool -`awk' +‘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. +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: @@ -12734,44 +15383,43 @@ rest of the way until it's in the form that you want. 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 + 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 + 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.) + As of this writing, all the programs discussed are available from +<http://ftp.gnu.org/old-gnu/textutils/textutils-1.22.tar.gz>, with more +recent versions available from <http://ftp.gnu.org/gnu/coreutils>. None of what I have presented in this column is new. The Software -Tools philosophy was first introduced in the book `Software Tools', by +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 +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. +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 + 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 + 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 +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. +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. @@ -12785,25 +15433,15 @@ this column. (1) Redhat Linux 6.1, for the November 2000 revision of this article. -File: coreutils.info, Node: Copying This Manual, Next: Index, Prev: Opening the software toolbox, Up: Top +File: coreutils.info, Node: GNU Free Documentation License, Next: Concept index, Prev: Opening the software toolbox, Up: Top -Appendix A Copying This Manual -****************************** +Appendix A GNU Free Documentation License +***************************************** -* Menu: - -* GNU Free Documentation License:: License for copying this manual. + Version 1.3, 3 November 2008 - -File: coreutils.info, Node: GNU Free Documentation License, Up: Copying This Manual - -A.1 GNU Free Documentation License -================================== - - Version 1.2, November 2002 - - Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + Copyright © 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. @@ -12811,14 +15449,14 @@ A.1 GNU Free Documentation License 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 + 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 + 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. @@ -12828,29 +15466,29 @@ A.1 GNU Free Documentation License 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 + 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 + 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. + “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 + 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 + 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 + 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 @@ -12859,59 +15497,62 @@ A.1 GNU Free Documentation License 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 “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 + 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, + 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". + 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, + 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. + 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 + 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 + “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 @@ -12931,8 +15572,8 @@ A.1 GNU Free Documentation License 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. + 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. @@ -12941,17 +15582,16 @@ A.1 GNU Free Documentation License 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 + 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. + 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 @@ -12959,40 +15599,39 @@ A.1 GNU Free Documentation License 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. + 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. + 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: + 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. + 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 @@ -13015,72 +15654,71 @@ A.1 GNU Free Documentation License the Addendum below. G. Preserve in that license notice the full lists of Invariant - Sections and required Cover Texts given in the Document's + 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, + 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. + 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 + 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. + 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 + 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 + “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. + 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 + 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. + 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. + 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 @@ -13090,8 +15728,8 @@ A.1 GNU Free Documentation License 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, + 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. @@ -13107,10 +15745,10 @@ A.1 GNU Free Documentation License 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." + “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 @@ -13118,29 +15756,29 @@ A.1 GNU Free Documentation License 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. + 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. + 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 + 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 + 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 + 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 @@ -13162,38 +15800,88 @@ A.1 GNU Free Documentation License 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 + 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 for under this License. Any other - attempt to copy, modify, sublicense or distribute the Document is - void, and will automatically terminate your rights under this - License. However, parties who have received copies, or rights, - from you under this License will not have their licenses - terminated so long as such parties remain in full compliance. - - 10. FUTURE REVISIONS OF THIS LICENSE + 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/'. + <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 + 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. + 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 ==================================================== @@ -13204,14 +15892,14 @@ 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.2 + 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: +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 @@ -13222,12 +15910,12 @@ 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. +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. -File: coreutils.info, Node: Index, Prev: Copying This Manual, Up: Top +File: coreutils.info, Node: Concept index, Prev: GNU Free Documentation License, Up: Top Index ***** @@ -13236,1127 +15924,1475 @@ Index * Menu: * !: Connectives for test. - (line 9) -* !=: String tests. (line 25) -* %: Numeric expressions. (line 15) -* %b: printf invocation. (line 32) + (line 23) +* !=: String tests. (line 28) +* %: Numeric expressions. (line 16) +* %b: printf invocation. (line 37) +* %q: printf invocation. (line 44) * &: Relations for expr. (line 17) -* *: Numeric expressions. (line 15) -* + <1>: Numeric expressions. (line 11) +* *: Numeric expressions. (line 16) * +: String expressions. (line 53) -* +PAGE_RANGE: pr invocation. (line 60) -* - <1>: su invocation. (line 53) -* - <2>: env invocation. (line 45) -* -: Numeric expressions. (line 11) -* - and Unix rm: rm invocation. (line 110) -* -, removing files beginning with: rm invocation. (line 98) -* --: Common options. (line 36) -* --across: pr invocation. (line 84) +* + <1>: Numeric expressions. (line 12) +* +PAGE_RANGE: pr invocation. (line 39) +* -: Numeric expressions. (line 12) +* - <1>: env invocation. (line 94) +* - and Unix ‘rm’: rm invocation. (line 111) +* ‘-’, removing files beginning with: rm invocation. (line 99) +* --: Common options. (line 43) +* --across: pr invocation. (line 62) +* --additional-suffix: split invocation. (line 129) * --address-radix: od invocation. (line 36) -* --adjustment: nice invocation. (line 44) -* --all <1>: uname invocation. (line 30) -* --all <2>: who invocation. (line 36) -* --all <3>: stty invocation. (line 26) -* --all <4>: du invocation. (line 21) -* --all <5>: df invocation. (line 32) -* --all <6>: Which files are listed. - (line 13) +* --adjustment: nice invocation. (line 51) * --all: unexpand invocation. (line 37) +* --all <1>: Which files are listed. + (line 13) +* --all <2>: df invocation. (line 42) +* --all <3>: du invocation. (line 32) +* --all <4>: stty invocation. (line 26) +* --all <5>: who invocation. (line 35) +* --all <6>: nproc invocation. (line 19) +* --all <7>: uname invocation. (line 30) * --all-repeated: uniq invocation. (line 69) * --almost-all: Which files are listed. (line 17) -* --apparent-size: du invocation. (line 24) -* --append: tee invocation. (line 25) -* --archive: cp invocation. (line 54) +* --apparent-size: du invocation. (line 35) +* --append: tee invocation. (line 27) +* --archive: cp invocation. (line 63) +* --attributes-only: cp invocation. (line 72) * --author: What information is listed. (line 10) -* --backup <1>: ln invocation. (line 55) -* --backup <2>: mv invocation. (line 50) -* --backup <3>: install invocation. (line 40) -* --backup <4>: cp invocation. (line 61) +* --auto-reference: Output formatting in ptx. + (line 45) * --backup: Backup options. (line 13) +* --backup <1>: cp invocation. (line 79) +* --backup <2>: install invocation. (line 41) +* --backup <3>: mv invocation. (line 59) +* --backup <4>: ln invocation. (line 80) +* --batch-size: sort invocation. (line 256) * --before: tac invocation. (line 21) -* --binary: md5sum invocation. (line 38) -* --block-size <1>: du invocation. (line 45) -* --block-size <2>: df invocation. (line 38) -* --block-size: Block size. (line 138) +* --binary: md5sum invocation. (line 40) +* --block-size: Block size. (line 121) +* --block-size <1>: df invocation. (line 54) +* --block-size <2>: du invocation. (line 52) * --block-size=SIZE: Block size. (line 12) -* --body-numbering: nl invocation. (line 47) -* --boot: who invocation. (line 40) +* --body-numbering: nl invocation. (line 45) +* --boot: who invocation. (line 39) * --bourne-shell: dircolors invocation. - (line 27) -* --buffer-size: sort invocation. (line 237) -* --bytes <1>: du invocation. (line 41) -* --bytes <2>: cut invocation. (line 26) -* --bytes <3>: wc invocation. (line 41) -* --bytes <4>: split invocation. (line 37) -* --bytes <5>: tail invocation. (line 36) -* --bytes <6>: head invocation. (line 24) + (line 34) +* --break-file: Input processing in ptx. + (line 8) +* --buffer-size: sort invocation. (line 307) * --bytes: fold invocation. (line 23) +* --bytes <1>: head invocation. (line 24) +* --bytes <2>: tail invocation. (line 39) +* --bytes <3>: split invocation. (line 41) +* --bytes <4>: wc invocation. (line 43) +* --bytes <5>: cut invocation. (line 26) +* --bytes <6>: du invocation. (line 57) * --c-shell: dircolors invocation. - (line 33) -* --canonicalize: readlink invocation. (line 29) -* --canonicalize-existing: readlink invocation. (line 35) -* --canonicalize-missing: readlink invocation. (line 41) -* --changes <1>: chmod invocation. (line 39) -* --changes <2>: chgrp invocation. (line 20) -* --changes: chown invocation. (line 70) + (line 40) +* --canonicalize: readlink invocation. (line 30) +* --canonicalize-existing: readlink invocation. (line 37) +* --canonicalize-existing <1>: realpath invocation. (line 17) +* --canonicalize-missing: readlink invocation. (line 44) +* --canonicalize-missing <1>: realpath invocation. (line 25) +* --changes: chown invocation. (line 73) +* --changes <1>: chgrp invocation. (line 24) +* --changes <2>: chmod invocation. (line 39) * --characters: cut invocation. (line 34) -* --chars: wc invocation. (line 45) -* --check: sort invocation. (line 18) -* --check-chars: uniq invocation. (line 103) +* --chars: wc invocation. (line 47) +* --check: sort invocation. (line 39) +* --check <1>: sort invocation. (line 47) +* --check-chars: uniq invocation. (line 133) * --classify: General output formatting. - (line 36) + (line 47) * --color: General output formatting. - (line 21) -* --columns: pr invocation. (line 70) -* --command: su invocation. (line 39) -* --complement: cut invocation. (line 71) -* --count <1>: who invocation. (line 55) + (line 22) +* --columns: pr invocation. (line 49) +* --compare: install invocation. (line 46) +* --complement: cut invocation. (line 82) +* --compute: runcon invocation. (line 27) +* --context: What information is listed. + (line 255) +* --context <1>: cp invocation. (line 378) +* --context <2>: install invocation. (line 139) +* --context <3>: mv invocation. (line 115) +* --context <4>: mkdir invocation. (line 56) +* --context <5>: mkfifo invocation. (line 28) +* --context <6>: mknod invocation. (line 53) +* --context <7>: id invocation. (line 51) * --count: uniq invocation. (line 55) -* --count-links: du invocation. (line 91) +* --count <1>: who invocation. (line 69) +* --count-links: du invocation. (line 123) * --crown-margin: fmt invocation. (line 34) * --csh: dircolors invocation. - (line 33) + (line 40) +* --data: sync invocation. (line 32) +* --date: touch invocation. (line 86) * --date <1>: Options for date. (line 11) -* --date: touch invocation. (line 58) -* --dead: who invocation. (line 44) -* --decode: base64 invocation. (line 29) -* --delimiter: cut invocation. (line 51) -* --delimiters: paste invocation. (line 43) -* --dereference <1>: stat invocation. (line 17) -* --dereference <2>: du invocation. (line 96) -* --dereference <3>: chgrp invocation. (line 30) -* --dereference <4>: chown invocation. (line 103) -* --dereference <5>: cp invocation. (line 125) +* --dead: who invocation. (line 43) +* --debug: numfmt invocation. (line 29) +* --decode: base64 invocation. (line 31) +* --delimiter: cut invocation. (line 62) +* --delimiter <1>: numfmt invocation. (line 34) +* --delimiters: paste invocation. (line 61) * --dereference: Which files are listed. (line 83) -* --dereference-args: du invocation. (line 56) +* --dereference <1>: cp invocation. (line 148) +* --dereference <2>: chown invocation. (line 106) +* --dereference <3>: chgrp invocation. (line 34) +* --dereference <4>: du invocation. (line 117) +* --dereference <5>: stat invocation. (line 22) +* --dereference <6>: chcon invocation. (line 21) +* --dereference-args: du invocation. (line 67) * --dereference-command-line: Which files are listed. (line 36) * --dereference-command-line-symlink-to-dir: Which files are listed. (line 41) -* --dictionary-order: sort invocation. (line 85) -* --digits: csplit invocation. (line 80) -* --directory <1>: ln invocation. (line 61) -* --directory <2>: install invocation. (line 48) +* --dictionary-order: sort invocation. (line 87) +* --digits: csplit invocation. (line 79) +* --dir: rm invocation. (line 35) * --directory: Which files are listed. (line 28) +* --directory <1>: install invocation. (line 67) +* --directory <2>: ln invocation. (line 86) +* --directory <3>: mktemp invocation. (line 85) * --dired: What information is listed. (line 16) -* --double-space: pr invocation. (line 96) +* --double-space: pr invocation. (line 74) +* --dry-run: mktemp invocation. (line 97) * --echo: shuf invocation. (line 19) -* --elide-empty-files: csplit invocation. (line 89) +* --elide-empty-files: split invocation. (line 134) +* --elide-empty-files <1>: csplit invocation. (line 93) +* --endian: od invocation. (line 51) +* --equal-width: seq invocation. (line 47) +* --error: stdbuf invocation. (line 34) * --escape: Formatting the file names. (line 11) -* --exact: shred invocation. (line 133) -* --exclude-from=FILE: du invocation. (line 201) -* --exclude-type: df invocation. (line 138) -* --exclude=PATTERN: du invocation. (line 195) -* --expand-tabs: pr invocation. (line 120) -* --fast: su invocation. (line 44) -* --field-separator: sort invocation. (line 253) -* --fields: cut invocation. (line 44) -* --file <1>: Options for date. (line 22) +* --exact: shred invocation. (line 142) +* --exclude-from=FILE: du invocation. (line 250) +* --exclude-type: df invocation. (line 223) +* --exclude=PATTERN: du invocation. (line 255) +* --expand-tabs: pr invocation. (line 98) +* --field: numfmt invocation. (line 38) +* --field-separator: sort invocation. (line 323) +* --fields: cut invocation. (line 43) * --file: stty invocation. (line 31) -* --file-system: stat invocation. (line 23) +* --file <1>: Options for date. (line 26) +* --file-system: stat invocation. (line 28) +* --file-system <1>: sync invocation. (line 37) * --file-type: General output formatting. - (line 47) -* --files0-from=FILE <1>: du invocation. (line 62) -* --files0-from=FILE: wc invocation. (line 60) -* --first-line-number: pr invocation. (line 198) -* --follow: tail invocation. (line 41) -* --footer-numbering: nl invocation. (line 75) -* --force <1>: ln invocation. (line 67) -* --force <2>: shred invocation. (line 101) -* --force <3>: rm invocation. (line 35) -* --force <4>: mv invocation. (line 55) -* --force: cp invocation. (line 96) -* --form-feed: pr invocation. (line 128) -* --format <1>: General output formatting. + (line 58) +* --files0-from=FILE: wc invocation. (line 64) +* --files0-from=FILE <1>: sort invocation. (line 218) +* --files0-from=FILE <2>: du invocation. (line 79) +* --filter: split invocation. (line 62) +* --first-line-number: pr invocation. (line 174) +* --flag-truncation: Output formatting in ptx. + (line 71) +* --follow: tail invocation. (line 55) +* --footer-numbering: nl invocation. (line 70) +* --force: cp invocation. (line 115) +* --force <1>: mv invocation. (line 64) +* --force <2>: rm invocation. (line 39) +* --force <3>: shred invocation. (line 101) +* --force <4>: ln invocation. (line 92) +* --foreground: timeout invocation. (line 24) +* --form-feed: pr invocation. (line 106) +* --format: od invocation. (line 89) +* --format <1>: What information is listed. + (line 131) +* --format <2>: General output formatting. (line 10) -* --format <2>: What information is listed. - (line 130) -* --format: od invocation. (line 76) -* --format=FORMAT <1>: seq invocation. (line 24) -* --format=FORMAT: stat invocation. (line 28) -* --from: chown invocation. (line 80) +* --format <3>: General output formatting. + (line 16) +* --format <4>: General output formatting. + (line 93) +* --format <5>: General output formatting. + (line 103) +* --format <6>: numfmt invocation. (line 48) +* --format <7>: seq invocation. (line 26) +* --format=FORMAT: stat invocation. (line 34) +* --format=roff: Output formatting in ptx. + (line 100) +* --format=tex: Output formatting in ptx. + (line 118) +* --from: chown invocation. (line 83) +* --from <1>: numfmt invocation. (line 59) +* --from-unit: numfmt invocation. (line 64) * --full-time: What information is listed. (line 100) -* --general-numeric-sort: sort invocation. (line 98) -* --group <1>: id invocation. (line 23) -* --group: install invocation. (line 54) +* --gap-size: Output formatting in ptx. + (line 26) +* --general-numeric-sort: sort invocation. (line 105) +* --goal: fmt invocation. (line 64) +* --group: uniq invocation. (line 100) +* --group <1>: install invocation. (line 73) +* --group <2>: id invocation. (line 29) * --group-directories-first: Which files are listed. (line 50) -* --groups: id invocation. (line 27) +* --grouping: numfmt invocation. (line 70) +* --groups: id invocation. (line 33) +* --groups <1>: chroot invocation. (line 24) * --hardware-platform: uname invocation. (line 35) -* --head-lines: shuf invocation. (line 32) -* --header: pr invocation. (line 134) -* --header-numbering: nl invocation. (line 79) -* --heading: who invocation. (line 48) -* --help: Common options. (line 29) +* --head-count: shuf invocation. (line 31) +* --header: pr invocation. (line 111) +* --header <1>: join invocation. (line 87) +* --header <2>: numfmt invocation. (line 76) +* --header-numbering: nl invocation. (line 74) +* --header=N: numfmt invocation. (line 76) +* --heading: who invocation. (line 47) +* --help: Common options. (line 36) * --hide-control-chars: Formatting the file names. (line 23) * --hide=PATTERN: Which files are listed. - (line 56) -* --human-readable <1>: du invocation. (line 75) -* --human-readable <2>: df invocation. (line 43) -* --human-readable <3>: What information is listed. + (line 57) +* --human-numeric-sort: sort invocation. (line 126) +* --human-readable: Block size. (line 121) +* --human-readable <1>: What information is listed. (line 116) -* --human-readable: Block size. (line 138) +* --human-readable <2>: df invocation. (line 59) +* --human-readable <3>: du invocation. (line 96) +* --ignore: nproc invocation. (line 25) * --ignore-backups: Which files are listed. (line 23) -* --ignore-case <1>: join invocation. (line 69) -* --ignore-case <2>: uniq invocation. (line 59) -* --ignore-case: sort invocation. (line 92) -* --ignore-environment: env invocation. (line 45) +* --ignore-case: sort invocation. (line 94) +* --ignore-case <1>: uniq invocation. (line 59) +* --ignore-case <2>: Charset selection in ptx. + (line 18) +* --ignore-case <3>: join invocation. (line 97) +* --ignore-environment: env invocation. (line 94) * --ignore-fail-on-non-empty: rmdir invocation. (line 17) -* --ignore-garbage: base64 invocation. (line 35) -* --ignore-interrupts: tee invocation. (line 30) +* --ignore-file: Input processing in ptx. + (line 26) +* --ignore-garbage: base64 invocation. (line 37) +* --ignore-interrupts: tee invocation. (line 32) * --ignore-leading-blanks: sort invocation. (line 79) -* --ignore-nonprinting: sort invocation. (line 125) +* --ignore-missing: md5sum invocation. (line 74) +* --ignore-nonprinting: sort invocation. (line 143) * --ignore=PATTERN: Which files are listed. (line 69) -* --indent: pr invocation. (line 204) +* --indent: pr invocation. (line 180) * --indicator-style: General output formatting. - (line 36) -* --initial: expand invocation. (line 34) + (line 47) +* --indicator-style <1>: General output formatting. + (line 58) +* --indicator-style <2>: General output formatting. + (line 62) +* --indicator-style <3>: General output formatting. + (line 98) +* --initial: expand invocation. (line 33) * --inode: What information is listed. - (line 122) -* --inodes: df invocation. (line 52) + (line 123) +* --inodes: df invocation. (line 69) +* --inodes <1>: du invocation. (line 102) +* --input: stdbuf invocation. (line 26) * --input-range: shuf invocation. (line 23) -* --interactive <1>: ln invocation. (line 71) -* --interactive <2>: rm invocation. (line 50) -* --interactive <3>: mv invocation. (line 59) -* --interactive: cp invocation. (line 116) -* --iterations=NUMBER: shred invocation. (line 106) -* --join-blank-lines: nl invocation. (line 87) -* --join-lines: pr invocation. (line 147) -* --keep-files: csplit invocation. (line 85) -* --kernel-name: uname invocation. (line 65) -* --kernel-release: uname invocation. (line 61) -* --kernel-version: uname invocation. (line 76) -* --key: sort invocation. (line 193) -* --length: pr invocation. (line 156) -* --line-bytes: split invocation. (line 43) -* --lines <1>: wc invocation. (line 53) -* --lines <2>: split invocation. (line 30) -* --lines <3>: tail invocation. (line 130) -* --lines: head invocation. (line 30) -* --link: cp invocation. (line 121) +* --interactive: cp invocation. (line 138) +* --interactive <1>: mv invocation. (line 70) +* --interactive <2>: rm invocation. (line 54) +* --interactive <3>: ln invocation. (line 96) +* --invalid: numfmt invocation. (line 79) +* --io-blocks: truncate invocation. (line 26) +* --iso-8601[=TIMESPEC]: Options for date. (line 34) +* --iterations=NUMBER: shred invocation. (line 105) +* --join-blank-lines: nl invocation. (line 82) +* --join-lines: pr invocation. (line 124) +* --keep-files: csplit invocation. (line 84) +* --kernel-name: uname invocation. (line 66) +* --kernel-release: uname invocation. (line 62) +* --kernel-version: uname invocation. (line 77) +* --key: sort invocation. (line 231) +* --kibibytes: General output formatting. + (line 81) +* --kill-after: timeout invocation. (line 41) +* --length: pr invocation. (line 133) +* --line-bytes: split invocation. (line 55) +* --line-increment: nl invocation. (line 78) +* --lines: head invocation. (line 39) +* --lines <1>: tail invocation. (line 123) +* --lines <2>: split invocation. (line 33) +* --lines <3>: wc invocation. (line 55) +* --link: cp invocation. (line 144) * --literal: Formatting the file names. (line 17) -* --local: df invocation. (line 63) -* --login <1>: su invocation. (line 53) -* --login: who invocation. (line 68) -* --lookup: who invocation. (line 73) -* --machine: uname invocation. (line 41) -* --max-depth=DEPTH: du invocation. (line 111) -* --max-line-length: wc invocation. (line 57) -* --max-unchanged-stats: tail invocation. (line 118) -* --merge <1>: sort invocation. (line 32) -* --merge: pr invocation. (line 164) -* --mesg: who invocation. (line 86) -* --message: who invocation. (line 86) -* --mode <1>: mknod invocation. (line 43) +* --local: df invocation. (line 80) +* --logical: ln invocation. (line 100) +* --logical <1>: realpath invocation. (line 30) +* --logical <2>: pwd invocation. (line 15) +* --login: who invocation. (line 51) +* --lookup: who invocation. (line 56) +* --machine: uname invocation. (line 42) +* --macro-name: Output formatting in ptx. + (line 94) +* --max-depth=DEPTH: du invocation. (line 74) +* --max-line-length: wc invocation. (line 59) +* --max-unchanged-stats: tail invocation. (line 111) +* --merge: pr invocation. (line 140) +* --merge <1>: sort invocation. (line 53) +* --mesg: who invocation. (line 94) +* --message: who invocation. (line 94) +* --mode: install invocation. (line 79) +* --mode <1>: mkdir invocation. (line 19) * --mode <2>: mkfifo invocation. (line 21) -* --mode <3>: mkdir invocation. (line 19) -* --mode: install invocation. (line 60) -* --month-sort: sort invocation. (line 131) -* --name: id invocation. (line 31) -* --no-create: touch invocation. (line 54) -* --no-dereference <1>: du invocation. (line 107) -* --no-dereference <2>: chgrp invocation. (line 35) -* --no-dereference <3>: chown invocation. (line 108) -* --no-dereference <4>: ln invocation. (line 75) -* --no-dereference: cp invocation. (line 129) -* --no-file-warnings: pr invocation. (line 211) +* --mode <3>: mknod invocation. (line 47) +* --month-sort: sort invocation. (line 150) +* --multiple: basename invocation. (line 32) +* --name: id invocation. (line 37) +* --no-clobber: cp invocation. (line 155) +* --no-clobber <1>: mv invocation. (line 77) +* --no-create: touch invocation. (line 82) +* --no-create <1>: truncate invocation. (line 22) +* --no-dereference: cp invocation. (line 161) +* --no-dereference <1>: ln invocation. (line 106) +* --no-dereference <2>: chown invocation. (line 111) +* --no-dereference <3>: chgrp invocation. (line 39) +* --no-dereference <4>: touch invocation. (line 100) +* --no-dereference <5>: du invocation. (line 133) +* --no-dereference <6>: chcon invocation. (line 26) +* --no-file-warnings: pr invocation. (line 187) * --no-group: What information is listed. (line 110) -* --no-newline: readlink invocation. (line 46) -* --no-preserve-root <1>: chmod invocation. (line 54) -* --no-preserve-root <2>: chgrp invocation. (line 48) -* --no-preserve-root <3>: chown invocation. (line 121) -* --no-preserve-root: rm invocation. (line 84) -* --no-renumber: nl invocation. (line 108) -* --no-sync: df invocation. (line 67) -* --no-target-directory <1>: ln invocation. (line 109) -* --no-target-directory <2>: mv invocation. (line 103) -* --no-target-directory <3>: install invocation. (line 101) -* --no-target-directory <4>: cp invocation. (line 272) +* --no-newline: readlink invocation. (line 49) +* --no-preserve-root: rm invocation. (line 86) +* --no-preserve-root <1>: chown invocation. (line 124) +* --no-preserve-root <2>: chgrp invocation. (line 52) +* --no-preserve-root <3>: chmod invocation. (line 54) +* --no-preserve-root <4>: chcon invocation. (line 43) +* --no-renumber: nl invocation. (line 101) +* --no-symlinks: realpath invocation. (line 69) +* --no-sync: df invocation. (line 84) * --no-target-directory: Target directory. (line 15) -* --nodename: uname invocation. (line 46) -* --null: du invocation. (line 117) +* --no-target-directory <1>: cp invocation. (line 349) +* --no-target-directory <2>: install invocation. (line 130) +* --no-target-directory <3>: mv invocation. (line 110) +* --no-target-directory <4>: ln invocation. (line 173) +* --nodename: uname invocation. (line 47) +* --null: du invocation. (line 26) +* --null <1>: printenv invocation. (line 19) +* --null <2>: env invocation. (line 82) * --number: cat invocation. (line 31) -* --number-format: nl invocation. (line 95) -* --number-lines: pr invocation. (line 177) +* --number <1>: split invocation. (line 78) +* --number-format: nl invocation. (line 90) +* --number-lines: pr invocation. (line 153) * --number-nonblank: cat invocation. (line 20) -* --number-separator: nl invocation. (line 112) -* --number-width: nl invocation. (line 122) -* --numeric-sort: sort invocation. (line 140) -* --numeric-suffixes: split invocation. (line 51) +* --number-separator: nl invocation. (line 105) +* --number-width: nl invocation. (line 115) +* --numeric-sort: sort invocation. (line 160) +* --numeric-suffixes: split invocation. (line 116) * --numeric-uid-gid: What information is listed. - (line 232) -* --omit-header: pr invocation. (line 235) -* --omit-pagination: pr invocation. (line 246) -* --one-file-system <1>: du invocation. (line 191) -* --one-file-system <2>: rm invocation. (line 63) -* --one-file-system: cp invocation. (line 291) -* --only-delimited: cut invocation. (line 59) -* --operating-system: uname invocation. (line 57) -* --output <1>: shuf invocation. (line 37) -* --output: sort invocation. (line 213) -* --output-delimiter: cut invocation. (line 64) -* --output-duplicates: od invocation. (line 146) -* --output-tabs: pr invocation. (line 140) -* --owner: install invocation. (line 72) -* --page-increment: nl invocation. (line 83) -* --page_width: pr invocation. (line 264) -* --pages=PAGE_RANGE: pr invocation. (line 60) -* --parents <1>: rmdir invocation. (line 22) -* --parents <2>: mkdir invocation. (line 34) -* --parents: cp invocation. (line 177) -* --pid: tail invocation. (line 98) -* --portability <1>: pathchk invocation. (line 46) -* --portability: df invocation. (line 74) -* --prefix: csplit invocation. (line 62) -* --preserve: cp invocation. (line 134) -* --preserve-environment: su invocation. (line 64) -* --preserve-root <1>: chmod invocation. (line 49) -* --preserve-root <2>: chgrp invocation. (line 43) -* --preserve-root <3>: chown invocation. (line 116) -* --preserve-root: rm invocation. (line 79) -* --preserve-timestamps: install invocation. (line 78) + (line 222) +* --omit-header: pr invocation. (line 210) +* --omit-pagination: pr invocation. (line 220) +* --one-file-system: cp invocation. (line 372) +* --one-file-system <1>: rm invocation. (line 65) +* --one-file-system <2>: du invocation. (line 261) +* --only-delimited: cut invocation. (line 70) +* --only-file: Input processing in ptx. + (line 35) +* --operating-system: uname invocation. (line 58) +* --output: sort invocation. (line 282) +* --output <1>: shuf invocation. (line 36) +* --output <2>: df invocation. (line 91) +* --output <3>: stdbuf invocation. (line 30) +* --output-delimiter: cut invocation. (line 75) +* --output-duplicates: od invocation. (line 149) +* --output-error: tee invocation. (line 36) +* --output-tabs: pr invocation. (line 117) +* --owner: install invocation. (line 91) +* --padding: numfmt invocation. (line 87) +* --pages=PAGE_RANGE: pr invocation. (line 39) +* --page_width: pr invocation. (line 239) +* --parallel: sort invocation. (line 352) +* --parents: cp invocation. (line 238) +* --parents <1>: mkdir invocation. (line 34) +* --parents <2>: rmdir invocation. (line 22) +* --physical: ln invocation. (line 125) +* --physical <1>: realpath invocation. (line 35) +* --physical <2>: pwd invocation. (line 22) +* --pid: tail invocation. (line 129) +* --portability: df invocation. (line 148) +* --portability <1>: pathchk invocation. (line 44) +* --prefix: csplit invocation. (line 61) +* --preserve: cp invocation. (line 168) +* --preserve-context: install invocation. (line 96) +* --preserve-root: rm invocation. (line 81) +* --preserve-root <1>: chown invocation. (line 119) +* --preserve-root <2>: chgrp invocation. (line 47) +* --preserve-root <3>: chmod invocation. (line 49) +* --preserve-root <4>: chcon invocation. (line 38) +* --preserve-status: timeout invocation. (line 18) +* --preserve-timestamps: install invocation. (line 103) * --print-database: dircolors invocation. - (line 38) -* --print-type: df invocation. (line 113) -* --printf=FORMAT: stat invocation. (line 37) -* --processor: uname invocation. (line 50) -* --quiet <1>: tty invocation. (line 18) -* --quiet <2>: chmod invocation. (line 45) -* --quiet <3>: chgrp invocation. (line 26) -* --quiet <4>: chown invocation. (line 76) -* --quiet <5>: readlink invocation. (line 52) -* --quiet <6>: csplit invocation. (line 100) -* --quiet <7>: tail invocation. (line 135) -* --quiet: head invocation. (line 36) + (line 45) +* --print-type: df invocation. (line 200) +* --printf=FORMAT: stat invocation. (line 43) +* --process: who invocation. (line 65) +* --processor: uname invocation. (line 51) +* --quiet: head invocation. (line 46) +* --quiet <1>: tail invocation. (line 151) +* --quiet <2>: csplit invocation. (line 104) +* --quiet <3>: md5sum invocation. (line 80) +* --quiet <4>: readlink invocation. (line 56) +* --quiet <5>: chown invocation. (line 79) +* --quiet <6>: chgrp invocation. (line 30) +* --quiet <7>: chmod invocation. (line 45) +* --quiet <8>: mktemp invocation. (line 92) +* --quiet <9>: realpath invocation. (line 41) +* --quiet <10>: tty invocation. (line 18) * --quote-name: Formatting the file names. (line 30) * --quoting-style: Formatting the file names. (line 11) -* --random-sort: sort invocation. (line 162) -* --random-source <1>: shred invocation. (line 112) -* --random-source <2>: shuf invocation. (line 43) -* --random-source: sort invocation. (line 226) -* --read-bytes: od invocation. (line 63) -* --real: id invocation. (line 36) -* --recursive <1>: chmod invocation. (line 69) -* --recursive <2>: chgrp invocation. (line 66) -* --recursive <3>: chown invocation. (line 140) -* --recursive <4>: rm invocation. (line 91) -* --recursive <5>: cp invocation. (line 200) +* --quoting-style <1>: Formatting the file names. + (line 17) +* --quoting-style <2>: Formatting the file names. + (line 30) +* --quoting-style <3>: Formatting the file names. + (line 34) +* --random-sort: sort invocation. (line 189) +* --random-source: sort invocation. (line 295) +* --random-source <1>: shuf invocation. (line 42) +* --random-source <2>: shred invocation. (line 111) +* --range: chcon invocation. (line 77) +* --range <1>: runcon invocation. (line 43) +* --read-bytes: od invocation. (line 75) +* --real: id invocation. (line 42) * --recursive: Which files are listed. (line 90) -* --reference <1>: Options for date. (line 30) -* --reference <2>: touch invocation. (line 77) -* --reference <3>: chmod invocation. (line 62) -* --reference <4>: chgrp invocation. (line 52) -* --reference: chown invocation. (line 125) +* --recursive <1>: cp invocation. (line 251) +* --recursive <2>: rm invocation. (line 93) +* --recursive <3>: chown invocation. (line 143) +* --recursive <4>: chgrp invocation. (line 70) +* --recursive <5>: chmod invocation. (line 69) +* --recursive <6>: chcon invocation. (line 35) +* --reference: chown invocation. (line 128) +* --reference <1>: chgrp invocation. (line 56) +* --reference <2>: chmod invocation. (line 62) +* --reference <3>: touch invocation. (line 119) +* --reference <4>: truncate invocation. (line 30) +* --reference <5>: Options for date. (line 61) +* --reference <6>: chcon invocation. (line 30) +* --references: Input processing in ptx. + (line 48) +* --reflink[=WHEN]: cp invocation. (line 264) * --regex: tac invocation. (line 26) -* --remove: shred invocation. (line 123) -* --remove-destination: cp invocation. (line 212) +* --relative: ln invocation. (line 134) +* --relative-base: realpath invocation. (line 49) +* --relative-to: realpath invocation. (line 44) +* --remove: shred invocation. (line 122) +* --remove-destination: cp invocation. (line 290) +* --remove=unlink: shred invocation. (line 122) +* --remove=wipe: shred invocation. (line 122) +* --remove=wipesync: shred invocation. (line 122) +* --repeat: shuf invocation. (line 47) * --repeated: uniq invocation. (line 63) -* --reply <1>: mv invocation. (line 64) -* --reply: cp invocation. (line 188) -* --retry: tail invocation. (line 84) +* --retry: tail invocation. (line 154) +* --reverse: sort invocation. (line 183) * --reverse <1>: Sorting the output. (line 27) -* --reverse: sort invocation. (line 157) -* --rfc-2822: Options for date. (line 36) -* --rfc-3339=TIMESPEC: Options for date. (line 48) -* --rfc-822: Options for date. (line 36) +* --rfc-2822: Options for date. (line 67) +* --rfc-3339=TIMESPEC: Options for date. (line 79) +* --rfc-822: Options for date. (line 67) +* --right-side-refs: Output formatting in ptx. + (line 56) +* --role: chcon invocation. (line 69) +* --role <1>: runcon invocation. (line 35) +* --round: numfmt invocation. (line 94) +* --round=down: numfmt invocation. (line 94) +* --round=from-zero: numfmt invocation. (line 94) +* --round=nearest: numfmt invocation. (line 94) +* --round=towards-zero: numfmt invocation. (line 94) +* --round=up: numfmt invocation. (line 94) +* --runlevel: who invocation. (line 74) * --save: stty invocation. (line 41) -* --section-delimiter: nl invocation. (line 68) -* --sep-string: pr invocation. (line 225) -* --separate-dirs: du invocation. (line 134) -* --separator <1>: pr invocation. (line 216) -* --separator: tac invocation. (line 33) -* --serial: paste invocation. (line 34) -* --set: Options for date. (line 78) +* --section-delimiter: nl invocation. (line 63) +* --sentence-regexp: Input processing in ptx. + (line 65) +* --sep-string: pr invocation. (line 201) +* --separate-dirs: du invocation. (line 138) +* --separator: tac invocation. (line 30) +* --separator <1>: pr invocation. (line 192) +* --separator <2>: split invocation. (line 142) +* --separator <3>: seq invocation. (line 42) +* --serial: paste invocation. (line 52) +* --set: Options for date. (line 107) * --sh: dircolors invocation. - (line 27) -* --shell: su invocation. (line 75) + (line 34) * --show-all: cat invocation. (line 16) +* --show-control-chars: pr invocation. (line 68) * --show-control-chars <1>: Formatting the file names. (line 78) -* --show-control-chars: pr invocation. (line 90) * --show-ends: cat invocation. (line 27) -* --show-nonprinting <1>: pr invocation. (line 251) -* --show-nonprinting: cat invocation. (line 49) -* --show-tabs: cat invocation. (line 42) -* --si <1>: du invocation. (line 123) -* --si <2>: df invocation. (line 93) -* --si <3>: What information is listed. - (line 258) -* --si: Block size. (line 138) -* --silent <1>: tty invocation. (line 18) -* --silent <2>: chmod invocation. (line 45) -* --silent <3>: chgrp invocation. (line 26) -* --silent <4>: chown invocation. (line 76) -* --silent <5>: readlink invocation. (line 52) -* --silent <6>: csplit invocation. (line 100) -* --silent <7>: tail invocation. (line 135) -* --silent: head invocation. (line 36) +* --show-nonprinting: cat invocation. (line 51) +* --show-nonprinting <1>: pr invocation. (line 225) +* --show-tabs: cat invocation. (line 44) +* --si: Block size. (line 121) +* --si <1>: What information is listed. + (line 247) +* --si <2>: df invocation. (line 167) +* --si <3>: du invocation. (line 145) +* --signal: timeout invocation. (line 48) +* --silent: head invocation. (line 46) +* --silent <1>: tail invocation. (line 151) +* --silent <2>: csplit invocation. (line 104) +* --silent <3>: readlink invocation. (line 56) +* --silent <4>: chown invocation. (line 79) +* --silent <5>: chgrp invocation. (line 30) +* --silent <6>: chmod invocation. (line 45) +* --silent <7>: tty invocation. (line 18) * --size: What information is listed. - (line 242) -* --size=BYTES: shred invocation. (line 117) -* --skip-bytes: od invocation. (line 55) + (line 232) +* --size <1>: truncate invocation. (line 34) +* --size=BYTES: shred invocation. (line 116) +* --skip-bytes: od invocation. (line 59) * --skip-chars: uniq invocation. (line 41) +* --skip-chdir: chroot invocation. (line 37) * --skip-fields: uniq invocation. (line 31) -* --sleep-interval: tail invocation. (line 90) -* --sort: Sorting the output. (line 32) +* --sleep-interval: tail invocation. (line 171) +* --sort: sort invocation. (line 105) +* --sort <1>: sort invocation. (line 126) +* --sort <2>: sort invocation. (line 150) +* --sort <3>: sort invocation. (line 160) +* --sort <4>: sort invocation. (line 189) +* --sort <5>: Sorting the output. (line 32) +* --sort <6>: Sorting the output. (line 36) +* --sort <7>: Sorting the output. (line 49) +* --sort <8>: Sorting the output. (line 56) +* --sort <9>: Sorting the output. (line 63) * --spaces: fold invocation. (line 29) -* --sparse=WHEN: cp invocation. (line 216) +* --sparse=WHEN: cp invocation. (line 294) * --split-only: fmt invocation. (line 47) -* --squeeze-blank: cat invocation. (line 35) -* --stable: sort invocation. (line 231) -* --starting-line-number: nl invocation. (line 117) -* --status: md5sum invocation. (line 69) -* --strings: od invocation. (line 68) -* --strip: install invocation. (line 88) -* --strip-trailing-slashes <1>: mv invocation. (line 89) -* --strip-trailing-slashes: cp invocation. (line 250) -* --suffix <1>: ln invocation. (line 100) -* --suffix <2>: mv invocation. (line 94) -* --suffix <3>: install invocation. (line 92) -* --suffix <4>: cp invocation. (line 263) -* --suffix <5>: csplit invocation. (line 66) -* --suffix: Backup options. (line 50) -* --suffix-length: split invocation. (line 26) -* --summarize: du invocation. (line 130) -* --symbolic: ln invocation. (line 94) -* --symbolic-link: cp invocation. (line 255) -* --sync: df invocation. (line 100) +* --squeeze-blank: cat invocation. (line 36) +* --stable: sort invocation. (line 300) +* --starting-line-number: nl invocation. (line 110) +* --status: md5sum invocation. (line 88) +* --strict: md5sum invocation. (line 121) +* --strings: od invocation. (line 80) +* --strip: install invocation. (line 113) +* --strip <1>: realpath invocation. (line 69) +* --strip-program: install invocation. (line 116) +* --strip-trailing-slashes: cp invocation. (line 327) +* --strip-trailing-slashes <1>: mv invocation. (line 96) +* --suffix: Backup options. (line 49) +* --suffix <1>: cp invocation. (line 340) +* --suffix <2>: install invocation. (line 120) +* --suffix <3>: mv invocation. (line 101) +* --suffix <4>: ln invocation. (line 164) +* --suffix <5>: basename invocation. (line 38) +* --suffix <6>: mktemp invocation. (line 113) +* --suffix <7>: numfmt invocation. (line 99) +* --suffix-format: csplit invocation. (line 65) +* --suffix-length: split invocation. (line 108) +* --summarize: du invocation. (line 153) +* --suppress-matched: csplit invocation. (line 87) +* --symbolic: ln invocation. (line 158) +* --symbolic-link: cp invocation. (line 332) +* --sync: df invocation. (line 174) * --sysv: sum invocation. (line 31) -* --tabs <1>: unexpand invocation. (line 24) * --tabs: expand invocation. (line 22) +* --tabs <1>: unexpand invocation. (line 24) * --tabsize: General output formatting. - (line 92) + (line 107) +* --tag: md5sum invocation. (line 97) * --tagged-paragraph: fmt invocation. (line 40) -* --target-directory <1>: ln invocation. (line 105) -* --target-directory <2>: mv invocation. (line 99) -* --target-directory <3>: install invocation. (line 97) -* --target-directory <4>: cp invocation. (line 268) * --target-directory: Target directory. (line 31) -* --temporary-directory: sort invocation. (line 273) -* --terse: stat invocation. (line 48) -* --text: md5sum invocation. (line 79) -* --time <1>: du invocation. (line 138) -* --time <2>: touch invocation. (line 50) +* --target-directory <1>: cp invocation. (line 345) +* --target-directory <2>: install invocation. (line 125) +* --target-directory <3>: mv invocation. (line 106) +* --target-directory <4>: ln invocation. (line 169) +* --temporary-directory: sort invocation. (line 344) +* --terse: stat invocation. (line 54) +* --text: md5sum invocation. (line 107) +* --threshold: du invocation. (line 157) * --time: Sorting the output. (line 13) -* --time-style <1>: du invocation. (line 153) +* --time <1>: Sorting the output. (line 42) +* --time <2>: touch invocation. (line 78) +* --time <3>: touch invocation. (line 115) +* --time <4>: du invocation. (line 197) +* --time <5>: du invocation. (line 203) +* --time <6>: du invocation. (line 208) +* --time <7>: who invocation. (line 82) * --time-style: Formatting file timestamps. - (line 26) -* --total: du invocation. (line 50) -* --traditional: od invocation. (line 197) -* --type: df invocation. (line 107) + (line 24) +* --time-style <1>: du invocation. (line 212) +* --tmpdir: mktemp invocation. (line 105) +* --to: numfmt invocation. (line 103) +* --to-unit: numfmt invocation. (line 108) +* --total: df invocation. (line 180) +* --total <1>: du invocation. (line 61) +* --traditional: od invocation. (line 199) +* --type: df invocation. (line 194) +* --type <1>: chcon invocation. (line 73) +* --type <2>: runcon invocation. (line 39) +* --unbuffered: split invocation. (line 149) * --uniform-spacing: fmt invocation. (line 53) -* --unique <1>: uniq invocation. (line 98) -* --unique: sort invocation. (line 282) -* --universal: Options for date. (line 83) -* --unset: env invocation. (line 39) -* --update <1>: mv invocation. (line 76) -* --update: cp invocation. (line 277) -* --user: id invocation. (line 41) -* --utc: Options for date. (line 83) -* --verbose <1>: chmod invocation. (line 59) -* --verbose <2>: chgrp invocation. (line 58) -* --verbose <3>: chown invocation. (line 132) -* --verbose <4>: rmdir invocation. (line 31) -* --verbose <5>: readlink invocation. (line 56) -* --verbose <6>: mkdir invocation. (line 51) -* --verbose <7>: ln invocation. (line 114) -* --verbose <8>: shred invocation. (line 129) -* --verbose <9>: rm invocation. (line 95) -* --verbose <10>: mv invocation. (line 86) -* --verbose <11>: install invocation. (line 106) -* --verbose <12>: cp invocation. (line 287) -* --verbose <13>: split invocation. (line 54) -* --verbose <14>: tail invocation. (line 139) -* --verbose: head invocation. (line 40) -* --version: Common options. (line 33) -* --warn: md5sum invocation. (line 88) -* --width <1>: General output formatting. - (line 104) -* --width <2>: fold invocation. (line 35) -* --width <3>: pr invocation. (line 255) -* --width <4>: fmt invocation. (line 59) -* --width: od invocation. (line 153) -* --words: wc invocation. (line 49) -* --wrap: base64 invocation. (line 21) -* --writable: who invocation. (line 86) -* --zero: shred invocation. (line 143) -* --zero-terminated <1>: shuf invocation. (line 48) -* --zero-terminated: sort invocation. (line 296) -* -0: du invocation. (line 116) -* -1 <1>: General output formatting. - (line 10) -* -1 <2>: join invocation. (line 74) +* --unique: sort invocation. (line 360) +* --unique <1>: uniq invocation. (line 127) +* --universal: Options for date. (line 113) +* --unset: env invocation. (line 88) +* --update: cp invocation. (line 354) +* --update <1>: mv invocation. (line 83) +* --user: id invocation. (line 47) +* --user <1>: chcon invocation. (line 65) +* --user <2>: runcon invocation. (line 31) +* --userspec: chroot invocation. (line 30) +* --utc: Options for date. (line 113) +* --verbose: head invocation. (line 50) +* --verbose <1>: tail invocation. (line 182) +* --verbose <2>: split invocation. (line 153) +* --verbose <3>: cp invocation. (line 368) +* --verbose <4>: install invocation. (line 135) +* --verbose <5>: mv invocation. (line 93) +* --verbose <6>: rm invocation. (line 97) +* --verbose <7>: shred invocation. (line 137) +* --verbose <8>: ln invocation. (line 178) +* --verbose <9>: mkdir invocation. (line 51) +* --verbose <10>: readlink invocation. (line 60) +* --verbose <11>: rmdir invocation. (line 31) +* --verbose <12>: chown invocation. (line 135) +* --verbose <13>: chgrp invocation. (line 62) +* --verbose <14>: chmod invocation. (line 59) +* --verbose <15>: chcon invocation. (line 61) +* --version: Common options. (line 40) +* --version-sort: sort invocation. (line 177) +* --warn: md5sum invocation. (line 116) +* --width: od invocation. (line 156) +* --width <1>: fmt invocation. (line 59) +* --width <2>: pr invocation. (line 229) +* --width <3>: fold invocation. (line 35) +* --width <4>: Output formatting in ptx. + (line 32) +* --width <5>: General output formatting. + (line 118) +* --word-regexp: Input processing in ptx. + (line 105) +* --words: wc invocation. (line 51) +* --wrap: base64 invocation. (line 23) +* --writable: who invocation. (line 94) +* --zero: shred invocation. (line 153) +* --zero <1>: readlink invocation. (line 64) +* --zero <2>: basename invocation. (line 42) +* --zero <3>: dirname invocation. (line 31) +* --zero <4>: realpath invocation. (line 76) +* --zero <5>: id invocation. (line 58) +* --zero-terminated: head invocation. (line 54) +* --zero-terminated <1>: tail invocation. (line 186) +* --zero-terminated <2>: sort invocation. (line 375) +* --zero-terminated <3>: shuf invocation. (line 55) +* --zero-terminated <4>: uniq invocation. (line 139) +* --zero-terminated <5>: comm invocation. (line 61) +* --zero-terminated <6>: cut invocation. (line 90) +* --zero-terminated <7>: paste invocation. (line 72) +* --zero-terminated <8>: join invocation. (line 155) +* --zero-terminated <9>: numfmt invocation. (line 115) +* -0: du invocation. (line 26) +* -0 <1>: printenv invocation. (line 19) +* -0 <2>: env invocation. (line 82) * -1: comm invocation. (line 23) -* -2 <1>: join invocation. (line 77) +* -1 <1>: join invocation. (line 102) +* -1 <2>: General output formatting. + (line 10) * -2: comm invocation. (line 23) +* -2 <1>: join invocation. (line 105) * -3: comm invocation. (line 23) -* -a <1>: uname invocation. (line 30) -* -a <2>: who invocation. (line 36) -* -a <3>: stty invocation. (line 26) -* -a <4>: tee invocation. (line 25) -* -a <5>: Connectives for test. - (line 12) -* -a <6>: du invocation. (line 21) -* -a <7>: df invocation. (line 32) -* -a <8>: touch invocation. (line 50) -* -a: cp invocation. (line 54) -* -A: Which files are listed. - (line 17) -* -a <1>: Which files are listed. - (line 13) -* -a <2>: unexpand invocation. (line 37) -* -a <3>: join invocation. (line 60) -* -a <4>: split invocation. (line 26) -* -a <5>: pr invocation. (line 84) -* -a: od invocation. (line 166) -* -A <1>: od invocation. (line 36) * -A: cat invocation. (line 16) -* -b <1>: who invocation. (line 40) -* -b: File type tests. (line 10) -* -B: du invocation. (line 45) -* -b: du invocation. (line 41) -* -B: df invocation. (line 38) -* -b <1>: ln invocation. (line 55) -* -b <2>: mv invocation. (line 50) -* -b <3>: install invocation. (line 40) -* -b <4>: cp invocation. (line 61) -* -b <5>: dircolors invocation. - (line 27) -* -b: Formatting the file names. - (line 11) +* -A <1>: od invocation. (line 36) +* -a: od invocation. (line 168) +* -a <1>: pr invocation. (line 62) +* -a <2>: split invocation. (line 108) +* -A <2>: Output formatting in ptx. + (line 45) +* -a <3>: join invocation. (line 72) +* -a <4>: unexpand invocation. (line 37) +* -a <5>: Which files are listed. + (line 13) +* -A <3>: Which files are listed. + (line 17) +* -a <6>: cp invocation. (line 63) +* -a <7>: touch invocation. (line 78) +* -a <8>: df invocation. (line 42) +* -a <9>: du invocation. (line 32) +* -a <10>: Connectives for test. + (line 29) +* -a <11>: tee invocation. (line 27) +* -a <12>: basename invocation. (line 32) +* -a <13>: stty invocation. (line 26) +* -a <14>: who invocation. (line 35) +* -a <15>: uname invocation. (line 30) +* -b: Backup options. (line 13) +* -b <1>: cat invocation. (line 20) +* -b <2>: tac invocation. (line 21) +* -b <3>: nl invocation. (line 45) +* -b <4>: od invocation. (line 171) +* -b <5>: fold invocation. (line 23) +* -b <6>: split invocation. (line 41) +* -b <7>: csplit invocation. (line 65) +* -b <8>: md5sum invocation. (line 40) +* -b <9>: sort invocation. (line 79) +* -b <10>: Input processing in ptx. + (line 8) +* -b <11>: cut invocation. (line 26) * -B: Which files are listed. (line 23) -* -b <1>: cut invocation. (line 26) -* -b <2>: sort invocation. (line 79) -* -b <3>: md5sum invocation. (line 38) -* -b <4>: csplit invocation. (line 66) -* -b <5>: split invocation. (line 37) -* -b <6>: fold invocation. (line 23) -* -b <7>: od invocation. (line 169) -* -b <8>: nl invocation. (line 47) -* -b <9>: tac invocation. (line 21) -* -b <10>: cat invocation. (line 20) -* -b: Backup options. (line 13) -* -c <1>: su invocation. (line 39) -* -c <2>: File type tests. (line 13) -* -c <3>: stat invocation. (line 28) -* -c <4>: du invocation. (line 50) -* -c <5>: touch invocation. (line 54) -* -c <6>: chmod invocation. (line 39) -* -c <7>: chgrp invocation. (line 20) -* -c <8>: chown invocation. (line 70) -* -c <9>: install invocation. (line 44) -* -c: dircolors invocation. - (line 33) -* -C: General output formatting. - (line 15) -* -c <1>: Sorting the output. (line 13) -* -c <2>: cut invocation. (line 34) -* -c <3>: uniq invocation. (line 55) -* -c <4>: shuf invocation. (line 19) -* -c <5>: sort invocation. (line 18) -* -c: wc invocation. (line 41) -* -C: split invocation. (line 43) -* -c <1>: tail invocation. (line 36) -* -c <2>: head invocation. (line 24) -* -c <3>: pr invocation. (line 90) -* -c <4>: fmt invocation. (line 34) -* -c: od invocation. (line 172) -* -COLUMN: pr invocation. (line 70) -* -d <1>: Options for date. (line 11) -* -d <2>: who invocation. (line 44) -* -d: File type tests. (line 16) -* -D: du invocation. (line 56) -* -d <1>: touch invocation. (line 58) -* -d <2>: ln invocation. (line 61) -* -d <3>: install invocation. (line 48) -* -d: cp invocation. (line 89) -* -D: What information is listed. +* -b <12>: Formatting the file names. + (line 11) +* -b <13>: dircolors invocation. + (line 34) +* -b <14>: cp invocation. (line 79) +* -b <15>: install invocation. (line 41) +* -b <16>: mv invocation. (line 59) +* -b <17>: ln invocation. (line 80) +* -B <1>: df invocation. (line 54) +* -B <2>: du invocation. (line 52) +* -b <18>: du invocation. (line 57) +* -b <19>: File type tests. (line 10) +* -b <20>: who invocation. (line 39) +* -c: od invocation. (line 174) +* -c <1>: fmt invocation. (line 34) +* -c <2>: pr invocation. (line 68) +* -c <3>: head invocation. (line 24) +* -c <4>: tail invocation. (line 39) +* -C: split invocation. (line 55) +* -c <5>: wc invocation. (line 43) +* -c <6>: sort invocation. (line 39) +* -c <7>: sort invocation. (line 47) +* -c <8>: shuf invocation. (line 19) +* -c <9>: uniq invocation. (line 55) +* -c <10>: cut invocation. (line 34) +* -c <11>: Sorting the output. (line 13) +* -C <1>: General output formatting. (line 16) -* -d <1>: Which files are listed. - (line 28) -* -d <2>: paste invocation. (line 43) -* -d: cut invocation. (line 51) +* -c <12>: dircolors invocation. + (line 40) +* -C <2>: install invocation. (line 46) +* -c <13>: install invocation. (line 57) +* -c <14>: chown invocation. (line 73) +* -c <15>: chgrp invocation. (line 24) +* -c <16>: chmod invocation. (line 39) +* -c <17>: touch invocation. (line 82) +* -c <18>: du invocation. (line 61) +* -c <19>: stat invocation. (line 34) +* -c <20>: truncate invocation. (line 22) +* -c <21>: File type tests. (line 13) +* -c <22>: runcon invocation. (line 27) +* -COLUMN: pr invocation. (line 49) +* -d: nl invocation. (line 63) +* -d <1>: od invocation. (line 178) +* -d <2>: base64 invocation. (line 31) +* -d <3>: pr invocation. (line 74) +* -d <4>: split invocation. (line 116) +* -d <5>: sort invocation. (line 87) +* -d <6>: uniq invocation. (line 63) * -D: uniq invocation. (line 69) -* -d <1>: uniq invocation. (line 63) -* -d <2>: sort invocation. (line 85) -* -d <3>: split invocation. (line 51) -* -d <4>: pr invocation. (line 96) -* -d <5>: base64 invocation. (line 29) -* -d <6>: od invocation. (line 176) -* -d: nl invocation. (line 68) -* -e: File characteristic tests. - (line 9) -* -E: echo invocation. (line 63) -* -e <1>: echo invocation. (line 20) -* -e <2>: readlink invocation. (line 35) -* -e <3>: join invocation. (line 64) -* -e: pr invocation. (line 120) -* -E: cat invocation. (line 27) +* -d <7>: cut invocation. (line 62) +* -d <8>: paste invocation. (line 61) +* -d <9>: Which files are listed. + (line 28) +* -D <1>: What information is listed. + (line 16) +* -d <10>: cp invocation. (line 109) +* -D <2>: install invocation. (line 60) +* -d <11>: install invocation. (line 67) +* -d <12>: rm invocation. (line 35) +* -d <13>: ln invocation. (line 86) +* -d <14>: touch invocation. (line 86) +* -D <3>: du invocation. (line 67) +* -d <15>: File type tests. (line 16) +* -d <16>: mktemp invocation. (line 85) +* -d <17>: who invocation. (line 43) +* -d <18>: Options for date. (line 11) +* -d <19>: numfmt invocation. (line 34) +* -d DEPTH: du invocation. (line 74) * -e: cat invocation. (line 23) +* -E: cat invocation. (line 27) +* -e <1>: pr invocation. (line 98) +* -e <2>: split invocation. (line 134) +* -e <3>: join invocation. (line 83) +* -e <4>: readlink invocation. (line 37) +* -e <5>: echo invocation. (line 25) +* -E <1>: echo invocation. (line 61) +* -e <6>: File characteristic tests. + (line 9) +* -e <7>: realpath invocation. (line 17) +* -e <8>: stdbuf invocation. (line 34) * -ef: File characteristic tests. (line 23) -* -eq: Numeric tests. (line 16) -* -f <1>: su invocation. (line 44) -* -f: Options for date. (line 22) -* -F: stty invocation. (line 31) -* -f <1>: File type tests. (line 19) -* -f <2>: stat invocation. (line 23) -* -f <3>: touch invocation. (line 68) -* -f <4>: chmod invocation. (line 45) -* -f <5>: chgrp invocation. (line 26) -* -f <6>: chown invocation. (line 76) -* -f <7>: readlink invocation. (line 29) -* -f: ln invocation. (line 67) -* -F: ln invocation. (line 61) -* -f <1>: shred invocation. (line 101) -* -f <2>: rm invocation. (line 35) -* -f <3>: mv invocation. (line 55) -* -f: cp invocation. (line 96) -* -F: General output formatting. - (line 36) -* -f <1>: Sorting the output. (line 20) -* -f <2>: cut invocation. (line 44) -* -f <3>: uniq invocation. (line 31) -* -f <4>: sort invocation. (line 92) -* -f: csplit invocation. (line 62) -* -F: tail invocation. (line 79) -* -f <1>: tail invocation. (line 41) -* -f: pr invocation. (line 128) -* -F: pr invocation. (line 128) -* -f <1>: od invocation. (line 179) -* -f: nl invocation. (line 75) -* -f FORMAT: seq invocation. (line 24) -* -G: id invocation. (line 27) -* -g <1>: id invocation. (line 23) -* -g: stty invocation. (line 41) -* -G: Access permission tests. - (line 31) -* -g <1>: Access permission tests. - (line 9) -* -g: install invocation. (line 54) +* -eq: Numeric tests. (line 17) +* -f: nl invocation. (line 70) +* -f <1>: od invocation. (line 181) +* -F: pr invocation. (line 106) +* -f <2>: pr invocation. (line 106) +* -f <3>: tail invocation. (line 55) +* -F <1>: tail invocation. (line 106) +* -f <4>: csplit invocation. (line 61) +* -f <5>: sort invocation. (line 94) +* -f <6>: uniq invocation. (line 31) +* -f <7>: Charset selection in ptx. + (line 18) +* -F <2>: Output formatting in ptx. + (line 71) +* -f <8>: cut invocation. (line 43) +* -f <9>: Sorting the output. (line 20) +* -F <3>: General output formatting. + (line 47) +* -f <10>: cp invocation. (line 115) +* -f <11>: mv invocation. (line 64) +* -f <12>: rm invocation. (line 39) +* -f <13>: shred invocation. (line 101) +* -F <4>: ln invocation. (line 86) +* -f <14>: ln invocation. (line 92) +* -f <15>: readlink invocation. (line 30) +* -f <16>: chown invocation. (line 79) +* -f <17>: chgrp invocation. (line 30) +* -f <18>: chmod invocation. (line 45) +* -f <19>: touch invocation. (line 96) +* -f <20>: stat invocation. (line 28) +* -f <21>: File type tests. (line 19) +* -F <5>: stty invocation. (line 31) +* -f <22>: Options for date. (line 26) +* -f <23>: seq invocation. (line 26) +* -g: fmt invocation. (line 64) +* -g <1>: sort invocation. (line 105) +* -g <2>: Output formatting in ptx. + (line 26) +* -g <3>: What information is listed. + (line 105) * -G: What information is listed. (line 110) -* -g <1>: What information is listed. - (line 105) -* -g: sort invocation. (line 98) -* -ge: Numeric tests. (line 16) -* -gt: Numeric tests. (line 16) -* -H: who invocation. (line 48) -* -h: File type tests. (line 23) -* -H: du invocation. (line 80) -* -h: du invocation. (line 75) -* -H: df invocation. (line 48) -* -h: df invocation. (line 43) -* -H: chgrp invocation. (line 70) -* -h: chgrp invocation. (line 35) -* -H: chown invocation. (line 143) -* -h: chown invocation. (line 108) -* -H: cp invocation. (line 109) -* -h: What information is listed. - (line 116) -* -H: Which files are listed. - (line 36) -* -h <1>: pr invocation. (line 134) -* -h: nl invocation. (line 79) +* -g <4>: install invocation. (line 73) +* -g <5>: Access permission tests. + (line 9) +* -G <1>: Access permission tests. + (line 31) +* -g <6>: stty invocation. (line 41) +* -g <7>: id invocation. (line 29) +* -G <2>: id invocation. (line 33) +* -ge: Numeric tests. (line 17) +* -gt: Numeric tests. (line 17) +* -h: Block size. (line 121) * -H: Traversing symlinks. (line 18) -* -h: Block size. (line 138) -* -i <1>: env invocation. (line 45) -* -i <2>: uname invocation. (line 35) -* -i <3>: tee invocation. (line 30) -* -i <4>: df invocation. (line 52) -* -i: ln invocation. (line 71) -* -I: rm invocation. (line 44) -* -i <1>: rm invocation. (line 39) -* -i <2>: mv invocation. (line 59) -* -i <3>: cp invocation. (line 116) -* -i: What information is listed. - (line 122) +* -h <1>: nl invocation. (line 74) +* -h <2>: pr invocation. (line 111) +* -h <3>: sort invocation. (line 126) +* -H <1>: Which files are listed. + (line 36) +* -h <4>: What information is listed. + (line 116) +* -H <2>: cp invocation. (line 131) +* -h <5>: chown invocation. (line 111) +* -H <3>: chown invocation. (line 146) +* -h <6>: chgrp invocation. (line 39) +* -H <4>: chgrp invocation. (line 74) +* -h <7>: touch invocation. (line 100) +* -h <8>: df invocation. (line 59) +* -H <5>: df invocation. (line 65) +* -H <6>: du invocation. (line 92) +* -h <9>: du invocation. (line 96) +* -h <10>: File type tests. (line 23) +* -H <7>: who invocation. (line 47) +* -h <11>: chcon invocation. (line 26) +* -H <8>: chcon invocation. (line 47) +* -i: nl invocation. (line 78) +* -i <1>: od invocation. (line 184) +* -i <2>: base64 invocation. (line 37) +* -i <3>: pr invocation. (line 117) +* -i <4>: sort invocation. (line 143) +* -i <5>: shuf invocation. (line 23) +* -i <6>: uniq invocation. (line 59) +* -i <7>: Input processing in ptx. + (line 26) +* -i <8>: join invocation. (line 97) +* -i <9>: expand invocation. (line 33) * -I: Which files are listed. (line 69) -* -i <1>: expand invocation. (line 34) -* -i <2>: join invocation. (line 69) -* -i <3>: uniq invocation. (line 59) -* -i <4>: shuf invocation. (line 23) -* -i <5>: sort invocation. (line 125) -* -i <6>: pr invocation. (line 140) -* -i <7>: base64 invocation. (line 35) -* -i <8>: od invocation. (line 182) -* -i: nl invocation. (line 83) -* -J: pr invocation. (line 147) -* -j: od invocation. (line 55) -* -k <1>: Access permission tests. +* -i <10>: What information is listed. + (line 123) +* -i <11>: cp invocation. (line 138) +* -i <12>: mv invocation. (line 70) +* -i <13>: rm invocation. (line 43) +* -I <1>: rm invocation. (line 48) +* -i <14>: ln invocation. (line 96) +* -i <15>: df invocation. (line 69) +* -i <16>: tee invocation. (line 32) +* -i <17>: uname invocation. (line 35) +* -i <18>: env invocation. (line 94) +* -i <19>: stdbuf invocation. (line 26) +* -I[TIMESPEC]: Options for date. (line 34) +* -j: od invocation. (line 59) +* -J: pr invocation. (line 124) +* -k: Block size. (line 121) +* -k <1>: csplit invocation. (line 84) +* -k <2>: sort invocation. (line 231) +* -k <3>: General output formatting. + (line 81) +* -k <4>: df invocation. (line 74) +* -k <5>: du invocation. (line 111) +* -k <6>: Access permission tests. (line 12) -* -k <2>: du invocation. (line 85) -* -k <3>: df invocation. (line 57) -* -k <4>: General output formatting. - (line 72) -* -k <5>: sort invocation. (line 193) -* -k <6>: csplit invocation. (line 85) -* -k: Block size. (line 138) -* -l <1>: su invocation. (line 53) -* -l: who invocation. (line 68) -* -L <1>: File type tests. (line 23) -* -L <2>: stat invocation. (line 17) -* -L: du invocation. (line 96) -* -l <1>: du invocation. (line 91) -* -l: df invocation. (line 63) -* -L <1>: chgrp invocation. (line 75) -* -L <2>: chown invocation. (line 148) -* -L: cp invocation. (line 125) -* -l <1>: cp invocation. (line 121) -* -l: What information is listed. - (line 130) -* -L <1>: Which files are listed. - (line 83) -* -L: wc invocation. (line 57) -* -l <1>: wc invocation. (line 53) -* -l <2>: split invocation. (line 30) -* -l <3>: pr invocation. (line 156) -* -l <4>: od invocation. (line 185) -* -l: nl invocation. (line 87) +* -k <7>: timeout invocation. (line 41) * -L: Traversing symlinks. (line 22) -* -le: Numeric tests. (line 16) -* -lt: Numeric tests. (line 16) -* -m <1>: su invocation. (line 64) -* -m <2>: uname invocation. (line 41) -* -m <3>: who invocation. (line 51) -* -m <4>: du invocation. (line 101) -* -m <5>: touch invocation. (line 73) -* -m <6>: readlink invocation. (line 41) -* -m <7>: mknod invocation. (line 43) -* -m <8>: mkfifo invocation. (line 21) -* -m <9>: mkdir invocation. (line 19) -* -m <10>: install invocation. (line 60) -* -m: General output formatting. - (line 78) -* -M: sort invocation. (line 131) -* -m <1>: sort invocation. (line 32) -* -m <2>: wc invocation. (line 45) -* -m: pr invocation. (line 164) -* -n <1>: nice invocation. (line 44) -* -n <2>: uname invocation. (line 46) -* -n <3>: id invocation. (line 31) -* -n <4>: String tests. (line 19) -* -n <5>: echo invocation. (line 17) -* -n <6>: readlink invocation. (line 46) -* -n: ln invocation. (line 75) -* -N: Formatting the file names. - (line 17) -* -n <1>: What information is listed. - (line 232) -* -n <2>: cut invocation. (line 55) -* -n <3>: shuf invocation. (line 32) -* -n <4>: sort invocation. (line 140) -* -n <5>: csplit invocation. (line 80) -* -n <6>: tail invocation. (line 130) -* -n: head invocation. (line 30) -* -N: pr invocation. (line 198) -* -n: pr invocation. (line 177) -* -N: od invocation. (line 63) -* -n <1>: nl invocation. (line 95) +* -l: nl invocation. (line 82) +* -l <1>: od invocation. (line 187) +* -l <2>: pr invocation. (line 133) +* -l <3>: split invocation. (line 33) +* -l <4>: wc invocation. (line 55) +* -L <1>: wc invocation. (line 59) +* -L <2>: Which files are listed. + (line 83) +* -l <5>: What information is listed. + (line 131) +* -l <6>: cp invocation. (line 144) +* -L <3>: cp invocation. (line 148) +* -L <4>: ln invocation. (line 100) +* -L <5>: chown invocation. (line 151) +* -L <6>: chgrp invocation. (line 79) +* -l <7>: df invocation. (line 80) +* -L <7>: du invocation. (line 117) +* -l <8>: du invocation. (line 123) +* -L <8>: stat invocation. (line 22) +* -L <9>: File type tests. (line 23) +* -L <10>: realpath invocation. (line 30) +* -L <11>: pwd invocation. (line 15) +* -l <9>: who invocation. (line 51) +* -L <12>: chcon invocation. (line 52) +* -l <10>: chcon invocation. (line 77) +* -l <11>: runcon invocation. (line 43) +* -le: Numeric tests. (line 17) +* -lt: Numeric tests. (line 17) +* -m: pr invocation. (line 140) +* -m <1>: wc invocation. (line 47) +* -m <2>: sort invocation. (line 53) +* -M: sort invocation. (line 150) +* -M <1>: Output formatting in ptx. + (line 94) +* -m <3>: General output formatting. + (line 93) +* -m <4>: install invocation. (line 79) +* -m <5>: mkdir invocation. (line 19) +* -m <6>: mkfifo invocation. (line 21) +* -m <7>: mknod invocation. (line 47) +* -m <8>: readlink invocation. (line 44) +* -m <9>: touch invocation. (line 115) +* -m <10>: du invocation. (line 127) +* -m <11>: realpath invocation. (line 25) +* -m <12>: who invocation. (line 61) +* -m <13>: uname invocation. (line 42) * -n: cat invocation. (line 31) -* -n NUMBER: shred invocation. (line 106) -* -ne: Numeric tests. (line 16) +* -n <1>: nl invocation. (line 90) +* -N: od invocation. (line 75) +* -n <2>: pr invocation. (line 153) +* -N <1>: pr invocation. (line 174) +* -n <3>: head invocation. (line 39) +* -n <4>: tail invocation. (line 123) +* -n <5>: split invocation. (line 78) +* -n <6>: csplit invocation. (line 79) +* -n <7>: sort invocation. (line 160) +* -n <8>: shuf invocation. (line 31) +* -n <9>: cut invocation. (line 66) +* -n <10>: What information is listed. + (line 222) +* -N <2>: Formatting the file names. + (line 17) +* -n <11>: cp invocation. (line 155) +* -n <12>: mv invocation. (line 77) +* -n <13>: ln invocation. (line 106) +* -n <14>: readlink invocation. (line 49) +* -n <15>: echo invocation. (line 22) +* -n <16>: String tests. (line 19) +* -n <17>: id invocation. (line 37) +* -n <18>: uname invocation. (line 47) +* -n <19>: nice invocation. (line 51) +* -n NUMBER: shred invocation. (line 105) +* -ne: Numeric tests. (line 17) * -nt: File characteristic tests. (line 15) -* -o <1>: uname invocation. (line 57) -* -o: Connectives for test. - (line 15) -* -O: Access permission tests. +* -o: od invocation. (line 190) +* -o <1>: pr invocation. (line 180) +* -o <2>: sort invocation. (line 282) +* -o <3>: shuf invocation. (line 36) +* -o <4>: Input processing in ptx. + (line 35) +* -O: Output formatting in ptx. + (line 100) +* -o <5>: What information is listed. + (line 226) +* -o <6>: install invocation. (line 91) +* -o <7>: truncate invocation. (line 26) +* -O <1>: Access permission tests. (line 28) -* -o <1>: install invocation. (line 72) -* -o <2>: What information is listed. - (line 236) -* -o <3>: shuf invocation. (line 37) -* -o <4>: sort invocation. (line 213) -* -o <5>: pr invocation. (line 204) -* -o: od invocation. (line 188) +* -o <8>: Connectives for test. + (line 33) +* -o <9>: uname invocation. (line 58) +* -o <10>: stdbuf invocation. (line 30) * -ot: File characteristic tests. (line 19) -* -p <1>: su invocation. (line 64) -* -p: uname invocation. (line 50) -* -P: pathchk invocation. (line 42) -* -p <1>: pathchk invocation. (line 29) -* -p: File type tests. (line 28) -* -P <1>: du invocation. (line 107) -* -P <2>: df invocation. (line 74) -* -P <3>: chgrp invocation. (line 79) -* -P: chown invocation. (line 152) -* -p <1>: rmdir invocation. (line 22) -* -p <2>: mkdir invocation. (line 34) -* -p <3>: install invocation. (line 78) -* -p: cp invocation. (line 134) -* -P: cp invocation. (line 129) -* -p <1>: dircolors invocation. - (line 38) -* -p <2>: General output formatting. - (line 83) -* -p: nl invocation. (line 108) * -P: Traversing symlinks. (line 26) -* -q <1>: who invocation. (line 55) -* -q: readlink invocation. (line 52) +* -p: nl invocation. (line 101) +* -p <1>: General output formatting. + (line 98) +* -p <2>: dircolors invocation. + (line 45) +* -P <1>: cp invocation. (line 161) +* -p <3>: cp invocation. (line 168) +* -p <4>: install invocation. (line 103) +* -P <2>: ln invocation. (line 125) +* -p <5>: mkdir invocation. (line 34) +* -p <6>: rmdir invocation. (line 22) +* -P <3>: chown invocation. (line 155) +* -P <4>: chgrp invocation. (line 83) +* -P <5>: df invocation. (line 148) +* -P <6>: du invocation. (line 133) +* -p <7>: File type tests. (line 28) +* -p <8>: tee invocation. (line 36) +* -p <9>: pathchk invocation. (line 27) +* -P <7>: pathchk invocation. (line 40) +* -p <10>: mktemp invocation. (line 105) +* -P <8>: realpath invocation. (line 35) +* -P <9>: pwd invocation. (line 22) +* -p <11>: who invocation. (line 65) +* -p <12>: uname invocation. (line 51) +* -P <10>: chcon invocation. (line 56) +* -q: head invocation. (line 46) +* -q <1>: tail invocation. (line 151) +* -q <2>: csplit invocation. (line 104) +* -q <3>: Formatting the file names. + (line 23) * -Q: Formatting the file names. (line 30) -* -q <1>: Formatting the file names. - (line 23) -* -q <2>: csplit invocation. (line 100) -* -q <3>: tail invocation. (line 135) -* -q: head invocation. (line 36) -* -r: uname invocation. (line 61) -* -R: Options for date. (line 36) -* -r <1>: Options for date. (line 30) -* -r <2>: id invocation. (line 36) -* -r <3>: Access permission tests. - (line 15) -* -r: touch invocation. (line 77) -* -R <1>: chmod invocation. (line 69) -* -R <2>: chgrp invocation. (line 66) -* -R <3>: chown invocation. (line 140) -* -R: rm invocation. (line 91) -* -r <1>: rm invocation. (line 91) -* -r: cp invocation. (line 200) -* -R: cp invocation. (line 200) -* -r: Sorting the output. (line 27) -* -R <1>: Which files are listed. - (line 90) -* -R: sort invocation. (line 162) -* -r <1>: sort invocation. (line 157) -* -r <2>: sum invocation. (line 25) -* -r <3>: pr invocation. (line 211) +* -q <4>: readlink invocation. (line 56) +* -q <5>: mktemp invocation. (line 92) +* -q <6>: realpath invocation. (line 41) +* -q <7>: who invocation. (line 69) * -r: tac invocation. (line 26) -* -s <1>: su invocation. (line 75) -* -s <2>: uname invocation. (line 65) -* -s <3>: Options for date. (line 78) -* -s <4>: who invocation. (line 59) -* -s <5>: tty invocation. (line 18) -* -s: File characteristic tests. +* -r <1>: pr invocation. (line 187) +* -r <2>: sum invocation. (line 25) +* -r <3>: sort invocation. (line 183) +* -R: sort invocation. (line 189) +* -r <4>: shuf invocation. (line 47) +* -r <5>: Input processing in ptx. + (line 48) +* -R <1>: Output formatting in ptx. + (line 56) +* -R <2>: Which files are listed. + (line 90) +* -r <6>: Sorting the output. (line 27) +* -R <3>: cp invocation. (line 251) +* -r <7>: cp invocation. (line 251) +* -r <8>: rm invocation. (line 93) +* -R <4>: rm invocation. (line 93) +* -r <9>: ln invocation. (line 134) +* -R <5>: chown invocation. (line 143) +* -R <6>: chgrp invocation. (line 70) +* -R <7>: chmod invocation. (line 69) +* -r <10>: touch invocation. (line 119) +* -r <11>: truncate invocation. (line 30) +* -r <12>: Access permission tests. + (line 15) +* -r <13>: id invocation. (line 42) +* -r <14>: who invocation. (line 74) +* -r <15>: Options for date. (line 61) +* -R <8>: Options for date. (line 67) +* -r <16>: uname invocation. (line 62) +* -R <9>: chcon invocation. (line 35) +* -r <17>: chcon invocation. (line 69) +* -r <18>: runcon invocation. (line 35) +* -S: Backup options. (line 49) +* -s: cat invocation. (line 36) +* -s <1>: tac invocation. (line 30) +* -s <2>: nl invocation. (line 105) +* -S <1>: od invocation. (line 80) +* -s <3>: od invocation. (line 193) +* -s <4>: fmt invocation. (line 47) +* -s <5>: pr invocation. (line 192) +* -S <2>: pr invocation. (line 201) +* -s <6>: fold invocation. (line 29) +* -s <7>: tail invocation. (line 171) +* -s <8>: csplit invocation. (line 104) +* -s <9>: sum invocation. (line 31) +* -s <10>: sort invocation. (line 300) +* -S <3>: sort invocation. (line 307) +* -s <11>: uniq invocation. (line 41) +* -S <4>: Input processing in ptx. + (line 65) +* -s <12>: cut invocation. (line 70) +* -s <13>: paste invocation. (line 52) +* -s <14>: What information is listed. + (line 232) +* -S <5>: Sorting the output. (line 32) +* -s <15>: cp invocation. (line 332) +* -S <6>: cp invocation. (line 340) +* -s <16>: install invocation. (line 113) +* -S <7>: install invocation. (line 120) +* -S <8>: mv invocation. (line 101) +* -s <17>: ln invocation. (line 158) +* -S <9>: ln invocation. (line 164) +* -s <18>: readlink invocation. (line 56) +* -S <10>: du invocation. (line 138) +* -s <19>: du invocation. (line 153) +* -s <20>: truncate invocation. (line 34) +* -S <11>: File type tests. (line 31) +* -s <21>: File characteristic tests. (line 12) -* -S <1>: File type tests. (line 31) -* -S: du invocation. (line 134) -* -s <1>: du invocation. (line 130) -* -s: readlink invocation. (line 52) -* -S: ln invocation. (line 100) -* -s: ln invocation. (line 94) -* -S <1>: mv invocation. (line 94) -* -S: install invocation. (line 92) -* -s: install invocation. (line 88) -* -S: cp invocation. (line 263) -* -s: cp invocation. (line 255) -* -S: Sorting the output. (line 32) -* -s <1>: What information is listed. - (line 242) -* -s <2>: paste invocation. (line 34) -* -s <3>: cut invocation. (line 59) -* -s: uniq invocation. (line 41) -* -S: sort invocation. (line 237) -* -s <1>: sort invocation. (line 231) -* -s <2>: sum invocation. (line 31) -* -s <3>: csplit invocation. (line 100) -* -s: fold invocation. (line 29) -* -S: pr invocation. (line 225) -* -s <1>: pr invocation. (line 216) -* -s <2>: fmt invocation. (line 47) -* -s: od invocation. (line 191) -* -S: od invocation. (line 68) -* -s <1>: nl invocation. (line 112) -* -s <2>: tac invocation. (line 33) -* -s: cat invocation. (line 35) -* -S: Backup options. (line 50) -* -s BYTES: shred invocation. (line 117) -* -su: su invocation. (line 25) -* -T: who invocation. (line 86) -* -t <1>: File type tests. (line 34) -* -t: stat invocation. (line 48) -* -T: df invocation. (line 113) -* -t: df invocation. (line 107) -* -T: ln invocation. (line 109) -* -t: ln invocation. (line 105) -* -T: mv invocation. (line 103) -* -t: mv invocation. (line 99) -* -T: install invocation. (line 101) -* -t: install invocation. (line 97) -* -T: cp invocation. (line 272) -* -t: cp invocation. (line 268) -* -T: General output formatting. - (line 92) -* -t <1>: Sorting the output. (line 36) -* -t <2>: unexpand invocation. (line 24) -* -t: expand invocation. (line 22) -* -T: sort invocation. (line 273) -* -t <1>: sort invocation. (line 253) -* -t: md5sum invocation. (line 79) -* -T: pr invocation. (line 246) -* -t <1>: pr invocation. (line 235) +* -s <22>: basename invocation. (line 38) +* -s <23>: realpath invocation. (line 69) +* -s <24>: tty invocation. (line 18) +* -s <25>: who invocation. (line 78) +* -s <26>: Options for date. (line 107) +* -s <27>: uname invocation. (line 66) +* -s <28>: timeout invocation. (line 48) +* -s <29>: seq invocation. (line 42) +* -s BYTES: shred invocation. (line 116) +* -t: cat invocation. (line 40) +* -T: cat invocation. (line 44) +* -t <1>: od invocation. (line 89) * -t <2>: fmt invocation. (line 40) -* -t: od invocation. (line 76) -* -T: cat invocation. (line 42) -* -t: cat invocation. (line 38) -* -u <1>: env invocation. (line 39) -* -u <2>: Options for date. (line 83) -* -u <3>: who invocation. (line 62) -* -u <4>: id invocation. (line 41) -* -u <5>: Access permission tests. - (line 18) -* -u <6>: shred invocation. (line 123) -* -u <7>: mv invocation. (line 76) -* -u: cp invocation. (line 277) +* -t <3>: pr invocation. (line 210) +* -T <1>: pr invocation. (line 220) +* -t <4>: split invocation. (line 142) +* -t <5>: md5sum invocation. (line 107) +* -t <6>: sort invocation. (line 323) +* -T <2>: sort invocation. (line 344) +* -T <3>: Output formatting in ptx. + (line 118) +* -t <7>: expand invocation. (line 22) +* -t <8>: unexpand invocation. (line 24) +* -t <9>: Sorting the output. (line 36) +* -T <4>: General output formatting. + (line 107) +* -t <10>: cp invocation. (line 345) +* -T <5>: cp invocation. (line 349) +* -t <11>: install invocation. (line 125) +* -T <6>: install invocation. (line 130) +* -t <12>: mv invocation. (line 106) +* -T <7>: mv invocation. (line 110) +* -t <13>: ln invocation. (line 169) +* -T <8>: ln invocation. (line 173) +* -t <14>: df invocation. (line 194) +* -T <9>: df invocation. (line 200) +* -t <15>: du invocation. (line 157) +* -t <16>: stat invocation. (line 54) +* -t <17>: File type tests. (line 34) +* -t <18>: mktemp invocation. (line 121) +* -t <19>: who invocation. (line 82) +* -T <10>: who invocation. (line 94) +* -t <20>: chcon invocation. (line 73) +* -t <21>: runcon invocation. (line 39) +* -u: cat invocation. (line 47) +* -u <1>: fmt invocation. (line 53) +* -u <2>: split invocation. (line 149) +* -u <3>: sort invocation. (line 360) +* -u <4>: uniq invocation. (line 127) +* -u <5>: Sorting the output. (line 42) * -U: Sorting the output. (line 49) -* -u <1>: Sorting the output. (line 42) -* -u <2>: uniq invocation. (line 98) -* -u <3>: sort invocation. (line 282) -* -u <4>: fmt invocation. (line 53) -* -u: cat invocation. (line 45) -* -v <1>: uname invocation. (line 76) -* -v <2>: chmod invocation. (line 59) -* -v <3>: chgrp invocation. (line 58) -* -v <4>: chown invocation. (line 132) -* -v <5>: rmdir invocation. (line 31) -* -v <6>: readlink invocation. (line 56) -* -v <7>: mkdir invocation. (line 51) -* -v <8>: ln invocation. (line 114) -* -v <9>: shred invocation. (line 129) -* -v <10>: rm invocation. (line 95) -* -v <11>: mv invocation. (line 86) -* -v <12>: install invocation. (line 106) -* -v <13>: cp invocation. (line 287) -* -v <14>: Sorting the output. (line 56) -* -v <15>: tail invocation. (line 139) -* -v <16>: head invocation. (line 40) -* -v <17>: pr invocation. (line 251) -* -v <18>: od invocation. (line 146) -* -v <19>: nl invocation. (line 117) -* -v: cat invocation. (line 49) -* -w <1>: who invocation. (line 86) -* -w <2>: Access permission tests. +* -u <6>: cp invocation. (line 354) +* -u <7>: mv invocation. (line 83) +* -u <8>: shred invocation. (line 122) +* -u <9>: Access permission tests. + (line 18) +* -u <10>: mktemp invocation. (line 97) +* -u <11>: id invocation. (line 47) +* -u <12>: who invocation. (line 85) +* -u <13>: Options for date. (line 113) +* -u <14>: chcon invocation. (line 65) +* -u <15>: runcon invocation. (line 31) +* -u <16>: env invocation. (line 88) +* -v: cat invocation. (line 51) +* -v <1>: nl invocation. (line 110) +* -v <2>: od invocation. (line 149) +* -v <3>: pr invocation. (line 225) +* -v <4>: head invocation. (line 50) +* -v <5>: tail invocation. (line 182) +* -V: sort invocation. (line 177) +* -v <6>: Sorting the output. (line 56) +* -v <7>: cp invocation. (line 368) +* -v <8>: install invocation. (line 135) +* -v <9>: mv invocation. (line 93) +* -v <10>: rm invocation. (line 97) +* -v <11>: shred invocation. (line 137) +* -v <12>: ln invocation. (line 178) +* -v <13>: mkdir invocation. (line 51) +* -v <14>: readlink invocation. (line 60) +* -v <15>: rmdir invocation. (line 31) +* -v <16>: chown invocation. (line 135) +* -v <17>: chgrp invocation. (line 62) +* -v <18>: chmod invocation. (line 59) +* -v <19>: uname invocation. (line 77) +* -v <20>: chcon invocation. (line 61) +* -w: nl invocation. (line 115) +* -w <1>: od invocation. (line 156) +* -w <2>: base64 invocation. (line 23) +* -w <3>: fmt invocation. (line 59) +* -w <4>: pr invocation. (line 229) +* -W: pr invocation. (line 239) +* -w <5>: fold invocation. (line 35) +* -w <6>: wc invocation. (line 51) +* -w <7>: md5sum invocation. (line 116) +* -w <8>: uniq invocation. (line 133) +* -W <1>: Input processing in ptx. + (line 105) +* -w <9>: Output formatting in ptx. + (line 32) +* -w <10>: General output formatting. + (line 118) +* -w <11>: Access permission tests. (line 21) -* -w <3>: General output formatting. - (line 104) -* -w <4>: uniq invocation. (line 103) -* -w <5>: md5sum invocation. (line 88) -* -w <6>: wc invocation. (line 49) -* -w: fold invocation. (line 35) -* -W: pr invocation. (line 264) -* -w <1>: pr invocation. (line 255) -* -w <2>: fmt invocation. (line 59) -* -w <3>: base64 invocation. (line 21) -* -w <4>: od invocation. (line 153) -* -w: nl invocation. (line 122) +* -w <12>: who invocation. (line 94) +* -w <13>: seq invocation. (line 47) * -WIDTH: fmt invocation. (line 59) -* -x <1>: Access permission tests. - (line 24) -* -x <2>: du invocation. (line 191) -* -x <3>: df invocation. (line 138) -* -x <4>: shred invocation. (line 133) -* -x <5>: cp invocation. (line 291) -* -x: General output formatting. - (line 88) +* -x: od invocation. (line 196) * -X: Sorting the output. (line 63) -* -x: od invocation. (line 194) -* -X FILE: du invocation. (line 201) -* -z <1>: String tests. (line 15) -* -z <2>: shred invocation. (line 143) -* -z <3>: shuf invocation. (line 48) -* -z <4>: sort invocation. (line 296) -* -z: csplit invocation. (line 89) -* .cshrc: su invocation. (line 44) -* /: Numeric expressions. (line 15) -* /bin/sh: su invocation. (line 12) -* /etc/passwd: su invocation. (line 12) -* /etc/shells: su invocation. (line 64) +* -x <1>: General output formatting. + (line 103) +* -x <2>: cp invocation. (line 372) +* -x <3>: shred invocation. (line 142) +* -x <4>: df invocation. (line 223) +* -x <5>: du invocation. (line 261) +* -x <6>: Access permission tests. + (line 24) +* -X FILE: du invocation. (line 250) +* -z: head invocation. (line 54) +* -z <1>: tail invocation. (line 186) +* -z <2>: csplit invocation. (line 93) +* -z <3>: sort invocation. (line 375) +* -z <4>: shuf invocation. (line 55) +* -z <5>: uniq invocation. (line 139) +* -z <6>: comm invocation. (line 61) +* -z <7>: cut invocation. (line 90) +* -z <8>: paste invocation. (line 72) +* -z <9>: join invocation. (line 155) +* -Z: What information is listed. + (line 255) +* -Z <1>: cp invocation. (line 378) +* -Z <2>: install invocation. (line 139) +* -Z <3>: mv invocation. (line 115) +* -z <10>: shred invocation. (line 153) +* -Z <4>: mkdir invocation. (line 56) +* -Z <5>: mkfifo invocation. (line 28) +* -Z <6>: mknod invocation. (line 53) +* -z <11>: readlink invocation. (line 64) +* -z <12>: String tests. (line 15) +* -z <13>: basename invocation. (line 42) +* -z <14>: dirname invocation. (line 31) +* -z <15>: realpath invocation. (line 76) +* -Z <7>: id invocation. (line 51) +* -z <16>: id invocation. (line 58) +* -z <17>: numfmt invocation. (line 115) +* /: Numeric expressions. (line 16) * 128-bit checksum: md5sum invocation. (line 6) * 16-bit checksum: sum invocation. (line 6) * 160-bit checksum: sha1sum invocation. (line 6) * 224-bit checksum: sha2 utilities. (line 6) * 256-bit checksum: sha2 utilities. (line 6) * 384-bit checksum: sha2 utilities. (line 6) -* 4.2 file system type: df invocation. (line 125) * 512-bit checksum: sha2 utilities. (line 6) * <: Relations for expr. (line 22) * <=: Relations for expr. (line 22) -* = <1>: Relations for expr. (line 22) -* =: String tests. (line 22) +* =: Relations for expr. (line 22) +* = <1>: String tests. (line 22) * ==: Relations for expr. (line 22) +* == <1>: String tests. (line 25) * >: Relations for expr. (line 22) * >=: Relations for expr. (line 22) * \( regexp operator: String expressions. (line 24) * \+ regexp operator: String expressions. (line 28) * \? regexp operator: String expressions. (line 28) -* \c: printf invocation. (line 23) -* \OOO: printf invocation. (line 57) -* \uhhhh: printf invocation. (line 62) -* \Uhhhhhhhh: printf invocation. (line 62) -* \xHH: printf invocation. (line 57) +* \c: printf invocation. (line 28) +* \OOO: printf invocation. (line 67) +* \uhhhh: printf invocation. (line 74) +* \Uhhhhhhhh: printf invocation. (line 74) +* \xHH: printf invocation. (line 67) * \| regexp operator: String expressions. (line 28) -* _POSIX2_VERSION <1>: touch invocation. (line 93) -* _POSIX2_VERSION <2>: uniq invocation. (line 46) -* _POSIX2_VERSION <3>: sort invocation. (line 328) -* _POSIX2_VERSION <4>: tail invocation. (line 150) * _POSIX2_VERSION: Standards conformance. - (line 19) + (line 18) +* _POSIX2_VERSION <1>: tail invocation. (line 201) +* _POSIX2_VERSION <2>: sort invocation. (line 407) +* _POSIX2_VERSION <3>: uniq invocation. (line 46) +* _POSIX2_VERSION <4>: touch invocation. (line 137) +* |: Relations for expr. (line 11) * abbreviations for months: Calendar date items. (line 38) * access permission tests: Access permission tests. (line 6) * access permissions, changing: chmod invocation. (line 6) -* access time: dd invocation. (line 171) -* access time, changing: touch invocation. (line 50) +* access time: dd invocation. (line 261) +* access time, changing: touch invocation. (line 78) * access time, printing or sorting files by: Sorting the output. (line 42) -* access time, show the most recent: du invocation. (line 149) -* across columns: pr invocation. (line 84) +* access time, show the most recent: du invocation. (line 208) +* across columns: pr invocation. (line 62) * across, listing files: General output formatting. - (line 88) -* adding permissions: Setting Permissions. (line 38) -* addition: Numeric expressions. (line 11) + (line 103) +* adding permissions: Setting Permissions. (line 35) +* addition: Numeric expressions. (line 12) * ago in date strings: Relative items in date strings. (line 23) +* all lines, grouping: uniq invocation. (line 100) * all repeated lines, outputting: uniq invocation. (line 69) -* alnum: Character sets. (line 91) -* alpha: Character sets. (line 94) -* alternate ebcdic, converting to: dd invocation. (line 67) +* alnum: Character sets. (line 88) +* alpha: Character sets. (line 90) +* alternate ebcdic, converting to: dd invocation. (line 103) * always color option: General output formatting. - (line 27) -* always interactive option: rm invocation. (line 57) + (line 26) +* always interactive option: rm invocation. (line 59) * am i: who invocation. (line 21) -* am in date strings: Time of day items. (line 22) -* and operator <1>: Relations for expr. (line 17) +* am in date strings: Time of day items. (line 21) * and operator: Connectives for test. - (line 12) -* append: dd invocation. (line 141) -* appending to the output file: dd invocation. (line 141) -* appropriate privileges <1>: nice invocation. (line 6) + (line 29) +* and operator <1>: Relations for expr. (line 17) +* append: dd invocation. (line 192) +* appending to the output file: dd invocation. (line 192) +* appropriate privileges: install invocation. (line 91) +* appropriate privileges <1>: Setting the time. (line 6) * appropriate privileges <2>: hostname invocation. (line 6) -* appropriate privileges <3>: Setting the time. (line 6) -* appropriate privileges: install invocation. (line 72) +* appropriate privileges <3>: nice invocation. (line 6) * arbitrary date strings, parsing: Options for date. (line 11) * arbitrary text, displaying: echo invocation. (line 6) +* arch: arch invocation. (line 6) * arithmetic tests: Numeric tests. (line 6) * ASCII dump of files: od invocation. (line 6) -* ascii, converting to: dd invocation. (line 59) -* atime, changing: touch invocation. (line 50) +* ascii, converting to: dd invocation. (line 92) +* atime, changing: touch invocation. (line 78) * atime, printing or sorting files by: Sorting the output. (line 42) -* atime, show the most recent: du invocation. (line 149) +* atime, show the most recent: du invocation. (line 208) * attributes, file: Changing file attributes. (line 6) -* authors of get_date: Authors of get_date. (line 6) +* authors of ‘parse_datetime’: Authors of parse_datetime. + (line 6) * auto color option: General output formatting. (line 25) -* automounter file systems: df invocation. (line 32) -* b for block special file: mknod invocation. (line 26) +* b for block special file: mknod invocation. (line 31) * background jobs, stopping at terminal write: Local. (line 41) -* backslash escapes <1>: echo invocation. (line 20) * backslash escapes: Character sets. (line 14) +* backslash escapes <1>: echo invocation. (line 25) +* backslash escapes <2>: echo invocation. (line 61) * backslash sequences for file names: Formatting the file names. (line 11) * backup files, ignoring: Which files are listed. (line 23) * backup options: Backup options. (line 6) -* backup suffix: Backup options. (line 50) -* backups, making <1>: ln invocation. (line 55) -* backups, making <2>: mv invocation. (line 50) -* backups, making <3>: install invocation. (line 40) -* backups, making <4>: cp invocation. (line 61) +* backup suffix: Backup options. (line 49) * backups, making: Backup options. (line 13) -* backups, making only: cp invocation. (line 42) +* backups, making <1>: cp invocation. (line 79) +* backups, making <2>: install invocation. (line 41) +* backups, making <3>: mv invocation. (line 59) +* backups, making <4>: ln invocation. (line 80) +* backups, making only: cp invocation. (line 51) +* base32: base32 invocation. (line 6) +* base32 encoding: base32 invocation. (line 6) * base64: base64 invocation. (line 6) -* Base64 decoding: base64 invocation. (line 29) +* Base64 decoding: base64 invocation. (line 31) * base64 encoding: base64 invocation. (line 6) * basename: basename invocation. (line 6) -* baud rate, setting: Special. (line 43) -* beeping at input buffer full: Input. (line 56) +* baud rate, setting: Special. (line 52) +* beeping at input buffer full: Input. (line 59) * beginning of time: Time conversion specifiers. - (line 41) + (line 32) * beginning of time, for POSIX: Seconds since the Epoch. (line 13) -* Bellovin, Steven M.: Authors of get_date. (line 6) -* Berets, Jim: Authors of get_date. (line 6) -* Berry, K. <1>: Authors of get_date. (line 14) -* Berry, K.: Introduction. (line 19) -* binary: dd invocation. (line 188) -* binary I/O: dd invocation. (line 188) -* binary input files: md5sum invocation. (line 38) -* blank: Character sets. (line 97) -* blank lines, numbering: nl invocation. (line 87) +* Bellovin, Steven M.: Authors of parse_datetime. + (line 6) +* Berets, Jim: Authors of parse_datetime. + (line 6) +* Berry, K.: Introduction. (line 29) +* Berry, K. <1>: Authors of parse_datetime. + (line 19) +* binary: dd invocation. (line 278) +* binary I/O: dd invocation. (line 278) +* binary input files: md5sum invocation. (line 40) +* bind mount: rm invocation. (line 69) +* bind mount <1>: stat invocation. (line 139) +* blank: Character sets. (line 92) +* blank lines, numbering: nl invocation. (line 82) * blanks, ignoring leading: sort invocation. (line 79) -* block (space-padding): dd invocation. (line 76) -* block size <1>: dd invocation. (line 33) +* block (space-padding): dd invocation. (line 113) * block size: Block size. (line 6) -* block size of conversion: dd invocation. (line 38) -* block size of input: dd invocation. (line 25) -* block size of output: dd invocation. (line 29) +* block size <1>: dd invocation. (line 34) +* block size of conversion: dd invocation. (line 41) +* block size of input: dd invocation. (line 26) +* block size of output: dd invocation. (line 30) * block special check: File type tests. (line 10) * block special files: mknod invocation. (line 11) * block special files, creating: mknod invocation. (line 6) -* BLOCK_SIZE: Block size. (line 12) * BLOCKSIZE: Block size. (line 12) +* BLOCK_SIZE: Block size. (line 12) * body, numbering: nl invocation. (line 17) * Bourne shell syntax for color setup: dircolors invocation. - (line 27) -* breaks, cause interrupts: Input. (line 10) -* breaks, ignoring: Input. (line 7) -* brkint: Input. (line 10) -* bs: dd invocation. (line 33) -* BSD sum: sum invocation. (line 25) -* BSD tail: tail invocation. (line 19) -* BSD touch compatibility: touch invocation. (line 68) + (line 34) +* breaks, cause interrupts: Input. (line 12) +* breaks, ignoring: Input. (line 9) +* brkint: Input. (line 12) +* bs: dd invocation. (line 34) +* BSD output: md5sum invocation. (line 97) +* BSD ‘sum’: sum invocation. (line 25) +* BSD ‘tail’: tail invocation. (line 26) +* BSD ‘touch’ compatibility: touch invocation. (line 96) * bsN: Output. (line 55) +* btrfs file system type: df invocation. (line 211) * bugs, reporting: Introduction. (line 12) -* built-in shell commands, conflicts with <1>: nice invocation. - (line 35) -* built-in shell commands, conflicts with <2>: pwd invocation. - (line 10) -* built-in shell commands, conflicts with: test invocation. (line 28) +* built-in shell commands, conflicts with: mknod invocation. (line 20) +* built-in shell commands, conflicts with <1>: stat invocation. + (line 15) +* built-in shell commands, conflicts with <2>: echo invocation. + (line 11) +* built-in shell commands, conflicts with <3>: printf invocation. + (line 16) +* built-in shell commands, conflicts with <4>: test invocation. + (line 28) +* built-in shell commands, conflicts with <5>: pwd invocation. + (line 30) +* built-in shell commands, conflicts with <6>: nice invocation. + (line 38) +* built-in shell commands, conflicts with <7>: kill invocation. + (line 13) +* built-in shell commands, conflicts with <8>: sleep invocation. + (line 31) * byte count: wc invocation. (line 6) -* byte-swapping: dd invocation. (line 95) -* c for character special file: mknod invocation. (line 29) +* byte-swapping: od invocation. (line 51) +* byte-swapping <1>: dd invocation. (line 144) +* c for character special file: mknod invocation. (line 34) * C shell syntax for color setup: dircolors invocation. - (line 33) -* C-s/C-q flow control: Input. (line 38) + (line 40) +* C-s/C-q flow control: Input. (line 40) * calendar date item: Calendar date items. (line 6) -* case folding: sort invocation. (line 92) +* calling combined multi-call program: Multi-call invocation. + (line 6) +* canonical file name: readlink invocation. (line 6) +* canonical file name <1>: realpath invocation. (line 6) +* canonicalize a file name: readlink invocation. (line 6) +* canonicalize a file name <1>: realpath invocation. (line 6) +* case folding: sort invocation. (line 94) * case translation: Local. (line 36) -* case, ignored in dates: General date syntax. (line 64) +* case, ignored in dates: General date syntax. (line 60) * cat: cat invocation. (line 6) * cbreak: Combination. (line 52) -* cbs: dd invocation. (line 38) -* CD-ROM file system type: df invocation. (line 129) -* cdfs file system type: df invocation. (line 129) +* cbs: dd invocation. (line 41) +* CD-ROM file system type: df invocation. (line 215) +* cdfs file system type: df invocation. (line 215) +* cdtrdsr: Control. (line 44) * change or print terminal settings: stty invocation. (line 6) -* changed files, verbosely describing: chgrp invocation. (line 20) -* changed owners, verbosely describing: chown invocation. (line 70) +* change SELinux context: chcon invocation. (line 6) +* changed files, verbosely describing: chgrp invocation. (line 24) +* changed owners, verbosely describing: chown invocation. (line 73) * changing access permissions: chmod invocation. (line 6) * changing file attributes: Changing file attributes. (line 6) * changing file ownership: chown invocation. (line 6) * changing file timestamps: touch invocation. (line 6) -* changing group ownership <1>: chgrp invocation. (line 6) * changing group ownership: chown invocation. (line 6) +* changing group ownership <1>: chgrp invocation. (line 6) +* changing security context: chcon invocation. (line 6) * changing special mode bits: Changing Special Mode Bits. (line 6) -* character classes: Character sets. (line 78) +* character classes: Character sets. (line 74) * character count: wc invocation. (line 6) -* character size: Control. (line 19) +* character size: Control. (line 24) * character special check: File type tests. (line 13) * character special files: mknod invocation. (line 11) * character special files, creating: mknod invocation. (line 6) * characters, special: Characters. (line 6) +* chcon: chcon invocation. (line 6) * check file types: test invocation. (line 6) -* checking for sortedness: sort invocation. (line 18) +* checking for sortedness: sort invocation. (line 39) +* checking for sortedness <1>: sort invocation. (line 47) * checksum, 128-bit: md5sum invocation. (line 6) * checksum, 16-bit: sum invocation. (line 6) * checksum, 160-bit: sha1sum invocation. (line 6) @@ -14368,22 +17404,32 @@ Index * chmod: chmod invocation. (line 6) * chown: chown invocation. (line 6) * chroot: chroot invocation. (line 6) +* cio: dd invocation. (line 200) * cksum: cksum invocation. (line 6) -* clocal: Control. (line 33) -* cntrl: Character sets. (line 100) +* clocal: Control. (line 38) +* clock skew: Formatting file timestamps. + (line 11) +* clock skew <1>: touch invocation. (line 17) +* clone: cp invocation. (line 264) +* cmspar: Control. (line 16) +* cntrl: Character sets. (line 94) * color database, printing: dircolors invocation. - (line 38) + (line 45) * color setup: dircolors invocation. (line 6) * color, distinguishing file types with: General output formatting. - (line 21) + (line 22) * cols: Special. (line 27) -* column to wrap data after: base64 invocation. (line 21) -* COLUMNS: Special. (line 30) -* columns: Special. (line 27) +* column to wrap data after: base64 invocation. (line 23) * COLUMNS: General output formatting. - (line 104) + (line 118) +* COLUMNS <1>: Special. (line 39) +* columns: Special. (line 27) * combination settings: Combination. (line 6) +* combined: Multi-call invocation. + (line 6) +* combined date and time of day item: Combined date and time of day items. + (line 6) * comm: comm invocation. (line 6) * command-line operands to shuffle: shuf invocation. (line 19) * commands for controlling processes: Process control. (line 6) @@ -14397,10 +17443,11 @@ Index * commands for printing the working context: Working context. (line 6) * commands for printing user information: User information. (line 6) * commands for redirection: Redirection. (line 6) +* commands for SELinux context: SELinux context. (line 6) * commands for system context: System context. (line 6) * commas, outputting between files: General output formatting. - (line 78) -* comments, in dates: General date syntax. (line 64) + (line 93) +* comments, in dates: General date syntax. (line 60) * common field, joining on: join invocation. (line 6) * common lines: comm invocation. (line 18) * common options: Common options. (line 6) @@ -14408,22 +17455,30 @@ Index * comparing sorted files: comm invocation. (line 6) * comparison operators: Relations for expr. (line 22) * concatenate and write files: cat invocation. (line 6) +* concurrent I/O: dd invocation. (line 200) * conditional executability: Conditional Executability. (line 6) * conditions: Conditions. (line 6) -* conflicts with shell built-ins <1>: nice invocation. (line 35) -* conflicts with shell built-ins <2>: pwd invocation. (line 10) -* conflicts with shell built-ins: test invocation. (line 28) -* connectives, logical <1>: Relations for expr. (line 6) +* conflicts with shell built-ins: mknod invocation. (line 20) +* conflicts with shell built-ins <1>: stat invocation. (line 15) +* conflicts with shell built-ins <2>: echo invocation. (line 11) +* conflicts with shell built-ins <3>: printf invocation. (line 16) +* conflicts with shell built-ins <4>: test invocation. (line 28) +* conflicts with shell built-ins <5>: pwd invocation. (line 30) +* conflicts with shell built-ins <6>: nice invocation. (line 38) +* conflicts with shell built-ins <7>: kill invocation. (line 13) +* conflicts with shell built-ins <8>: sleep invocation. (line 31) * connectives, logical: Connectives for test. (line 6) +* connectives, logical <1>: Relations for expr. (line 6) +* constant parity: Control. (line 16) * context splitting: csplit invocation. (line 6) * context, system: System context. (line 6) -* control characters, using ^C: Local. (line 51) +* control characters, using ‘^C’: Local. (line 51) * control settings: Control. (line 6) -* controlling terminal: dd invocation. (line 176) -* conv: dd invocation. (line 53) -* conversion block size: dd invocation. (line 38) +* controlling terminal: dd invocation. (line 266) +* conv: dd invocation. (line 86) +* conversion block size: dd invocation. (line 41) * conversion specifiers, date: Date conversion specifiers. (line 6) * conversion specifiers, literal: Literal conversion specifiers. @@ -14433,130 +17488,154 @@ Index * converting tabs to spaces: expand invocation. (line 6) * converting while copying a file: dd invocation. (line 6) * cooked: Combination. (line 37) -* Coordinated Universal Time: Options for date. (line 83) -* copying directories recursively: cp invocation. (line 76) +* Coordinated Universal Time: Options for date. (line 113) +* copy on write: cp invocation. (line 264) +* copying directories recursively: cp invocation. (line 96) +* copying directories recursively <1>: cp invocation. (line 251) * copying existing permissions: Copying Permissions. (line 6) * copying files: cat invocation. (line 6) * copying files and directories: cp invocation. (line 6) * copying files and setting attributes: install invocation. (line 6) -* core utilities: Top. (line 19) -* count: dd invocation. (line 49) +* core utilities: Top. (line 18) +* count: dd invocation. (line 56) +* count_bytes: dd invocation. (line 296) +* COW: cp invocation. (line 264) * cp: cp invocation. (line 6) -* crashes and corruption: sync invocation. (line 11) +* crashes and corruption: sync invocation. (line 17) * CRC checksum: cksum invocation. (line 6) -* cread: Control. (line 30) +* cread: Control. (line 35) * creating directories: mkdir invocation. (line 6) * creating FIFOs (named pipes): mkfifo invocation. (line 6) * creating links (hard only): link invocation. (line 6) * creating links (hard or soft): ln invocation. (line 6) -* creating output file, avoiding: dd invocation. (line 103) -* creating output file, requiring: dd invocation. (line 107) +* creating output file, avoiding: dd invocation. (line 161) +* creating output file, requiring: dd invocation. (line 157) * crN: Output. (line 45) * crown margin: fmt invocation. (line 34) -* crt: Combination. (line 74) +* crt: Combination. (line 75) * crterase: Local. (line 22) * crtkill: Local. (line 56) -* crtscts: Control. (line 36) -* csh syntax for color setup: dircolors invocation. - (line 33) -* csN: Control. (line 19) +* crtscts: Control. (line 41) +* ‘csh’ syntax for color setup: dircolors invocation. + (line 40) +* csN: Control. (line 24) * csplit: csplit invocation. (line 6) -* cstopb: Control. (line 27) +* cstopb: Control. (line 32) * ctime, printing or sorting by: Sorting the output. (line 13) -* ctime, show the most recent: du invocation. (line 144) +* ctime, show the most recent: du invocation. (line 203) * ctlecho: Local. (line 51) * current working directory, printing: pwd invocation. (line 6) * cut: cut invocation. (line 6) * cyclic redundancy check: cksum invocation. (line 6) * data, erasing: shred invocation. (line 6) * database for color setup, printing: dircolors invocation. - (line 38) + (line 45) * date: date invocation. (line 6) +* date and time of day format, ISO 8601: Combined date and time of day items. + (line 6) * date conversion specifiers: Date conversion specifiers. (line 6) * date format, ISO 8601: Calendar date items. (line 30) * date input formats: Date input formats. (line 6) -* date options: Options for date. (line 6) +* ‘date’ options: Options for date. (line 6) * date strings, parsing: Options for date. (line 11) * day in date strings: Relative items in date strings. (line 15) +* day in date strings <1>: Relative items in date strings. + (line 29) * day of week item: Day of week items. (line 6) * dd: dd invocation. (line 6) -* dec: Combination. (line 77) +* ddrescue: dd invocation. (line 345) +* dec: Combination. (line 78) * decctlq: Combination. (line 63) -* Decode base64 data: base64 invocation. (line 29) +* Decode base64 data: base64 invocation. (line 31) * delay for a specified time: sleep invocation. (line 6) * delaying commands: Delaying. (line 6) -* deleting characters: Squeezing. (line 6) +* deleting characters: Squeezing and deleting. + (line 6) * dereferencing symbolic links: ln invocation. (line 40) -* descriptor follow option: tail invocation. (line 41) -* destination directory <1>: ln invocation. (line 105) -* destination directory <2>: mv invocation. (line 99) -* destination directory <3>: install invocation. (line 97) -* destination directory <4>: cp invocation. (line 268) +* descriptor follow option: tail invocation. (line 55) * destination directory: Target directory. (line 15) +* destination directory <1>: Target directory. (line 31) +* destination directory <2>: cp invocation. (line 345) +* destination directory <3>: cp invocation. (line 349) +* destination directory <4>: install invocation. (line 125) +* destination directory <5>: install invocation. (line 130) +* destination directory <6>: mv invocation. (line 106) +* destination directory <7>: mv invocation. (line 110) +* destination directory <8>: ln invocation. (line 169) +* destination directory <9>: ln invocation. (line 173) * destinations, multiple output: tee invocation. (line 6) -* device file, disk: df invocation. (line 19) +* device file, disk: df invocation. (line 30) * df: df invocation. (line 6) * DF_BLOCK_SIZE: Block size. (line 12) -* dictionary order: sort invocation. (line 85) +* diagnostic: chcon invocation. (line 61) +* dictionary order: sort invocation. (line 87) * differing lines: comm invocation. (line 18) -* digit: Character sets. (line 103) +* digit: Character sets. (line 96) * dir: dir invocation. (line 6) * dircolors: dircolors invocation. (line 6) -* direct: dd invocation. (line 149) -* direct I/O: dd invocation. (line 149) +* direct: dd invocation. (line 206) +* direct I/O: dd invocation. (line 206) * directories, copying: cp invocation. (line 6) -* directories, copying recursively: cp invocation. (line 76) +* directories, copying recursively: cp invocation. (line 96) +* directories, copying recursively <1>: cp invocation. (line 251) * directories, creating: mkdir invocation. (line 6) * directories, creating with given attributes: install invocation. - (line 48) -* directories, removing (recursively): rm invocation. (line 91) + (line 67) +* directories, removing: rm invocation. (line 35) +* directories, removing (recursively): rm invocation. (line 93) * directories, removing empty: rmdir invocation. (line 6) -* directory: dd invocation. (line 152) +* directory: dd invocation. (line 214) * directory check: File type tests. (line 16) * directory components, printing: dirname invocation. (line 6) * directory deletion, ignoring failures: rmdir invocation. (line 17) * directory deletion, reporting: rmdir invocation. (line 31) -* directory I/O: dd invocation. (line 152) +* directory I/O: dd invocation. (line 214) * directory listing: ls invocation. (line 6) * directory listing, brief: dir invocation. (line 6) * directory listing, recursive: Which files are listed. (line 90) * directory listing, verbose: vdir invocation. (line 6) * directory order, listing by: Sorting the output. (line 20) +* directory, creating temporary: mktemp invocation. (line 6) * directory, stripping from file names: basename invocation. (line 6) * dired Emacs mode support: What information is listed. (line 16) * dirname: dirname invocation. (line 6) -* disabling special characters: Characters. (line 13) +* disabling special characters: Characters. (line 12) * disambiguating group names and IDs: Disambiguating names and IDs. (line 6) +* discard: Characters. (line 39) +* discarding file cache: dd invocation. (line 231) * disk allocation: What information is listed. - (line 242) -* disk device file: df invocation. (line 19) + (line 232) +* disk device file: df invocation. (line 30) * disk usage: Disk usage. (line 6) * disk usage by file system: df invocation. (line 6) * disk usage for files: du invocation. (line 6) -* diskette file system: df invocation. (line 133) +* disks, failing: dd invocation. (line 345) * displacement of dates: Relative items in date strings. (line 6) * displaying text: echo invocation. (line 6) * displaying value of a symbolic link: readlink invocation. (line 6) -* division: Numeric expressions. (line 15) +* division: Numeric expressions. (line 16) * do nothing, successfully: true invocation. (line 6) * do nothing, unsuccessfully: false invocation. (line 6) -* DOS file system: df invocation. (line 133) -* double spacing: pr invocation. (line 96) -* down columns: pr invocation. (line 70) -* dsusp: Characters. (line 53) -* dsync: dd invocation. (line 157) +* DOS file system: df invocation. (line 219) +* double spacing: pr invocation. (line 74) +* down columns: pr invocation. (line 49) +* drain: Special. (line 30) +* dsusp: Characters. (line 57) +* dsync: dd invocation. (line 220) +* DTR/DSR flow control: Control. (line 44) * du: du invocation. (line 6) * DU_BLOCK_SIZE: Block size. (line 12) -* ebcdic, converting to: dd invocation. (line 63) -* echo <1>: Local. (line 18) +* DVD file system type: df invocation. (line 215) +* ebcdic, converting to: dd invocation. (line 98) * echo: echo invocation. (line 6) +* echo <1>: Local. (line 18) * echoctl: Local. (line 51) * echoe: Local. (line 22) * echok: Local. (line 26) @@ -14565,85 +17644,95 @@ Index * echoprt: Local. (line 46) * effective user and group IDs, printing: id invocation. (line 6) * effective user ID, printing: whoami invocation. (line 6) -* efs file system type: df invocation. (line 125) -* Eggert, Paul: Authors of get_date. (line 6) +* Eggert, Paul: Authors of parse_datetime. + (line 6) +* eight-bit characters: Control. (line 24) * eight-bit characters <1>: Combination. (line 55) -* eight-bit characters: Control. (line 19) -* eight-bit input: Input. (line 23) +* eight-bit input: Input. (line 25) * ek: Combination. (line 22) * empty files, creating: touch invocation. (line 11) -* empty lines, numbering: nl invocation. (line 87) +* empty lines, numbering: nl invocation. (line 82) +* endianness: od invocation. (line 51) * entire files, output of: Output of entire files. (line 6) * env: env invocation. (line 6) * environment variables, printing: printenv invocation. (line 6) -* environment, preserving: su invocation. (line 64) -* environment, printing: env invocation. (line 30) +* environment, printing: env invocation. (line 45) * environment, running a program in a modified: env invocation. (line 6) -* eof: Characters. (line 32) -* eol: Characters. (line 35) -* eol2: Characters. (line 38) +* eof: Characters. (line 30) +* eol: Characters. (line 33) +* eol2: Characters. (line 36) * epoch, for POSIX: Seconds since the Epoch. (line 13) * epoch, seconds since: Time conversion specifiers. - (line 41) + (line 32) * equal string check: String tests. (line 22) -* equivalence classes: Character sets. (line 127) -* erase: Characters. (line 26) +* equal string check <1>: String tests. (line 25) +* equivalence classes: Character sets. (line 113) +* erase: Characters. (line 24) * erasing data: shred invocation. (line 6) -* error messages, omitting <1>: chmod invocation. (line 45) -* error messages, omitting <2>: chgrp invocation. (line 26) -* error messages, omitting: chown invocation. (line 76) +* error messages, omitting: chown invocation. (line 79) +* error messages, omitting <1>: chgrp invocation. (line 30) +* error messages, omitting <2>: chmod invocation. (line 45) * evaluation of expressions: expr invocation. (line 6) * even parity: Control. (line 13) * evenp: Combination. (line 9) -* exabyte, definition of: Block size. (line 116) -* examples of date: Examples of date. (line 6) -* examples of expr: Examples of expr. (line 6) -* exbibyte, definition of: Block size. (line 120) -* excl: dd invocation. (line 107) -* excluding files from du: du invocation. (line 195) +* exabyte, definition of: Block size. (line 106) +* examples of ‘date’: Examples of date. (line 6) +* examples of ‘expr’: Examples of expr. (line 6) +* exbibyte, definition of: Block size. (line 109) +* excl: dd invocation. (line 157) +* excluding files from ‘du’: du invocation. (line 250) +* excluding files from ‘du’ <1>: du invocation. (line 255) * executable file check: Access permission tests. (line 24) * executables and file type, marking: General output formatting. - (line 36) -* execute/search permission: Mode Structure. (line 18) -* execute/search permission, symbolic: Setting Permissions. (line 63) + (line 47) +* execute/search permission: Mode Structure. (line 16) +* execute/search permission, symbolic: Setting Permissions. (line 56) * existence-of-file check: File characteristic tests. (line 9) * existing backup method: Backup options. (line 39) * exit status commands: Conditions. (line 6) -* exit status of chroot: chroot invocation. (line 47) -* exit status of env: env invocation. (line 49) -* exit status of expr: expr invocation. (line 39) -* exit status of false: false invocation. (line 6) -* exit status of ls: ls invocation. (line 29) -* exit status of nice: nice invocation. (line 53) -* exit status of nohup: nohup invocation. (line 42) -* exit status of pathchk: pathchk invocation. (line 50) -* exit status of printenv: printenv invocation. (line 17) -* exit status of sort: sort invocation. (line 58) -* exit status of su: su invocation. (line 80) -* exit status of test: test invocation. (line 40) -* exit status of true: true invocation. (line 6) -* exit status of tty: tty invocation. (line 21) +* exit status of ‘chroot’: chroot invocation. (line 78) +* exit status of ‘env’: env invocation. (line 97) +* exit status of ‘expr’: expr invocation. (line 43) +* exit status of ‘false’: false invocation. (line 6) +* exit status of ‘ls’: ls invocation. (line 29) +* exit status of ‘mktemp’: mktemp invocation. (line 128) +* exit status of ‘nice’: nice invocation. (line 63) +* exit status of ‘nohup’: nohup invocation. (line 48) +* exit status of ‘pathchk’: pathchk invocation. (line 47) +* exit status of ‘printenv’: printenv invocation. (line 23) +* exit status of ‘realpath’: realpath invocation. (line 80) +* exit status of ‘runcon’: runcon invocation. (line 45) +* exit status of ‘sort’: sort invocation. (line 58) +* exit status of ‘stdbuf’: stdbuf invocation. (line 69) +* exit status of ‘test’: test invocation. (line 41) +* exit status of ‘timeout’: timeout invocation. (line 61) +* exit status of ‘true’: true invocation. (line 6) +* exit status of ‘tty’: tty invocation. (line 20) * expand: expand invocation. (line 6) * expr: expr invocation. (line 6) -* expression evaluation <1>: expr invocation. (line 6) * expression evaluation: test invocation. (line 6) +* expression evaluation <1>: expr invocation. (line 6) * expressions, numeric: Numeric expressions. (line 6) * expressions, string: String expressions. (line 6) +* ext2 file system type: df invocation. (line 211) +* ext3 file system type: df invocation. (line 211) +* ext4 file system type: df invocation. (line 211) +* extended attributes, xattr: install invocation. (line 34) +* extended attributes, xattr <1>: mv invocation. (line 33) * extension, sorting files by: Sorting the output. (line 63) +* extproc: Local. (line 61) * factor: factor invocation. (line 6) * failure exit status: false invocation. (line 6) * false: false invocation. (line 6) -* fascism: su invocation. (line 87) -* fdatasync: dd invocation. (line 121) -* FDL, GNU Free Documentation License: GNU Free Documentation License. - (line 6) +* fat file system file: df invocation. (line 219) +* fdatasync: dd invocation. (line 173) * ffN: Output. (line 63) -* field separator character: sort invocation. (line 253) +* field separator character: sort invocation. (line 323) * fields, padding numeric: Padding and other flags. (line 6) * FIFOs, creating: mkfifo invocation. (line 6) @@ -14652,57 +17741,70 @@ Index * file characteristic tests: File characteristic tests. (line 6) * file contents, dumping unambiguously: od invocation. (line 6) -* file information, preserving: cp invocation. (line 134) +* file information, preserving: cp invocation. (line 234) +* file information, preserving, extended attributes, xattr: cp invocation. + (line 168) * file mode bits, numeric: Numeric Modes. (line 6) * file name manipulation: File name manipulation. (line 6) -* file name pattern expansion, disabled: su invocation. (line 44) +* file names, canonicalization: realpath invocation. (line 6) * file names, checking validity and portability: pathchk invocation. (line 6) +* file names, creating temporary: mktemp invocation. (line 6) * file names, stripping directory and suffix: basename invocation. (line 6) * file offset radix: od invocation. (line 36) * file ownership, changing: chown invocation. (line 6) -* file sizes: du invocation. (line 45) +* file sizes: du invocation. (line 52) * file space usage: du invocation. (line 6) * file status: stat invocation. (line 6) * file system disk usage: df invocation. (line 6) -* file system sizes: df invocation. (line 38) +* file system sizes: df invocation. (line 54) * file system space, retrieving current data more slowly: df invocation. - (line 100) + (line 174) * file system space, retrieving old data more quickly: df invocation. - (line 67) + (line 84) * file system status: stat invocation. (line 6) * file system types, limiting output to certain: df invocation. - (line 63) -* file system types, printing: df invocation. (line 113) -* file systems: stat invocation. (line 23) + (line 80) +* file system types, limiting output to certain <1>: df invocation. + (line 194) +* file system types, printing: df invocation. (line 200) +* file systems: stat invocation. (line 28) * file systems and hard links: ln invocation. (line 6) -* file systems, omitting copying to different: cp invocation. (line 291) +* file systems, omitting copying to different: cp invocation. (line 372) +* file timestamp resolution: touch invocation. (line 26) * file timestamps, changing: touch invocation. (line 6) * file type and executables, marking: General output formatting. - (line 36) + (line 47) * file type tests: File type tests. (line 6) * file type, marking: General output formatting. - (line 47) + (line 58) +* file type, marking <1>: General output formatting. + (line 98) * file types: Special file types. (line 9) * file types, special: Special file types. (line 6) -* file utilities: Top. (line 19) -* files beginning with -, removing: rm invocation. (line 98) +* file utilities: Top. (line 18) +* files beginning with ‘-’, removing: rm invocation. (line 99) * files, copying: cp invocation. (line 6) +* files, creating: truncate invocation. (line 11) * fingerprint, 128-bit: md5sum invocation. (line 6) * fingerprint, 160-bit: sha1sum invocation. (line 6) * fingerprint, 224-bit: sha2 utilities. (line 6) * fingerprint, 256-bit: sha2 utilities. (line 6) * fingerprint, 384-bit: sha2 utilities. (line 6) * fingerprint, 512-bit: sha2 utilities. (line 6) -* first in date strings: General date syntax. (line 26) +* first in date strings: General date syntax. (line 22) * first part of files, outputting: head invocation. (line 6) * fixed-length records, converting to variable-length: dd invocation. - (line 38) -* flow control, hardware: Control. (line 36) -* flow control, software: Input. (line 43) + (line 41) +* floating point: Floating point. (line 6) +* flow control, hardware: Control. (line 41) +* flow control, hardware <1>: Control. (line 44) +* flow control, software: Input. (line 45) +* flush: Characters. (line 39) * flushing, disabling: Local. (line 32) +* flusho: Local. (line 67) * fmt: fmt invocation. (line 6) * fold: fold invocation. (line 6) * folding long input lines: fold invocation. (line 6) @@ -14710,260 +17812,292 @@ Index * force deletion: shred invocation. (line 101) * formatting file contents: Formatting file contents. (line 6) -* formatting of numbers in seq: seq invocation. (line 24) +* formatting of numbers in ‘seq’: seq invocation. (line 26) +* formatting times: pr invocation. (line 78) * formatting times <1>: date invocation. (line 20) -* formatting times: pr invocation. (line 100) * fortnight in date strings: Relative items in date strings. (line 15) -* fsync: dd invocation. (line 125) +* fsync: dd invocation. (line 177) +* fullblock: dd invocation. (line 286) * general date syntax: General date syntax. (line 6) -* general numeric sort: sort invocation. (line 98) -* get_date: Date input formats. (line 6) -* gibibyte, definition of: Block size. (line 99) -* gigabyte, definition of: Block size. (line 95) +* general numeric sort: sort invocation. (line 105) +* gibibyte, definition of: Block size. (line 94) +* gigabyte, definition of: Block size. (line 91) * giving away permissions: Umask and Protection. (line 12) -* globbing, disabled: su invocation. (line 44) -* GMT: Options for date. (line 83) -* grand total of disk space: du invocation. (line 50) -* graph: Character sets. (line 106) -* Greenwich Mean Time: Options for date. (line 83) +* GMT: Options for date. (line 113) +* grand total of disk size, usage and available space: df invocation. + (line 180) +* grand total of disk space: du invocation. (line 61) +* graph: Character sets. (line 98) +* Greenwich Mean Time: Options for date. (line 113) * group IDs, disambiguating: Disambiguating names and IDs. (line 6) * group names, disambiguating: Disambiguating names and IDs. (line 6) -* group owner, default: Mode Structure. (line 31) +* group owner, default: Mode Structure. (line 27) * group ownership of installed files, setting: install invocation. - (line 54) -* group ownership, changing <1>: chgrp invocation. (line 6) + (line 73) * group ownership, changing: chown invocation. (line 6) -* group wheel, not supported: su invocation. (line 87) -* group, permissions for: Setting Permissions. (line 26) +* group ownership, changing <1>: chgrp invocation. (line 6) +* group, permissions for: Setting Permissions. (line 25) * groups: groups invocation. (line 6) -* growing files: tail invocation. (line 41) +* growing files: tail invocation. (line 55) * hangups, immunity to: nohup invocation. (line 6) * hard link check: File characteristic tests. (line 23) -* hard link, defined: ln invocation. (line 32) -* hard links: dd invocation. (line 185) -* hard links to directories: ln invocation. (line 61) -* hard links, counting in du: du invocation. (line 91) -* hard links, creating <1>: ln invocation. (line 6) +* hard link, defined: ln invocation. (line 30) +* hard links: dd invocation. (line 275) +* hard links to directories: ln invocation. (line 86) +* hard links to symbolic links: ln invocation. (line 180) +* hard links, counting in ‘du’: du invocation. (line 123) * hard links, creating: link invocation. (line 6) -* hard links, preserving: cp invocation. (line 89) -* hardware class: uname invocation. (line 41) -* hardware flow control: Control. (line 36) +* hard links, creating <1>: ln invocation. (line 6) +* hard links, preserving: cp invocation. (line 109) +* hardware class: uname invocation. (line 42) +* hardware flow control: Control. (line 41) +* hardware flow control <1>: Control. (line 44) * hardware platform: uname invocation. (line 35) -* hardware type: uname invocation. (line 41) +* hardware type: uname invocation. (line 42) * hat notation for control characters: Local. (line 51) * head: head invocation. (line 6) -* head of output: shuf invocation. (line 32) +* head of output: shuf invocation. (line 31) * headers, numbering: nl invocation. (line 17) -* help, online: Common options. (line 29) +* help, online: Common options. (line 36) * hex dump of files: od invocation. (line 6) -* High Sierra file system: df invocation. (line 129) -* holes, copying files with: cp invocation. (line 216) -* HOME: su invocation. (line 18) +* holes, copying files with: cp invocation. (line 294) +* holes, creating files with: truncate invocation. (line 13) * horizontal, listing files: General output formatting. - (line 88) -* host processor type: uname invocation. (line 50) + (line 103) +* host processor type: uname invocation. (line 51) * hostid: hostid invocation. (line 6) -* hostname <1>: hostname invocation. (line 6) -* hostname: uname invocation. (line 46) +* hostname: hostname invocation. (line 6) +* hostname <1>: uname invocation. (line 47) * hour in date strings: Relative items in date strings. (line 15) -* hsfs file system type: df invocation. (line 129) -* human-readable output <1>: du invocation. (line 75) -* human-readable output <2>: df invocation. (line 43) -* human-readable output <3>: What information is listed. +* human numeric sort: sort invocation. (line 126) +* human-readable output: Block size. (line 42) +* human-readable output <1>: What information is listed. (line 116) -* human-readable output: Block size. (line 43) -* hup[cl]: Control. (line 23) +* human-readable output <2>: df invocation. (line 59) +* human-readable output <3>: du invocation. (line 96) +* hup[cl]: Control. (line 28) * hurd, author, printing: What information is listed. (line 10) -* ibs: dd invocation. (line 25) +* ibs: dd invocation. (line 26) * icanon: Local. (line 11) -* icrnl: Input. (line 32) +* icrnl: Input. (line 34) * id: id invocation. (line 6) -* idle time: who invocation. (line 62) +* idle time: who invocation. (line 85) +* IEEE floating point: Floating point. (line 6) * iexten: Local. (line 15) -* if: dd invocation. (line 17) -* iflag: dd invocation. (line 130) -* ignbrk: Input. (line 7) -* igncr: Input. (line 29) -* ignore file systems: df invocation. (line 32) -* Ignore garbage in base64 stream: base64 invocation. (line 35) -* ignoring case: sort invocation. (line 92) -* ignpar: Input. (line 13) -* imaxbel: Input. (line 56) +* if: dd invocation. (line 18) +* iflag: dd invocation. (line 181) +* ignbrk: Input. (line 9) +* igncr: Input. (line 31) +* ignore file systems: df invocation. (line 42) +* Ignore garbage in base64 stream: base64 invocation. (line 37) +* ignoring case: sort invocation. (line 94) +* ignpar: Input. (line 15) +* imaxbel: Input. (line 59) * immunity to hangups: nohup invocation. (line 6) * implementation, hardware: uname invocation. (line 35) -* including files from du <1>: du invocation. (line 62) -* including files from du: wc invocation. (line 60) -* indenting lines: pr invocation. (line 204) +* indenting lines: pr invocation. (line 180) * index: String expressions. (line 45) * information, about current users: who invocation. (line 6) * initial part of files, outputting: head invocation. (line 6) -* initial tabs, converting: expand invocation. (line 34) -* inlcr: Input. (line 26) +* initial tabs, converting: expand invocation. (line 33) +* inlcr: Input. (line 28) * inode number, printing: What information is listed. - (line 122) -* inode usage: df invocation. (line 52) -* inode, and hard links: ln invocation. (line 32) -* inodes, written buffered: sync invocation. (line 6) -* inpck: Input. (line 20) -* input block size: dd invocation. (line 25) -* input encoding, UTF-8: Input. (line 35) + (line 123) +* inode usage: df invocation. (line 69) +* inode usage, dereferencing in ‘du’: du invocation. (line 102) +* inode, and hard links: ln invocation. (line 30) +* inodes, written buffered: sync invocation. (line 11) +* inpck: Input. (line 22) +* input block size: dd invocation. (line 26) +* input encoding, UTF-8: Input. (line 37) * input range to shuffle: shuf invocation. (line 23) * input settings: Input. (line 6) -* input tabs: pr invocation. (line 120) +* input tabs: pr invocation. (line 98) * install: install invocation. (line 6) -* interactivity <1>: mv invocation. (line 64) -* interactivity: cp invocation. (line 188) -* intr: Characters. (line 20) +* intr: Characters. (line 18) * invocation of commands, modified: Modified command invocation. (line 6) * isig: Local. (line 7) +* ISO 8601 date and time of day format: Combined date and time of day items. + (line 6) * ISO 8601 date format: Calendar date items. (line 30) -* ISO/IEC 10646: printf invocation. (line 62) +* ISO/IEC 10646: printf invocation. (line 74) +* ISO9660 file system type: df invocation. (line 215) +* iso9660 file system type: df invocation. (line 215) * ispeed: Special. (line 16) -* istrip: Input. (line 23) +* istrip: Input. (line 25) * items in date strings: General date syntax. (line 6) -* iterations, selecting the number of: shred invocation. (line 106) -* iuclc: Input. (line 48) -* iutf8: Input. (line 35) -* ixany: Input. (line 52) -* ixoff: Input. (line 43) -* ixon: Input. (line 38) +* iterations, selecting the number of: shred invocation. (line 105) +* iuclc: Input. (line 50) +* iutf8: Input. (line 37) +* ixany: Input. (line 55) +* ixoff: Input. (line 45) +* ixon: Input. (line 40) * join: join invocation. (line 6) -* kernel name: uname invocation. (line 65) -* kernel release: uname invocation. (line 61) -* kernel version: uname invocation. (line 76) -* kibibyte, definition of: Block size. (line 83) -* kibibytes for file sizes: du invocation. (line 85) -* kibibytes for file system sizes: df invocation. (line 57) -* kill <1>: kill invocation. (line 6) -* kill: Characters. (line 29) +* kernel name: uname invocation. (line 66) +* kernel release: uname invocation. (line 62) +* kernel version: uname invocation. (line 77) +* kibibyte, definition of: Block size. (line 82) +* kibibytes for file sizes: du invocation. (line 111) +* kibibytes for file system sizes: df invocation. (line 74) +* kill: kill invocation. (line 6) +* kill <1>: Characters. (line 27) * kilobyte, definition of: Block size. (line 78) * Knuth, Donald E.: fmt invocation. (line 19) -* language, in dates: General date syntax. (line 40) -* last DAY <1>: Day of week items. (line 15) -* last DAY: Options for date. (line 11) -* last in date strings: General date syntax. (line 26) -* last modified dates, displaying in du: du invocation. (line 138) +* language, in dates: General date syntax. (line 36) +* language, in dates <1>: General date syntax. (line 40) +* last DAY: Day of week items. (line 15) +* last DAY <1>: Options for date. (line 11) +* last in date strings: General date syntax. (line 22) +* last modified dates, displaying in ‘du’: du invocation. (line 197) * last part of files, outputting: tail invocation. (line 6) +* lcase: Combination. (line 71) +* LCASE: Combination. (line 71) +* lcase, converting to: dd invocation. (line 124) +* lchown: chown invocation. (line 106) +* lchown <1>: chown invocation. (line 111) +* lchown <2>: chgrp invocation. (line 34) +* lchown <3>: chgrp invocation. (line 39) +* LC_ALL: sort invocation. (line 23) * LC_ALL <1>: ls invocation. (line 17) -* LC_ALL: sort invocation. (line 49) -* LC_COLLATE <1>: Relations for expr. (line 22) -* LC_COLLATE <2>: join invocation. (line 14) -* LC_COLLATE <3>: comm invocation. (line 12) -* LC_COLLATE <4>: uniq invocation. (line 21) -* LC_COLLATE: sort invocation. (line 49) -* LC_CTYPE <1>: printf invocation. (line 62) +* LC_COLLATE: sort invocation. (line 23) +* LC_COLLATE <1>: uniq invocation. (line 21) +* LC_COLLATE <2>: comm invocation. (line 12) +* LC_COLLATE <3>: join invocation. (line 14) +* LC_COLLATE <4>: Relations for expr. (line 22) * LC_CTYPE: sort invocation. (line 79) +* LC_CTYPE <1>: sort invocation. (line 87) +* LC_CTYPE <2>: sort invocation. (line 94) +* LC_CTYPE <3>: sort invocation. (line 143) +* LC_CTYPE <4>: printf invocation. (line 74) * LC_MESSAGES: pr invocation. (line 13) -* LC_NUMERIC <1>: printf invocation. (line 51) -* LC_NUMERIC <2>: sort invocation. (line 98) * LC_NUMERIC: Block size. (line 57) -* LC_TIME <1>: date invocation. (line 11) -* LC_TIME <2>: du invocation. (line 158) +* LC_NUMERIC <1>: Floating point. (line 17) +* LC_NUMERIC <2>: sort invocation. (line 105) +* LC_NUMERIC <3>: sort invocation. (line 126) +* LC_NUMERIC <4>: sort invocation. (line 160) +* LC_NUMERIC <5>: printf invocation. (line 61) +* LC_TIME: pr invocation. (line 85) +* LC_TIME <1>: sort invocation. (line 150) +* LC_TIME <2>: Formatting file timestamps. + (line 28) * LC_TIME <3>: Formatting file timestamps. - (line 30) -* LC_TIME <4>: sort invocation. (line 131) -* LC_TIME: pr invocation. (line 107) -* LCASE: Combination. (line 71) -* lcase: Combination. (line 71) -* lcase, converting to: dd invocation. (line 87) -* lchown <1>: chgrp invocation. (line 30) -* lchown: chown invocation. (line 103) -* leading directories, creating missing: install invocation. (line 48) + (line 73) +* LC_TIME <4>: Formatting file timestamps. + (line 97) +* LC_TIME <5>: du invocation. (line 217) +* LC_TIME <6>: date invocation. (line 11) +* leading directories, creating missing: install invocation. (line 67) * leading directory components, stripping: basename invocation. (line 6) -* left margin: pr invocation. (line 204) +* leap seconds: touch invocation. (line 129) +* leap seconds <1>: Time conversion specifiers. + (line 32) +* leap seconds <2>: Time conversion specifiers. + (line 36) +* leap seconds <3>: Options for date. (line 113) +* leap seconds <4>: Examples of date. (line 104) +* leap seconds <5>: General date syntax. (line 65) +* leap seconds <6>: Time of day items. (line 14) +* leap seconds <7>: Seconds since the Epoch. + (line 26) +* left margin: pr invocation. (line 180) * length: String expressions. (line 50) -* limiting output of du: du invocation. (line 111) -* line: Special. (line 37) +* limiting output of ‘du’: du invocation. (line 74) +* line: Special. (line 46) +* line buffered: stdbuf invocation. (line 6) * line count: wc invocation. (line 6) * line numbering: nl invocation. (line 6) +* line separator character: split invocation. (line 142) * line settings of terminal: stty invocation. (line 6) * line-breaking: fmt invocation. (line 19) * line-by-line comparison: comm invocation. (line 6) -* LINES: Special. (line 30) +* LINES: Special. (line 39) * link: link invocation. (line 6) -* links, creating <1>: ln invocation. (line 6) * links, creating: link invocation. (line 6) -* Linux file system types: df invocation. (line 125) +* links, creating <1>: ln invocation. (line 6) +* Linux file system types: df invocation. (line 211) * literal conversion specifiers: Literal conversion specifiers. (line 6) * litout: Combination. (line 59) * ln: ln invocation. (line 6) -* ln format for nl: nl invocation. (line 98) -* lnext: Characters. (line 62) -* local file system types: df invocation. (line 125) +* ln format for ‘nl’: nl invocation. (line 93) +* lnext: Characters. (line 66) +* local file system types: df invocation. (line 211) * local settings: Local. (line 6) * logging out and continuing to run: nohup invocation. (line 6) -* logical and operator <1>: Relations for expr. (line 17) * logical and operator: Connectives for test. - (line 12) -* logical connectives <1>: Relations for expr. (line 6) + (line 29) +* logical and operator <1>: Relations for expr. (line 17) * logical connectives: Connectives for test. (line 6) -* logical or operator <1>: Relations for expr. (line 11) +* logical connectives <1>: Relations for expr. (line 6) * logical or operator: Connectives for test. - (line 15) + (line 33) +* logical or operator <1>: Relations for expr. (line 11) * logical pages, numbering on: nl invocation. (line 12) * login name, printing: logname invocation. (line 6) * login sessions, printing users with: users invocation. (line 6) -* login shell: su invocation. (line 18) -* login shell, creating: su invocation. (line 53) * login time: who invocation. (line 11) -* LOGNAME: su invocation. (line 18) * logname: logname invocation. (line 6) * long ls format: What information is listed. - (line 130) -* lower: Character sets. (line 109) + (line 131) +* lower: Character sets. (line 100) * lowercase, translating to output: Output. (line 12) * ls: ls invocation. (line 6) * LS_BLOCK_SIZE: Block size. (line 12) -* LS_COLORS: dircolors invocation. - (line 16) -* machine type: uname invocation. (line 41) -* machine-readable stty output: stty invocation. (line 41) -* MacKenzie, D.: Introduction. (line 19) -* MacKenzie, David: Authors of get_date. (line 6) -* Makefiles, installing programs in: install invocation. (line 30) +* LS_COLORS: General output formatting. + (line 32) +* LS_COLORS <1>: dircolors invocation. + (line 23) +* lutimes: touch invocation. (line 100) +* machine type: uname invocation. (line 42) +* machine-readable ‘stty’ output: stty invocation. (line 41) +* MacKenzie, D.: Introduction. (line 29) +* MacKenzie, David: Authors of parse_datetime. + (line 6) +* Makefiles, installing programs in: install invocation. (line 29) * manipulating files: Basic operations. (line 6) * manipulation of file names: File name manipulation. (line 6) +* mark parity: Control. (line 16) * match: String expressions. (line 36) * matching patterns: String expressions. (line 11) * MD5: md5sum invocation. (line 6) * md5sum: md5sum invocation. (line 6) -* mebibyte, definition of: Block size. (line 92) -* mebibytes for file sizes: du invocation. (line 101) -* megabyte, definition of: Block size. (line 88) +* mebibyte, definition of: Block size. (line 89) +* mebibytes for file sizes: du invocation. (line 127) +* megabyte, definition of: Block size. (line 86) * merging files: paste invocation. (line 6) * merging files in parallel: pr invocation. (line 6) -* merging sorted files: sort invocation. (line 32) -* message status: who invocation. (line 86) +* merging sorted files: sort invocation. (line 53) +* message status: who invocation. (line 94) * message-digest, 128-bit: md5sum invocation. (line 6) * message-digest, 160-bit: sha1sum invocation. (line 6) * message-digest, 224-bit: sha2 utilities. (line 6) * message-digest, 256-bit: sha2 utilities. (line 6) * message-digest, 384-bit: sha2 utilities. (line 6) * message-digest, 512-bit: sha2 utilities. (line 6) -* Meyering, J.: Introduction. (line 19) -* Meyering, Jim: Authors of get_date. (line 6) -* midnight in date strings: Time of day items. (line 22) +* Meyering, J.: Introduction. (line 29) +* Meyering, Jim: Authors of parse_datetime. + (line 6) +* midnight in date strings: Time of day items. (line 21) * min: Special. (line 7) * minute in date strings: Relative items in date strings. (line 15) -* minutes, time zone correction by: Time of day items. (line 30) -* MIT AI lab: su invocation. (line 92) +* minutes, time zone correction by: Time of day items. (line 29) * mkdir: mkdir invocation. (line 6) * mkfifo: mkfifo invocation. (line 6) * mknod: mknod invocation. (line 6) -* modem control: Control. (line 33) +* mktemp: mktemp invocation. (line 6) +* modem control: Control. (line 38) * modes and umask: Umask and Protection. (line 6) * modes of created directories, setting: mkdir invocation. (line 19) @@ -14973,106 +18107,123 @@ Index (line 6) * modified environment, running a program in a: env invocation. (line 6) -* modify time, changing: touch invocation. (line 73) +* modify time, changing: touch invocation. (line 115) * month in date strings: Relative items in date strings. (line 15) * month names in date strings: Calendar date items. (line 38) -* months, sorting by: sort invocation. (line 131) -* months, written-out: General date syntax. (line 36) -* MS-DOS file system: df invocation. (line 133) -* mtime, changing: touch invocation. (line 73) +* months, sorting by: sort invocation. (line 150) +* months, written-out: General date syntax. (line 32) +* MS-DOS file system: df invocation. (line 219) +* MS-Windows file system: df invocation. (line 219) +* mtime, changing: touch invocation. (line 115) +* multicall: Multi-call invocation. + (line 6) * multicolumn output, generating: pr invocation. (line 6) * multiple changes to permissions: Multiple Changes. (line 6) -* multiplication: Numeric expressions. (line 15) -* multipliers after numbers: dd invocation. (line 204) +* multiplication: Numeric expressions. (line 16) +* multipliers after numbers: dd invocation. (line 320) +* multithreaded sort: sort invocation. (line 352) * mv: mv invocation. (line 6) -* name follow option: tail invocation. (line 41) -* name of kernel: uname invocation. (line 65) +* name follow option: tail invocation. (line 55) +* name of kernel: uname invocation. (line 66) * named pipe check: File type tests. (line 28) * named pipes, creating: mkfifo invocation. (line 6) -* network node name: uname invocation. (line 46) -* never interactive option: rm invocation. (line 52) -* newer files, copying only: cp invocation. (line 277) -* newer files, moving only: mv invocation. (line 76) +* network node name: uname invocation. (line 47) +* never interactive option: rm invocation. (line 56) +* newer files, copying only: cp invocation. (line 354) +* newer files, moving only: mv invocation. (line 83) * newer-than file check: File characteristic tests. (line 15) -* newline echoing after kill: Local. (line 26) +* newline echoing after ‘kill’: Local. (line 26) * newline, echoing: Local. (line 29) * newline, translating to crlf: Output. (line 19) -* newline, translating to return: Input. (line 26) -* next DAY <1>: Day of week items. (line 15) -* next DAY: Options for date. (line 11) -* next in date strings: General date syntax. (line 26) -* NFS file system type: df invocation. (line 120) -* NFS mounts from BSD to HP-UX <1>: du invocation. (line 206) +* newline, translating to return: Input. (line 28) +* next DAY: Day of week items. (line 15) +* next DAY <1>: Options for date. (line 11) +* next in date strings: General date syntax. (line 22) +* NFS file system type: df invocation. (line 206) * NFS mounts from BSD to HP-UX: What information is listed. - (line 250) + (line 240) +* NFS mounts from BSD to HP-UX <1>: du invocation. (line 264) * nice: nice invocation. (line 6) * niceness: nice invocation. (line 6) -* nl <1>: Combination. (line 18) * nl: nl invocation. (line 6) +* nl <1>: Combination. (line 18) * nlN: Output. (line 39) +* no dereference: chcon invocation. (line 26) * no-op: true invocation. (line 6) -* noatime: dd invocation. (line 171) -* nocreat: dd invocation. (line 103) -* noctty: dd invocation. (line 176) -* node name: uname invocation. (line 46) -* noerror: dd invocation. (line 100) +* noatime: dd invocation. (line 261) +* nocache: dd invocation. (line 231) +* nocreat: dd invocation. (line 161) +* noctty: dd invocation. (line 266) +* node name: uname invocation. (line 47) +* noerror: dd invocation. (line 170) * noflsh: Local. (line 32) -* nofollow: dd invocation. (line 182) +* nofollow: dd invocation. (line 272) * nohup: nohup invocation. (line 6) * nohup.out: nohup invocation. (line 6) -* nolinks: dd invocation. (line 185) -* non-directories, copying as special files: cp invocation. (line 76) +* nohup.out <1>: nohup invocation. (line 20) +* nolinks: dd invocation. (line 275) +* non-directories, copying as special files: cp invocation. (line 96) +* non-directories, copying as special files <1>: cp invocation. + (line 251) * non-directory suffix, stripping: dirname invocation. (line 6) -* nonblock: dd invocation. (line 168) -* nonblocking I/O: dd invocation. (line 168) +* nonblock: dd invocation. (line 258) +* nonblocking I/O: dd invocation. (line 258) +* nonblocking ‘stty’ setting: Special. (line 30) * none backup method: Backup options. (line 31) * none color option: General output formatting. - (line 23) -* none, sorting option for ls: Sorting the output. (line 49) + (line 24) +* none dd status=: dd invocation. (line 72) +* none, sorting option for ‘ls’: Sorting the output. (line 49) * nonempty file check: File characteristic tests. (line 12) -* nonprinting characters, ignoring: sort invocation. (line 125) +* nonprinting characters, ignoring: sort invocation. (line 143) * nonzero-length string check: String tests. (line 19) -* noon in date strings: Time of day items. (line 22) -* not-equal string check: String tests. (line 25) -* notrunc: dd invocation. (line 113) +* noon in date strings: Time of day items. (line 21) +* not-equal string check: String tests. (line 28) +* notrunc: dd invocation. (line 167) * now in date strings: Relative items in date strings. (line 33) +* noxfer dd status=: dd invocation. (line 76) +* nproc: nproc invocation. (line 6) +* NTFS file system: df invocation. (line 219) +* ntfs file system file: df invocation. (line 219) +* number of inputs to merge, nmerge: sort invocation. (line 256) * numbered backup method: Backup options. (line 35) * numbering lines: nl invocation. (line 6) -* numbers, written-out: General date syntax. (line 26) +* numbers, written-out: General date syntax. (line 22) * numeric expressions: Numeric expressions. (line 6) * numeric field padding: Padding and other flags. (line 6) * numeric modes: Numeric Modes. (line 6) * numeric operations: Numeric operations. (line 6) * numeric sequences: seq invocation. (line 6) -* numeric sort: sort invocation. (line 140) +* numeric sort: sort invocation. (line 160) * numeric tests: Numeric tests. (line 6) * numeric uid and gid: What information is listed. - (line 232) + (line 222) * numeric user and group IDs: What information is listed. - (line 232) -* obs: dd invocation. (line 29) + (line 222) +* numfmt: numfmt invocation. (line 6) +* obs: dd invocation. (line 30) * ocrnl: Output. (line 16) * octal dump of files: od invocation. (line 6) * octal numbers for file modes: Numeric Modes. (line 6) * od: od invocation. (line 6) * odd parity: Control. (line 13) * oddp: Combination. (line 14) -* of: dd invocation. (line 20) +* of: dd invocation. (line 21) * ofdel: Output. (line 34) * ofill: Output. (line 30) -* oflag: dd invocation. (line 134) +* oflag: dd invocation. (line 185) * olcuc: Output. (line 12) * older-than file check: File characteristic tests. (line 19) -* once interactive option: rm invocation. (line 54) -* one file system, restricting du to: du invocation. (line 191) -* one file system, restricting rm to: rm invocation. (line 63) -* one-line output format: df invocation. (line 74) +* once interactive option: rm invocation. (line 57) +* one file system, restricting ‘du’ to: du invocation. (line 261) +* one file system, restricting ‘rm’ to: rm invocation. (line 65) +* one-line output format: df invocation. (line 148) * onlcr: Output. (line 19) * onlret: Output. (line 27) * onocr: Output. (line 23) @@ -15080,114 +18231,122 @@ Index (line 6) * operating on sorted files: Operating on sorted files. (line 6) -* operating system name: uname invocation. (line 57) +* operating system name: uname invocation. (line 58) * opost: Output. (line 9) -* option delimiter: Common options. (line 36) -* options for date: Options for date. (line 6) -* or operator <1>: Relations for expr. (line 11) +* option delimiter: Common options. (line 43) +* options for ‘date’: Options for date. (line 6) * or operator: Connectives for test. - (line 15) -* ordinal numbers: General date syntax. (line 26) + (line 33) +* or operator <1>: Relations for expr. (line 11) +* ordinal numbers: General date syntax. (line 22) * ospeed: Special. (line 19) -* other permissions: Setting Permissions. (line 29) -* output block size: dd invocation. (line 29) -* output file name prefix <1>: csplit invocation. (line 62) -* output file name prefix: split invocation. (line 14) -* output file name suffix: csplit invocation. (line 66) -* output format: stat invocation. (line 28) -* output format, portable: df invocation. (line 74) -* output null-byte-terminated lines: du invocation. (line 117) +* other permissions: Setting Permissions. (line 27) +* output block size: dd invocation. (line 30) +* output file name prefix: split invocation. (line 15) +* output file name prefix <1>: csplit invocation. (line 61) +* output file name suffix: csplit invocation. (line 65) +* output format: stat invocation. (line 34) +* output format <1>: stat invocation. (line 43) +* output format, portable: df invocation. (line 148) +* output NUL-byte-terminated lines: readlink invocation. (line 64) +* output NUL-byte-terminated lines <1>: du invocation. (line 26) +* output NUL-byte-terminated lines <2>: basename invocation. (line 42) +* output NUL-byte-terminated lines <3>: dirname invocation. (line 31) +* output NUL-byte-terminated lines <4>: realpath invocation. (line 76) +* output NUL-byte-terminated lines <5>: printenv invocation. (line 19) +* output NUL-byte-terminated lines <6>: env invocation. (line 82) * output of entire files: Output of entire files. (line 6) * output of parts of files: Output of parts of files. (line 6) * output settings: Output. (line 6) -* output tabs: pr invocation. (line 140) -* overwriting of input, allowed <1>: shuf invocation. (line 37) -* overwriting of input, allowed: sort invocation. (line 213) +* output tabs: pr invocation. (line 117) +* overwriting of input, allowed: sort invocation. (line 282) +* overwriting of input, allowed <1>: shuf invocation. (line 36) * owned by effective group ID check: Access permission tests. (line 31) * owned by effective user ID check: Access permission tests. (line 28) * owner of file, permissions for: Setting Permissions. (line 23) -* owner, default: Mode Structure. (line 31) -* ownership of installed files, setting: install invocation. (line 72) -* p for FIFO file: mknod invocation. (line 23) +* owner, default: Mode Structure. (line 27) +* ownership of installed files, setting: install invocation. (line 91) +* p for FIFO file: mknod invocation. (line 28) * pad character: Output. (line 34) * pad instead of timing for delaying: Output. (line 30) * padding of numeric fields: Padding and other flags. (line 6) * paragraphs, reformatting: fmt invocation. (line 6) * parenb: Control. (line 9) -* parent directories and cp: cp invocation. (line 177) +* parent directories and ‘cp’: cp invocation. (line 238) * parent directories, creating: mkdir invocation. (line 34) -* parent directories, creating missing: install invocation. (line 48) +* parent directories, creating missing: install invocation. (line 67) * parent directories, removing: rmdir invocation. (line 22) * parentheses for grouping: expr invocation. (line 31) * parity: Combination. (line 10) -* parity errors, marking: Input. (line 16) -* parity, ignoring: Input. (line 13) -* parmrk: Input. (line 16) +* parity errors, marking: Input. (line 18) +* parity, ignoring: Input. (line 15) +* parmrk: Input. (line 18) * parodd: Control. (line 13) +* parse_datetime: Date input formats. (line 6) * parsing date strings: Options for date. (line 11) * parts of files, output of: Output of parts of files. (line 6) * pass8: Combination. (line 55) -* passwd entry, and su shell: su invocation. (line 12) * paste: paste invocation. (line 6) -* Paterson, R.: Introduction. (line 19) -* PATH <1>: su invocation. (line 53) -* PATH: env invocation. (line 24) +* Paterson, R.: Introduction. (line 29) +* PATH: env invocation. (line 23) * pathchk: pathchk invocation. (line 6) * pattern matching: String expressions. (line 11) -* PC file system: df invocation. (line 133) -* pcfs: df invocation. (line 133) -* pebibyte, definition of: Block size. (line 113) +* pebibyte, definition of: Block size. (line 104) * permission tests: Access permission tests. (line 6) * permissions of installed files, setting: install invocation. - (line 60) + (line 79) * permissions, changing access: chmod invocation. (line 6) * permissions, copying existing: Copying Permissions. (line 6) * permissions, for changing file timestamps: touch invocation. - (line 16) -* permissions, output by ls: What information is listed. - (line 190) -* petabyte, definition of: Block size. (line 109) -* phone directory order: sort invocation. (line 85) + (line 40) +* permissions, output by ‘ls’: What information is listed. + (line 179) +* petabyte, definition of: Block size. (line 101) +* phone directory order: sort invocation. (line 87) * pieces, splitting a file into: split invocation. (line 6) -* Pinard, F. <1>: Authors of get_date. (line 14) -* Pinard, F.: Introduction. (line 19) +* Pinard, F.: Introduction. (line 29) +* Pinard, F. <1>: Authors of parse_datetime. + (line 19) * pipe fitting: tee invocation. (line 6) * Plass, Michael F.: fmt invocation. (line 19) * platform, hardware: uname invocation. (line 35) -* pm in date strings: Time of day items. (line 22) +* pm in date strings: Time of day items. (line 21) * portable file names, checking for: pathchk invocation. (line 6) -* portable output format: df invocation. (line 74) +* portable output format: df invocation. (line 148) * POSIX: Introduction. (line 11) -* POSIX output format: df invocation. (line 74) -* POSIXLY_CORRECT <1>: printf invocation. (line 42) -* POSIXLY_CORRECT <2>: echo invocation. (line 68) -* POSIXLY_CORRECT <3>: dd invocation. (line 237) -* POSIXLY_CORRECT <4>: sort invocation. (line 221) -* POSIXLY_CORRECT <5>: tail invocation. (line 75) -* POSIXLY_CORRECT <6>: pr invocation. (line 107) -* POSIXLY_CORRECT <7>: Standards conformance. - (line 6) +* POSIX output format: df invocation. (line 148) * POSIXLY_CORRECT: Common options. (line 11) +* POSIXLY_CORRECT <1>: Standards conformance. + (line 6) +* POSIXLY_CORRECT <2>: pr invocation. (line 85) +* POSIXLY_CORRECT <3>: sort invocation. (line 290) +* POSIXLY_CORRECT <4>: sort invocation. (line 407) +* POSIXLY_CORRECT <5>: dd invocation. (line 389) +* POSIXLY_CORRECT <6>: echo invocation. (line 65) +* POSIXLY_CORRECT <7>: printf invocation. (line 53) +* POSIXLY_CORRECT <8>: id invocation. (line 15) * POSIXLY_CORRECT, and block size: Block size. (line 12) * pr: pr invocation. (line 6) * prime factors: factor invocation. (line 6) -* print: Character sets. (line 112) +* print: Character sets. (line 102) +* print machine hardware name: arch invocation. (line 6) * print name of current directory: pwd invocation. (line 6) * print system information: uname invocation. (line 6) * print terminal file name: tty invocation. (line 6) +* Print the number of processors: nproc invocation. (line 6) * printenv: printenv invocation. (line 6) * printf: printf invocation. (line 6) * printing all or some environment variables: printenv invocation. (line 6) * printing color database: dircolors invocation. - (line 38) + (line 45) * printing current user information: who invocation. (line 6) * printing current usernames: users invocation. (line 6) * printing groups a user is in: groups invocation. (line 6) @@ -15199,135 +18358,189 @@ Index * printing the effective user ID: whoami invocation. (line 6) * printing the host identifier: hostid invocation. (line 6) * printing the hostname: hostname invocation. (line 6) -* printing user's login name: logname invocation. (line 6) +* printing the system uptime and load: uptime invocation. (line 6) +* printing user’s login name: logname invocation. (line 6) * printing, preparing files for: pr invocation. (line 6) +* process zero-terminated items: head invocation. (line 54) +* process zero-terminated items <1>: tail invocation. (line 186) +* process zero-terminated items <2>: sort invocation. (line 375) +* process zero-terminated items <3>: shuf invocation. (line 55) +* process zero-terminated items <4>: uniq invocation. (line 139) +* process zero-terminated items <5>: comm invocation. (line 61) +* process zero-terminated items <6>: cut invocation. (line 90) +* process zero-terminated items <7>: paste invocation. (line 72) +* process zero-terminated items <8>: join invocation. (line 155) +* process zero-terminated items <9>: numfmt invocation. (line 115) * processes, commands for controlling: Process control. (line 6) -* prompting, and ln: ln invocation. (line 71) -* prompting, and mv: mv invocation. (line 34) -* prompting, and rm: rm invocation. (line 11) -* prompts, forcing: mv invocation. (line 59) -* prompts, omitting: mv invocation. (line 55) +* progress dd status=: dd invocation. (line 80) +* prompting, and ‘ln’: ln invocation. (line 96) +* prompting, and ‘mv’: mv invocation. (line 37) +* prompting, and ‘rm’: rm invocation. (line 11) +* prompts, forcing: mv invocation. (line 70) +* prompts, omitting: mv invocation. (line 64) +* prompts, omitting <1>: mv invocation. (line 77) * prterase: Local. (line 46) * ptx: ptx invocation. (line 6) -* punct: Character sets. (line 115) +* punct: Character sets. (line 104) * pure numbers in date strings: Pure numbers in date strings. (line 6) * pwd: pwd invocation. (line 6) -* quit: Characters. (line 23) +* quit: Characters. (line 21) * quoting style: Formatting the file names. (line 34) * radix for file offsets: od invocation. (line 36) -* random sort: sort invocation. (line 162) -* random source for shredding: shred invocation. (line 112) -* random source for shuffling: shuf invocation. (line 43) -* random source for sorting: sort invocation. (line 226) +* random seed: Random sources. (line 31) +* random sort: sort invocation. (line 189) +* random source for shredding: shred invocation. (line 111) +* random source for shuffling: shuf invocation. (line 42) +* random source for sorting: sort invocation. (line 295) * random sources: Random sources. (line 6) -* ranges: Character sets. (line 50) +* ranges: Character sets. (line 44) * raw: Combination. (line 43) -* read errors, ignoring: dd invocation. (line 100) +* read errors, ignoring: dd invocation. (line 170) * read from stdin and write to stdout and files: tee invocation. (line 6) * read permission: Mode Structure. (line 12) -* read permission, symbolic: Setting Permissions. (line 57) -* read system call, and holes: cp invocation. (line 216) +* read permission, symbolic: Setting Permissions. (line 52) +* read system call, and holes: cp invocation. (line 294) * readable file check: Access permission tests. (line 15) * readlink: readlink invocation. (line 6) * real user and group IDs, printing: id invocation. (line 6) +* realpath: readlink invocation. (line 6) +* realpath <1>: realpath invocation. (line 6) +* realpath <2>: realpath invocation. (line 6) +* realpath <3>: realpath invocation. (line 6) +* record separator character: split invocation. (line 142) * recursive directory listing: Which files are listed. (line 90) * recursively changing access permissions: chmod invocation. (line 69) -* recursively changing file ownership: chown invocation. (line 140) -* recursively changing group ownership: chgrp invocation. (line 66) -* recursively copying directories: cp invocation. (line 76) +* recursively changing file ownership: chown invocation. (line 143) +* recursively changing group ownership: chgrp invocation. (line 70) +* recursively copying directories: cp invocation. (line 96) +* recursively copying directories <1>: cp invocation. (line 251) * redirection: Redirection. (line 6) +* reference file: chcon invocation. (line 30) * reformatting paragraph text: fmt invocation. (line 6) * regular expression matching: String expressions. (line 11) * regular file check: File type tests. (line 19) * relations, numeric or string: Relations for expr. (line 6) * relative items in date strings: Relative items in date strings. (line 6) -* release of kernel: uname invocation. (line 61) -* remainder: Numeric expressions. (line 15) +* release of kernel: uname invocation. (line 62) +* relpath: realpath invocation. (line 44) +* remainder: Numeric expressions. (line 16) * remote hostname: who invocation. (line 11) +* removing characters: Squeezing and deleting. + (line 6) * removing empty directories: rmdir invocation. (line 6) -* removing files after shredding: shred invocation. (line 123) +* removing files after shredding: shred invocation. (line 122) * removing files or directories: rm invocation. (line 6) * removing files or directories (via the unlink syscall): unlink invocation. (line 6) -* removing permissions: Setting Permissions. (line 42) -* repeated characters: Character sets. (line 71) +* removing permissions: Setting Permissions. (line 38) +* repeat output values: shuf invocation. (line 47) +* repeated characters: Character sets. (line 66) * repeated lines, outputting: uniq invocation. (line 63) * repeated output of a string: yes invocation. (line 6) -* restricted deletion flag: Mode Structure. (line 56) -* restricted shell: su invocation. (line 64) -* return, ignoring: Input. (line 29) +* restricted deletion flag: Mode Structure. (line 49) +* return, ignoring: Input. (line 31) +* return, translating to newline: Input. (line 34) * return, translating to newline <1>: Output. (line 16) -* return, translating to newline: Input. (line 32) +* reverse sorting: sort invocation. (line 183) * reverse sorting <1>: Sorting the output. (line 27) -* reverse sorting: sort invocation. (line 157) * reversing files: tac invocation. (line 6) * rm: rm invocation. (line 6) * rmdir: rmdir invocation. (line 6) -* rn format for nl: nl invocation. (line 101) -* root as default owner: install invocation. (line 72) -* root directory, allow recursive destruction: rm invocation. (line 84) -* root directory, allow recursive modification <1>: chmod invocation. - (line 54) -* root directory, allow recursive modification <2>: chgrp invocation. - (line 48) +* rn format for ‘nl’: nl invocation. (line 95) +* root as default owner: install invocation. (line 91) +* root directory, allow recursive destruction: rm invocation. (line 86) * root directory, allow recursive modification: chown invocation. - (line 121) + (line 124) +* root directory, allow recursive modification <1>: chgrp invocation. + (line 52) +* root directory, allow recursive modification <2>: chmod invocation. + (line 54) * root directory, disallow recursive destruction: rm invocation. - (line 79) -* root directory, disallow recursive modification <1>: chmod invocation. - (line 49) -* root directory, disallow recursive modification <2>: chgrp invocation. - (line 43) + (line 81) * root directory, disallow recursive modification: chown invocation. - (line 116) + (line 119) +* root directory, disallow recursive modification <1>: chgrp invocation. + (line 47) +* root directory, disallow recursive modification <2>: chmod invocation. + (line 49) * root directory, running a program in a specified: chroot invocation. (line 6) -* root, becoming: su invocation. (line 6) * rows: Special. (line 22) -* rprnt: Characters. (line 56) -* RTS/CTS flow control: Control. (line 36) +* rprnt: Characters. (line 60) +* RTS/CTS flow control: Control. (line 41) +* run commands with bounded time: timeout invocation. (line 6) +* run with security context: runcon invocation. (line 6) +* runcon: runcon invocation. (line 6) * running a program in a modified environment: env invocation. (line 6) * running a program in a specified root directory: chroot invocation. (line 6) -* rz format for nl: nl invocation. (line 104) -* Salz, Rich: Authors of get_date. (line 6) +* rz format for ‘nl’: nl invocation. (line 97) +* Salz, Rich: Authors of parse_datetime. + (line 6) * same file check: File characteristic tests. (line 23) * sane: Combination. (line 26) * scheduling, affecting: nice invocation. (line 6) * screen columns: fold invocation. (line 14) * seconds since the epoch: Time conversion specifiers. - (line 41) -* section delimiters of pages: nl invocation. (line 68) -* seek: dd invocation. (line 46) -* self-backups: cp invocation. (line 42) + (line 32) +* section delimiters of pages: nl invocation. (line 63) +* security context: What information is listed. + (line 255) +* security context <1>: cp invocation. (line 378) +* security context <2>: install invocation. (line 96) +* security context <3>: install invocation. (line 139) +* security context <4>: mv invocation. (line 115) +* security context <5>: mkdir invocation. (line 56) +* security context <6>: mkfifo invocation. (line 28) +* security context <7>: mknod invocation. (line 53) +* security context <8>: id invocation. (line 51) +* seek: dd invocation. (line 51) +* seek_bytes: dd invocation. (line 308) +* self-backups: cp invocation. (line 51) +* SELinux: What information is listed. + (line 255) +* SELinux <1>: install invocation. (line 96) +* SELinux <2>: id invocation. (line 51) +* SELinux context: SELinux context. (line 6) +* SELinux, context: SELinux context. (line 6) +* SELinux, restoring security context: mv invocation. (line 115) +* SELinux, setting/restoring security context: cp invocation. (line 378) +* SELinux, setting/restoring security context <1>: install invocation. + (line 139) +* SELinux, setting/restoring security context <2>: mkdir invocation. + (line 56) +* SELinux, setting/restoring security context <3>: mkfifo invocation. + (line 28) +* SELinux, setting/restoring security context <4>: mknod invocation. + (line 53) * send a signal to processes: kill invocation. (line 6) * sentences and line-breaking: fmt invocation. (line 19) -* separator for numbers in seq: seq invocation. (line 42) +* separator for numbers in ‘seq’: seq invocation. (line 42) * seq: seq invocation. (line 6) * sequence of numbers: seq invocation. (line 6) -* set-group-ID: Mode Structure. (line 49) +* set-group-ID: Mode Structure. (line 43) * set-group-ID check: Access permission tests. (line 9) -* set-user-ID: Mode Structure. (line 42) +* set-user-ID: Mode Structure. (line 38) * set-user-ID check: Access permission tests. (line 18) -* setgid: Mode Structure. (line 49) -* setting permissions: Setting Permissions. (line 46) +* setgid: Mode Structure. (line 43) +* setting permissions: Setting Permissions. (line 41) * setting the hostname: hostname invocation. (line 6) * setting the time: Setting the time. (line 6) -* setuid: Mode Structure. (line 42) +* setuid: Mode Structure. (line 38) * setup for color: dircolors invocation. (line 6) -* sh syntax for color setup: dircolors invocation. - (line 27) +* ‘sh’ syntax for color setup: dircolors invocation. + (line 34) * SHA-1: sha1sum invocation. (line 6) * SHA-2: sha2 utilities. (line 6) * sha1sum: sha1sum invocation. (line 6) @@ -15335,145 +18548,179 @@ Index * sha256sum: sha2 utilities. (line 6) * sha384sum: sha2 utilities. (line 6) * sha512sum: sha2 utilities. (line 6) -* SHELL: su invocation. (line 18) -* SHELL environment variable, and color: dircolors invocation. - (line 16) -* shell utilities: Top. (line 19) +* SHELL environment variable, and color: General output formatting. + (line 32) +* SHELL environment variable, and color <1>: dircolors invocation. + (line 23) +* shell utilities: Top. (line 18) * shred: shred invocation. (line 6) * shuf: shuf invocation. (line 6) * shuffling files: shuf invocation. (line 6) -* SI output <1>: du invocation. (line 123) -* SI output <2>: df invocation. (line 93) -* SI output <3>: What information is listed. - (line 258) -* SI output: Block size. (line 43) +* SI output: Block size. (line 42) +* SI output <1>: What information is listed. + (line 247) +* SI output <2>: df invocation. (line 167) +* SI output <3>: du invocation. (line 145) +* signals, specifying: Signal specifications. + (line 6) * simple backup method: Backup options. (line 44) -* SIMPLE_BACKUP_SUFFIX: Backup options. (line 50) +* SIMPLE_BACKUP_SUFFIX: Backup options. (line 49) * single-column output of files: General output formatting. (line 10) -* size: Special. (line 30) -* size for main memory sorting: sort invocation. (line 237) -* size of file to shred: shred invocation. (line 117) +* size: Special. (line 39) +* size for main memory sorting: sort invocation. (line 307) +* size of file to shred: shred invocation. (line 116) * size of files, reporting: What information is listed. - (line 242) + (line 232) * size of files, sorting files by: Sorting the output. (line 32) -* skip: dd invocation. (line 43) +* skip: dd invocation. (line 46) +* skip_bytes: dd invocation. (line 302) * sleep: sleep invocation. (line 6) * socket check: File type tests. (line 31) -* software flow control: Input. (line 43) +* software flow control: Input. (line 45) * sort: sort invocation. (line 6) -* sort field: sort invocation. (line 193) -* sort stability: sort invocation. (line 38) -* sort zero-terminated lines <1>: shuf invocation. (line 48) -* sort zero-terminated lines: sort invocation. (line 296) -* sort's last-resort comparison: sort invocation. (line 38) +* sort field: sort invocation. (line 231) +* sort stability: sort invocation. (line 12) +* sort stability <1>: sort invocation. (line 300) +* sort’s last-resort comparison: sort invocation. (line 12) +* sort’s last-resort comparison <1>: sort invocation. (line 300) * sorted files, operations on: Operating on sorted files. (line 6) * sorting files: sort invocation. (line 6) -* sorting ls output: Sorting the output. (line 6) -* space: Character sets. (line 118) -* sparse files, copying: cp invocation. (line 216) +* sorting ‘ls’ output: Sorting the output. (line 6) +* space: Character sets. (line 106) +* space parity: Control. (line 16) +* sparse: dd invocation. (line 132) +* sparse files, copying: cp invocation. (line 294) +* sparse files, creating: truncate invocation. (line 13) * special characters: Characters. (line 6) * special file types: Special file types. (line 6) +* special file types <1>: Special file types. (line 9) * special files: mknod invocation. (line 11) * special settings: Special. (line 6) * specifying sets of characters: Character sets. (line 6) -* speed: Special. (line 40) +* speed: Special. (line 49) * split: split invocation. (line 6) * splitting a file into pieces: split invocation. (line 6) * splitting a file into pieces by context: csplit invocation. (line 6) -* squeezing blank lines: cat invocation. (line 35) -* squeezing repeat characters: Squeezing. (line 6) -* Stallman, R.: Introduction. (line 19) -* standard input: Common options. (line 41) -* standard output: Common options. (line 41) -* start: Characters. (line 44) +* squeezing blank lines: cat invocation. (line 36) +* squeezing empty lines: cat invocation. (line 36) +* squeezing repeat characters: Squeezing and deleting. + (line 6) +* Stallman, R.: Introduction. (line 29) +* standard input: Common options. (line 47) +* standard output: Common options. (line 47) +* standard streams, buffering: stdbuf invocation. (line 6) +* start: Characters. (line 48) * stat: stat invocation. (line 6) +* status: dd invocation. (line 66) +* status <1>: Characters. (line 45) * status time, printing or sorting by: Sorting the output. (line 13) -* status time, show the most recent: du invocation. (line 144) -* sticky: Mode Structure. (line 56) +* status time, show the most recent: du invocation. (line 203) +* stdbuf: stdbuf invocation. (line 6) +* stick parity: Control. (line 16) +* sticky: Mode Structure. (line 49) * sticky bit check: Access permission tests. (line 12) -* stop: Characters. (line 47) -* stop bits: Control. (line 27) -* strftime and date: date invocation. (line 20) -* string constants, outputting: od invocation. (line 68) +* stop: Characters. (line 51) +* stop bits: Control. (line 32) +* strftime and ‘date’: date invocation. (line 20) +* string constants, outputting: od invocation. (line 80) * string expressions: String expressions. (line 6) * string tests: String tests. (line 6) * strip directory and suffix from file names: basename invocation. (line 6) * stripping non-directory suffix: dirname invocation. (line 6) -* stripping symbol table information: install invocation. (line 88) -* stripping trailing slashes <1>: mv invocation. (line 89) -* stripping trailing slashes: cp invocation. (line 250) +* stripping symbol table information: install invocation. (line 113) +* stripping trailing slashes: cp invocation. (line 327) +* stripping trailing slashes <1>: mv invocation. (line 96) * stty: stty invocation. (line 6) -* su: su invocation. (line 6) -* substitute user and group IDs: su invocation. (line 6) * substr: String expressions. (line 40) -* subtracting permissions: Setting Permissions. (line 42) -* subtraction: Numeric expressions. (line 11) +* subtracting permissions: Setting Permissions. (line 38) +* subtraction: Numeric expressions. (line 12) * successful exit: true invocation. (line 6) * suffix, stripping from file names: basename invocation. (line 6) * sum: sum invocation. (line 6) * summarizing files: Summarizing files. (line 6) -* super-user, becoming: su invocation. (line 6) -* superblock, writing: sync invocation. (line 6) +* superblock, writing: sync invocation. (line 11) * supplementary groups, printing: groups invocation. (line 6) -* susp: Characters. (line 50) -* swab (byte-swapping): dd invocation. (line 95) -* swap space, saving text image in: Mode Structure. (line 56) -* swtch: Characters. (line 41) -* symbol table information, stripping: install invocation. (line 88) +* susp: Characters. (line 54) +* swab (byte-swapping): dd invocation. (line 144) +* swap space, saving text image in: Mode Structure. (line 49) +* swtch: Characters. (line 42) +* symbol table information, stripping: install invocation. (line 113) +* symbol table information, stripping, program: install invocation. + (line 116) * symbolic (soft) links, creating: ln invocation. (line 6) * symbolic link check: File type tests. (line 23) * symbolic link to directory, controlling traversal of: Traversing symlinks. (line 6) -* symbolic link to directory, never traverse <1>: chgrp invocation. - (line 79) -* symbolic link to directory, never traverse <2>: chown invocation. - (line 152) * symbolic link to directory, never traverse: Traversing symlinks. (line 26) -* symbolic link to directory, traverse each that is encountered <1>: chgrp invocation. - (line 75) -* symbolic link to directory, traverse each that is encountered <2>: chown invocation. - (line 148) +* symbolic link to directory, never traverse <1>: chown invocation. + (line 155) +* symbolic link to directory, never traverse <2>: chgrp invocation. + (line 83) +* symbolic link to directory, never traverse <3>: chcon invocation. + (line 56) * symbolic link to directory, traverse each that is encountered: Traversing symlinks. (line 22) -* symbolic link to directory, traverse each that is specified on the command line <1>: chgrp invocation. - (line 70) -* symbolic link to directory, traverse each that is specified on the command line <2>: chown invocation. - (line 143) -* symbolic link to directory, traverse each that is specified on the command line: Traversing symlinks. +* symbolic link to directory, traverse each that is encountered <1>: chown invocation. + (line 151) +* symbolic link to directory, traverse each that is encountered <2>: chgrp invocation. + (line 79) +* symbolic link to directory, traverse each that is encountered <3>: chcon invocation. + (line 52) +* symbolic link to directory, traverse if on the command line: Traversing symlinks. (line 18) +* symbolic link to directory, traverse if on the command line <1>: chown invocation. + (line 146) +* symbolic link to directory, traverse if on the command line <2>: chgrp invocation. + (line 74) +* symbolic link to directory, traverse if on the command line <3>: chcon invocation. + (line 47) * symbolic link, defined: ln invocation. (line 40) -* symbolic links and pwd: pwd invocation. (line 6) -* symbolic links, changing group: chgrp invocation. (line 35) -* symbolic links, changing owner <1>: chgrp invocation. (line 30) -* symbolic links, changing owner: chown invocation. (line 80) -* symbolic links, copying: cp invocation. (line 89) -* symbolic links, copying with: cp invocation. (line 255) +* symbolic links and ‘ln’: ln invocation. (line 180) +* symbolic links and ‘pwd’: pwd invocation. (line 26) +* symbolic links, changing group: chgrp invocation. (line 39) +* symbolic links, changing owner: chown invocation. (line 83) +* symbolic links, changing owner <1>: chown invocation. (line 106) +* symbolic links, changing owner <2>: chown invocation. (line 111) +* symbolic links, changing owner <3>: chgrp invocation. (line 34) +* symbolic links, changing time: touch invocation. (line 100) +* symbolic links, copying: cp invocation. (line 109) +* symbolic links, copying <1>: cp invocation. (line 161) +* symbolic links, copying with: cp invocation. (line 332) * symbolic links, dereferencing: Which files are listed. (line 36) -* symbolic links, dereferencing in du: du invocation. (line 96) -* symbolic links, dereferencing in stat: stat invocation. (line 17) -* symbolic links, following: dd invocation. (line 182) +* symbolic links, dereferencing <1>: Which files are listed. + (line 41) +* symbolic links, dereferencing <2>: Which files are listed. + (line 83) +* symbolic links, dereferencing in ‘du’: du invocation. (line 117) +* symbolic links, dereferencing in ‘du’ <1>: du invocation. (line 133) +* symbolic links, dereferencing in ‘stat’: stat invocation. (line 22) +* symbolic links, following: dd invocation. (line 272) * symbolic links, permissions of: chmod invocation. (line 10) * symbolic modes: Symbolic Modes. (line 6) -* sync <1>: sync invocation. (line 6) -* sync: dd invocation. (line 165) -* sync (padding with nulls): dd invocation. (line 116) +* symlinks, resolution: realpath invocation. (line 6) +* sync: sync invocation. (line 6) +* sync <1>: dd invocation. (line 228) +* sync (padding with ASCII NULs): dd invocation. (line 149) +* Synchronize cached writes to persistent storage: sync invocation. + (line 6) * synchronize disk and memory: sync invocation. (line 6) -* synchronized data and metadata I/O: dd invocation. (line 165) +* synchronized data and metadata I/O: dd invocation. (line 228) * synchronized data and metadata writes, before finishing: dd invocation. - (line 125) -* synchronized data reads: dd invocation. (line 157) -* synchronized data writes, before finishing: dd invocation. (line 121) -* syslog: su invocation. (line 29) + (line 177) +* synchronized data reads: dd invocation. (line 220) +* synchronized data writes, before finishing: dd invocation. (line 173) * system context: System context. (line 6) -* system information, printing: uname invocation. (line 6) +* system information, printing: arch invocation. (line 6) +* system information, printing <1>: nproc invocation. (line 6) +* system information, printing <2>: uname invocation. (line 6) * system name, printing: hostname invocation. (line 6) -* System V sum: sum invocation. (line 31) +* System V ‘sum’: sum invocation. (line 31) * tab stops, setting: expand invocation. (line 22) * tabN: Output. (line 51) * tabs: Combination. (line 66) @@ -15481,58 +18728,68 @@ Index * tac: tac invocation. (line 6) * tagged paragraphs: fmt invocation. (line 40) * tail: tail invocation. (line 6) -* tandem: Input. (line 43) -* target directory <1>: ln invocation. (line 105) -* target directory <2>: mv invocation. (line 99) -* target directory <3>: install invocation. (line 97) -* target directory <4>: cp invocation. (line 268) +* tandem: Input. (line 45) * target directory: Target directory. (line 6) -* tebibyte, definition of: Block size. (line 106) +* target directory <1>: Target directory. (line 15) +* target directory <2>: Target directory. (line 31) +* target directory <3>: cp invocation. (line 345) +* target directory <4>: cp invocation. (line 349) +* target directory <5>: install invocation. (line 125) +* target directory <6>: install invocation. (line 130) +* target directory <7>: mv invocation. (line 106) +* target directory <8>: mv invocation. (line 110) +* target directory <9>: ln invocation. (line 169) +* target directory <10>: ln invocation. (line 173) +* tebibyte, definition of: Block size. (line 99) * tee: tee invocation. (line 6) -* telephone directory order: sort invocation. (line 85) -* temporary directory: sort invocation. (line 273) -* terabyte, definition of: Block size. (line 102) -* TERM: su invocation. (line 53) +* telephone directory order: sort invocation. (line 87) +* temporary directory: sort invocation. (line 344) +* temporary files and directories: mktemp invocation. (line 6) +* terabyte, definition of: Block size. (line 96) * terminal check: File type tests. (line 34) * terminal file name, printing: tty invocation. (line 6) * terminal lines, currently used: who invocation. (line 11) * terminal settings: stty invocation. (line 6) * terminal, using color iff: General output formatting. (line 25) -* terse output: stat invocation. (line 48) +* terse output: stat invocation. (line 54) * test: test invocation. (line 6) -* text: dd invocation. (line 192) -* text I/O: dd invocation. (line 192) -* text image, saving in swap space: Mode Structure. (line 56) -* text input files: md5sum invocation. (line 79) -* text utilities: Top. (line 19) +* text: dd invocation. (line 282) +* text I/O: dd invocation. (line 282) +* text image, saving in swap space: Mode Structure. (line 49) +* text input files: md5sum invocation. (line 107) +* text utilities: Top. (line 18) * text, displaying: echo invocation. (line 6) * text, reformatting: fmt invocation. (line 6) * this in date strings: Relative items in date strings. (line 33) +* time: touch invocation. (line 86) * time <1>: Special. (line 11) -* time: touch invocation. (line 58) * time conversion specifiers: Time conversion specifiers. (line 6) +* time formats: pr invocation. (line 78) * time formats <1>: date invocation. (line 20) -* time formats: pr invocation. (line 100) +* time limit: timeout invocation. (line 6) * time of day item: Time of day items. (line 6) * time setting: Setting the time. (line 6) -* time style <1>: du invocation. (line 153) * time style: Formatting file timestamps. - (line 26) -* time units: sleep invocation. (line 11) -* time zone correction: Time of day items. (line 30) + (line 24) +* time style <1>: du invocation. (line 212) +* time units: timeout invocation. (line 52) +* time units <1>: sleep invocation. (line 11) +* time zone correction: Time of day items. (line 29) +* time zone item: General date syntax. (line 40) * time zone item <1>: Time zone items. (line 6) -* time zone item: General date syntax. (line 44) * time, printing or setting: date invocation. (line 6) -* TIME_STYLE <1>: du invocation. (line 181) -* TIME_STYLE: Formatting file timestamps. - (line 106) +* timeout: timeout invocation. (line 6) * timestamps of installed files, preserving: install invocation. - (line 78) + (line 103) * timestamps, changing file: touch invocation. (line 6) +* TIME_STYLE: Formatting file timestamps. + (line 103) +* TIME_STYLE <1>: du invocation. (line 240) * TMPDIR: sort invocation. (line 64) +* TMPDIR <1>: sort invocation. (line 344) * today in date strings: Relative items in date strings. (line 33) * tomorrow: Options for date. (line 11) @@ -15546,45 +18803,46 @@ Index * trailing slashes: Trailing slashes. (line 6) * translating characters: Translating. (line 6) * true: true invocation. (line 6) -* truncating output file, avoiding: dd invocation. (line 113) +* truncate: truncate invocation. (line 6) +* truncating output file, avoiding: dd invocation. (line 167) +* truncating, file sizes: truncate invocation. (line 6) * tsort: tsort invocation. (line 6) * tty: tty invocation. (line 6) -* Twenex: su invocation. (line 92) * two-way parity: Control. (line 9) -* type size: od invocation. (line 113) -* TZ <1>: Specifying time zone rules. - (line 6) -* TZ <2>: Options for date. (line 83) -* TZ <3>: date invocation. (line 16) +* type size: od invocation. (line 121) +* TZ: pr invocation. (line 91) +* TZ <1>: Formatting file timestamps. + (line 17) +* TZ <2>: touch invocation. (line 65) +* TZ <3>: stat invocation. (line 160) * TZ <4>: who invocation. (line 26) -* TZ <5>: stat invocation. (line 131) -* TZ <6>: touch invocation. (line 37) -* TZ <7>: Formatting file timestamps. - (line 18) -* TZ: pr invocation. (line 113) -* u, and disabling special characters: Characters. (line 13) -* ucase, converting to: dd invocation. (line 90) -* ufs file system type: df invocation. (line 125) +* TZ <5>: date invocation. (line 16) +* TZ <6>: Options for date. (line 113) +* TZ <7>: Specifying time zone rules. + (line 6) +* u, and disabling special characters: Characters. (line 12) +* ucase, converting to: dd invocation. (line 127) * umask and modes: Umask and Protection. (line 6) * uname: uname invocation. (line 6) -* unblock: dd invocation. (line 81) +* unblock: dd invocation. (line 118) * unexpand: unexpand invocation. (line 6) -* Unicode: printf invocation. (line 62) +* Unicode: printf invocation. (line 74) * uniq: uniq invocation. (line 6) -* unique lines, outputting: uniq invocation. (line 98) +* unique lines, outputting: uniq invocation. (line 127) * uniquify files: uniq invocation. (line 6) -* uniquifying output: sort invocation. (line 282) +* uniquifying output: sort invocation. (line 360) * unlink: unlink invocation. (line 6) -* unprintable characters, ignoring: sort invocation. (line 125) +* unprintable characters, ignoring: sort invocation. (line 143) * unsorted directory listing: Sorting the output. (line 20) -* upper: Character sets. (line 121) -* uppercase, translating to lowercase: Input. (line 48) -* use time, changing: touch invocation. (line 50) +* upper: Character sets. (line 108) +* uppercase, translating to lowercase: Input. (line 50) +* uptime: uptime invocation. (line 6) +* use time, changing: touch invocation. (line 78) * use time, printing or sorting files by: Sorting the output. (line 13) -* use time, show the most recent: du invocation. (line 144) -* USER: su invocation. (line 18) -* user ID, switching: su invocation. (line 6) +* use time, printing or sorting files by <1>: Sorting the output. + (line 42) +* use time, show the most recent: du invocation. (line 203) * user IDs, disambiguating: Disambiguating names and IDs. (line 6) * user information, commands for: User information. (line 6) @@ -15593,271 +18851,298 @@ Index (line 6) * usernames, printing current: users invocation. (line 6) * users: users invocation. (line 6) -* UTC: Options for date. (line 83) -* utmp <1>: who invocation. (line 15) -* utmp <2>: users invocation. (line 14) +* UTC: Options for date. (line 113) * utmp: logname invocation. (line 6) +* utmp <1>: users invocation. (line 14) +* utmp <2>: who invocation. (line 15) * valid file names, checking for: pathchk invocation. (line 6) * variable-length records, converting to fixed-length: dd invocation. - (line 38) + (line 41) * vdir: vdir invocation. (line 6) * verbose ls format: What information is listed. - (line 130) -* verifying MD5 checksums: md5sum invocation. (line 69) -* version number, finding: Common options. (line 33) -* version of kernel: uname invocation. (line 76) -* version, sorting option for ls: Sorting the output. (line 56) + (line 131) +* verifying MD5 checksums: md5sum invocation. (line 74) +* verifying MD5 checksums <1>: md5sum invocation. (line 80) +* verifying MD5 checksums <2>: md5sum invocation. (line 88) +* verifying MD5 checksums <3>: md5sum invocation. (line 116) +* verifying MD5 checksums <4>: md5sum invocation. (line 121) +* version number sort: sort invocation. (line 177) +* version number, finding: Common options. (line 40) +* version of kernel: uname invocation. (line 77) +* version, sorting option for ‘ls’: Sorting the output. (line 56) * version-control Emacs variable: Backup options. (line 24) -* VERSION_CONTROL <1>: ln invocation. (line 55) -* VERSION_CONTROL <2>: mv invocation. (line 50) -* VERSION_CONTROL <3>: install invocation. (line 40) -* VERSION_CONTROL <4>: cp invocation. (line 61) * VERSION_CONTROL: Backup options. (line 13) +* VERSION_CONTROL <1>: cp invocation. (line 79) +* VERSION_CONTROL <2>: install invocation. (line 41) +* VERSION_CONTROL <3>: mv invocation. (line 59) +* VERSION_CONTROL <4>: ln invocation. (line 80) * vertical sorted files in columns: General output formatting. - (line 15) + (line 16) * vtN: Output. (line 59) * wc: wc invocation. (line 6) * week in date strings: Relative items in date strings. (line 15) -* werase: Characters. (line 59) -* wheel group, not supported: su invocation. (line 87) +* werase: Characters. (line 63) * who: who invocation. (line 6) * who am i: who invocation. (line 21) * whoami: whoami invocation. (line 6) * word count: wc invocation. (line 6) * working context: Working context. (line 6) * working directory, printing: pwd invocation. (line 6) -* wrap data: base64 invocation. (line 21) +* wrap data: base64 invocation. (line 23) * wrapping long input lines: fold invocation. (line 6) * writable file check: Access permission tests. (line 21) -* write permission: Mode Structure. (line 15) -* write permission, symbolic: Setting Permissions. (line 60) -* write, allowed: who invocation. (line 86) -* wtmp <1>: who invocation. (line 15) +* write permission: Mode Structure. (line 14) +* write permission, symbolic: Setting Permissions. (line 54) +* write, allowed: who invocation. (line 94) * wtmp: users invocation. (line 14) +* wtmp <1>: who invocation. (line 15) * xcase: Local. (line 36) -* xdigit: Character sets. (line 124) -* XON/XOFF flow control: Input. (line 38) +* xdigit: Character sets. (line 110) +* xfs file system type: df invocation. (line 211) +* XON/XOFF flow control: Input. (line 40) * year in date strings: Relative items in date strings. (line 15) * yes: yes invocation. (line 6) * yesterday: Options for date. (line 11) * yesterday in date strings: Relative items in date strings. (line 29) -* yottabyte, definition of: Block size. (line 131) -* Youmans, B.: Introduction. (line 19) +* yottabyte, definition of: Block size. (line 116) +* Youmans, B.: Introduction. (line 29) * zero-length string check: String tests. (line 15) -* zettabyte, definition of: Block size. (line 123) -* |: Relations for expr. (line 11) +* zettabyte, definition of: Block size. (line 111) Tag Table: -Node: Top7718 -Node: Introduction20818 -Node: Common options22377 -Node: Exit status25162 -Node: Backup options25892 -Node: Block size27816 -Node: Disambiguating names and IDs32732 -Ref: Disambiguating names and IDs-Footnote-134290 -Node: Random sources34360 -Node: Target directory36109 -Node: Trailing slashes39594 -Node: Traversing symlinks40615 -Node: Treating / specially41686 -Node: Special built-in utilities43227 -Node: Standards conformance44362 -Node: Output of entire files45878 -Node: cat invocation46479 -Node: tac invocation48207 -Node: nl invocation49469 -Node: od invocation53348 -Node: base64 invocation59711 -Node: Formatting file contents61073 -Node: fmt invocation61524 -Node: pr invocation64337 -Node: fold invocation77122 -Node: Output of parts of files78582 -Node: head invocation79090 -Node: tail invocation80806 -Node: split invocation88629 -Node: csplit invocation90715 -Node: Summarizing files94827 -Node: wc invocation95475 -Node: sum invocation98360 -Node: cksum invocation99765 -Node: md5sum invocation100905 -Node: sha1sum invocation105599 -Node: sha2 utilities106379 -Node: Operating on sorted files107003 -Node: sort invocation107659 -Ref: sort invocation-Footnote-1127034 -Node: shuf invocation127586 -Node: uniq invocation130150 -Node: comm invocation134230 -Node: tsort invocation135558 -Node: tsort background138592 -Node: ptx invocation140355 -Node: General options in ptx143159 -Node: Charset selection in ptx143740 -Node: Input processing in ptx144642 -Node: Output formatting in ptx150063 -Node: Compatibility in ptx156629 -Node: Operating on fields within a line159858 -Node: cut invocation160262 -Node: paste invocation163581 -Node: join invocation164909 -Node: Operating on characters169133 -Node: tr invocation169569 -Node: Character sets171287 -Node: Translating175718 -Node: Squeezing177809 -Node: expand invocation180876 -Node: unexpand invocation182358 -Node: Directory listing184176 -Node: ls invocation184662 -Ref: ls invocation-Footnote-1186476 -Node: Which files are listed186698 -Node: What information is listed190358 -Node: Sorting the output199334 -Node: More details about version sort201654 -Node: General output formatting203152 -Node: Formatting file timestamps207060 -Node: Formatting the file names212401 -Node: dir invocation215317 -Node: vdir invocation215728 -Node: dircolors invocation216106 -Node: Basic operations217586 -Node: cp invocation218206 -Node: dd invocation230266 -Node: install invocation238684 -Node: mv invocation242911 -Node: rm invocation247201 -Node: shred invocation251515 -Node: Special file types259000 -Node: link invocation260496 -Node: ln invocation261502 -Node: mkdir invocation266564 -Node: mkfifo invocation268813 -Node: mknod invocation269818 -Node: readlink invocation271577 -Node: rmdir invocation273320 -Node: unlink invocation274593 -Node: Changing file attributes275552 -Node: chown invocation276366 -Node: chgrp invocation282552 -Node: chmod invocation285602 -Node: touch invocation288357 -Node: Disk usage292953 -Node: df invocation293545 -Node: du invocation299217 -Node: stat invocation307207 -Node: sync invocation311049 -Node: Printing text311976 -Node: echo invocation312350 -Node: printf invocation314527 -Node: yes invocation319234 -Node: Conditions319846 -Node: false invocation320437 -Node: true invocation321472 -Node: test invocation322751 -Node: File type tests324711 -Node: Access permission tests325593 -Node: File characteristic tests326478 -Node: String tests327243 -Node: Numeric tests327908 -Node: Connectives for test328705 -Node: expr invocation329058 -Node: String expressions331319 -Node: Numeric expressions333902 -Node: Relations for expr334540 -Node: Examples of expr335740 -Node: Redirection336468 -Node: tee invocation336913 -Node: File name manipulation337978 -Node: basename invocation338426 -Node: dirname invocation339873 -Node: pathchk invocation341079 -Node: Working context342743 -Node: pwd invocation343387 -Node: stty invocation344061 -Node: Control346821 -Node: Input347581 -Node: Output349057 -Node: Local350313 -Node: Combination351895 -Node: Characters354057 -Node: Special355611 -Node: printenv invocation356977 -Node: tty invocation357740 -Node: User information358446 -Node: id invocation359081 -Node: logname invocation360297 -Node: whoami invocation360924 -Node: groups invocation361411 -Node: users invocation362147 -Node: who invocation363094 -Node: System context365863 -Node: date invocation366353 -Node: Time conversion specifiers368011 -Node: Date conversion specifiers370411 -Node: Literal conversion specifiers373535 -Node: Padding and other flags373893 -Node: Setting the time376087 -Node: Options for date377093 -Node: Examples of date380398 -Ref: %s-examples381841 -Node: uname invocation384026 -Node: hostname invocation386599 -Node: hostid invocation387212 -Node: Modified command invocation387899 -Node: chroot invocation388525 -Node: env invocation390644 -Node: nice invocation392723 -Node: nohup invocation396219 -Node: su invocation398210 -Node: Process control402683 -Node: kill invocation402906 -Node: Delaying407272 -Node: sleep invocation407469 -Node: Numeric operations408333 -Node: factor invocation408665 -Node: seq invocation410003 -Node: File permissions414284 -Node: Mode Structure414902 -Node: Symbolic Modes418597 -Node: Setting Permissions419695 -Node: Copying Permissions422308 -Node: Changing Special Mode Bits423127 -Node: Conditional Executability424949 -Node: Multiple Changes425493 -Node: Umask and Protection427160 -Node: Numeric Modes428265 -Node: Directory Setuid and Setgid430165 -Node: Date input formats432427 -Node: General date syntax434780 -Node: Calendar date items437739 -Node: Time of day items439744 -Node: Time zone items441868 -Node: Day of week items443110 -Node: Relative items in date strings444107 -Node: Pure numbers in date strings446917 -Node: Seconds since the Epoch447906 -Node: Specifying time zone rules449535 -Node: Authors of get_date451907 -Node: Opening the software toolbox452667 -Node: Toolbox introduction453328 -Node: I/O redirection456051 -Node: The who command458885 -Node: The cut command459782 -Node: The sort command460845 -Node: The uniq command461549 -Node: Putting the tools together462239 -Ref: Putting the tools together-Footnote-1474196 -Node: Copying This Manual474270 -Node: GNU Free Documentation License474525 -Node: Index496926 +Node: Top8465 +Node: Introduction22618 +Node: Common options24485 +Node: Exit status27922 +Node: Backup options28742 +Node: Block size30788 +Node: Floating point36124 +Node: Signal specifications37734 +Node: Disambiguating names and IDs39904 +Ref: Disambiguating names and IDs-Footnote-141521 +Node: Random sources41591 +Node: Target directory43600 +Node: Trailing slashes47250 +Node: Traversing symlinks48289 +Node: Treating / specially49421 +Node: Special built-in utilities51055 +Node: Standards conformance52254 +Node: Multi-call invocation53895 +Node: Output of entire files54457 +Node: cat invocation55126 +Node: tac invocation57068 +Node: nl invocation58501 +Node: od invocation62563 +Node: base32 invocation70296 +Node: base64 invocation70823 +Node: Formatting file contents72304 +Node: fmt invocation72755 +Node: pr invocation75749 +Node: fold invocation88026 +Node: Output of parts of files89541 +Node: head invocation90038 +Node: tail invocation92877 +Node: split invocation103732 +Node: csplit invocation111751 +Node: Summarizing files116989 +Node: wc invocation117637 +Node: sum invocation120964 +Node: cksum invocation122430 +Node: md5sum invocation123610 +Node: sha1sum invocation129953 +Node: sha2 utilities130745 +Node: Operating on sorted files131276 +Node: sort invocation131863 +Ref: sort invocation-Footnote-1157131 +Node: shuf invocation157741 +Node: uniq invocation160942 +Node: comm invocation166969 +Node: ptx invocation169922 +Node: General options in ptx172756 +Node: Charset selection in ptx173356 +Node: Input processing in ptx174269 +Node: Output formatting in ptx179814 +Node: Compatibility in ptx186650 +Node: tsort invocation190033 +Node: tsort background193237 +Node: Operating on fields194945 +Node: cut invocation195307 +Node: paste invocation199856 +Node: join invocation202019 +Node: Operating on characters209155 +Node: tr invocation209578 +Node: Character sets211334 +Node: Translating216082 +Node: Squeezing and deleting218253 +Node: expand invocation221523 +Node: unexpand invocation223047 +Node: Directory listing224924 +Node: ls invocation225422 +Ref: ls invocation-Footnote-1227557 +Node: Which files are listed227801 +Node: What information is listed231811 +Node: Sorting the output241437 +Node: Details about version sort243904 +Node: General output formatting245713 +Node: Formatting file timestamps251266 +Node: Formatting the file names256842 +Node: dir invocation260201 +Node: vdir invocation260628 +Node: dircolors invocation261053 +Node: Basic operations262859 +Node: cp invocation263479 +Node: dd invocation281457 +Node: install invocation298171 +Node: mv invocation304509 +Node: rm invocation309633 +Node: shred invocation314307 +Node: Special file types323374 +Node: link invocation324903 +Node: ln invocation326160 +Node: mkdir invocation335046 +Node: mkfifo invocation337820 +Node: mknod invocation339295 +Node: readlink invocation341837 +Node: rmdir invocation344258 +Node: unlink invocation345575 +Node: Changing file attributes346569 +Node: chown invocation347389 +Node: chgrp invocation353967 +Node: chmod invocation357393 +Node: touch invocation360273 +Node: Disk usage367955 +Node: df invocation368636 +Node: du invocation378473 +Node: stat invocation389604 +Node: sync invocation396503 +Node: truncate invocation398674 +Node: Printing text400612 +Node: echo invocation400986 +Node: printf invocation403710 +Node: yes invocation409770 +Node: Conditions410422 +Node: false invocation411017 +Node: true invocation412106 +Node: test invocation413439 +Node: File type tests415576 +Node: Access permission tests416495 +Node: File characteristic tests417415 +Node: String tests418199 +Node: Numeric tests418969 +Node: Connectives for test419804 +Node: expr invocation421058 +Node: String expressions423570 +Node: Numeric expressions426275 +Node: Relations for expr426983 +Node: Examples of expr428212 +Node: Redirection428961 +Node: tee invocation429426 +Node: File name manipulation436006 +Node: basename invocation436581 +Node: dirname invocation438800 +Node: pathchk invocation440617 +Node: mktemp invocation442428 +Node: realpath invocation448246 +Node: Working context451374 +Node: pwd invocation452018 +Node: stty invocation453437 +Node: Control456422 +Node: Input457498 +Node: Output459252 +Node: Local460670 +Node: Combination462765 +Node: Characters465177 +Node: Special467004 +Node: printenv invocation469253 +Node: tty invocation470264 +Node: User information470993 +Node: id invocation471628 +Node: logname invocation474131 +Node: whoami invocation474788 +Node: groups invocation475295 +Node: users invocation476530 +Node: who invocation477710 +Node: System context481046 +Node: date invocation481711 +Node: Time conversion specifiers483485 +Node: Date conversion specifiers486139 +Node: Literal conversion specifiers489443 +Node: Padding and other flags489815 +Node: Setting the time492083 +Node: Options for date493246 +Node: Examples of date497900 +Ref: %s-examples499391 +Node: arch invocation502612 +Node: nproc invocation503171 +Node: uname invocation504300 +Node: hostname invocation507013 +Node: hostid invocation507843 +Node: uptime invocation508716 +Node: SELinux context510196 +Node: chcon invocation510571 +Node: runcon invocation512976 +Node: Modified command invocation514513 +Node: chroot invocation515205 +Ref: chroot invocation-Footnote-1519099 +Node: env invocation519616 +Node: nice invocation524038 +Node: nohup invocation528171 +Node: stdbuf invocation530673 +Node: timeout invocation533518 +Node: Process control536318 +Node: kill invocation536541 +Node: Delaying539735 +Node: sleep invocation539932 +Node: Numeric operations541087 +Node: factor invocation541472 +Node: numfmt invocation543276 +Node: seq invocation555029 +Node: File permissions559115 +Node: Mode Structure559811 +Node: Symbolic Modes563567 +Node: Setting Permissions564685 +Node: Copying Permissions567351 +Node: Changing Special Mode Bits568221 +Node: Conditional Executability570103 +Node: Multiple Changes570655 +Node: Umask and Protection572328 +Node: Numeric Modes573473 +Node: Operator Numeric Modes575642 +Node: Directory Setuid and Setgid576702 +Node: Date input formats579557 +Node: General date syntax581999 +Node: Calendar date items585130 +Node: Time of day items587207 +Node: Time zone items589511 +Node: Combined date and time of day items590816 +Node: Day of week items591687 +Node: Relative items in date strings592771 +Node: Pure numbers in date strings595681 +Node: Seconds since the Epoch596670 +Node: Specifying time zone rules598335 +Node: Authors of parse_datetime600803 +Ref: Authors of get_date600994 +Node: Opening the software toolbox601993 +Node: Toolbox introduction602787 +Node: I/O redirection605531 +Node: The who command608416 +Node: The cut command609341 +Node: The sort command610443 +Node: The uniq command611161 +Node: Putting the tools together611876 +Ref: Putting the tools together-Footnote-1624082 +Node: GNU Free Documentation License624156 +Node: Concept index649533 End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 588147f..01791be 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -1,7 +1,9 @@ \input texinfo @c %**start of header @setfilename coreutils.info -@settitle @sc{gnu} Coreutils +@settitle GNU Coreutils +@documentencoding UTF-8 +@allowcodebreaks false @c %**end of header @@ -23,7 +25,7 @@ @dircategory Basics @direntry * Coreutils: (coreutils). Core GNU (file, text, shell) utilities. -* Common options: (coreutils)Common options. Common options. +* Common options: (coreutils)Common options. * File permissions: (coreutils)File permissions. Access modes. * Date input formats: (coreutils)Date input formats. @end direntry @@ -31,16 +33,18 @@ @c FIXME: the following need documentation @c * [: (coreutils)[ invocation. File/string tests. @c * pinky: (coreutils)pinky invocation. FIXME. -@c * uptime: (coreutils)uptime invocation. FIXME. @dircategory Individual utilities @direntry +* arch: (coreutils)arch invocation. Print machine hardware name. +* base32: (coreutils)base32 invocation. Base32 encode/decode data. * base64: (coreutils)base64 invocation. Base64 encode/decode data. * basename: (coreutils)basename invocation. Strip directory and suffix. * cat: (coreutils)cat invocation. Concatenate and write files. +* chcon: (coreutils)chcon invocation. Change SELinux CTX of files. * chgrp: (coreutils)chgrp invocation. Change file groups. -* chmod: (coreutils)chmod invocation. Change file permissions. -* chown: (coreutils)chown invocation. Change file owners/groups. +* chmod: (coreutils)chmod invocation. Change access permissions. +* chown: (coreutils)chown invocation. Change file owners and groups. * chroot: (coreutils)chroot invocation. Specify the root directory. * cksum: (coreutils)cksum invocation. Print POSIX CRC checksum. * comm: (coreutils)comm invocation. Compare sorted files by line. @@ -52,7 +56,7 @@ * df: (coreutils)df invocation. Report file system disk usage. * dir: (coreutils)dir invocation. List directories briefly. * dircolors: (coreutils)dircolors invocation. Color setup for ls. -* dirname: (coreutils)dirname invocation. Strip non-directory suffix. +* dirname: (coreutils)dirname invocation. Strip last file name component. * du: (coreutils)du invocation. Report on disk usage. * echo: (coreutils)echo invocation. Print a line of text. * env: (coreutils)env invocation. Modify the environment. @@ -67,7 +71,7 @@ * hostid: (coreutils)hostid invocation. Print numeric host identifier. * hostname: (coreutils)hostname invocation. Print or set system name. * id: (coreutils)id invocation. Print user identity. -* install: (coreutils)install invocation. Copy and change attributes. +* install: (coreutils)install invocation. Copy files and set attributes. * join: (coreutils)join invocation. Join lines on a common field. * kill: (coreutils)kill invocation. Send a signal to processes. * link: (coreutils)link invocation. Make hard links between files. @@ -78,10 +82,13 @@ * mkdir: (coreutils)mkdir invocation. Create directories. * mkfifo: (coreutils)mkfifo invocation. Create FIFOs (named pipes). * mknod: (coreutils)mknod invocation. Create special files. +* mktemp: (coreutils)mktemp invocation. Create temporary files. * mv: (coreutils)mv invocation. Rename files. * nice: (coreutils)nice invocation. Modify niceness. * nl: (coreutils)nl invocation. Number lines and write files. * nohup: (coreutils)nohup invocation. Immunize to hangups. +* nproc: (coreutils)nproc invocation. Print the number of processors. +* numfmt: (coreutils)numfmt invocation. Reformat numbers. * od: (coreutils)od invocation. Dump files in octal, etc. * paste: (coreutils)paste invocation. Merge lines of files. * pathchk: (coreutils)pathchk invocation. Check file name portability. @@ -91,8 +98,10 @@ * ptx: (coreutils)ptx invocation. Produce permuted indexes. * pwd: (coreutils)pwd invocation. Print working directory. * readlink: (coreutils)readlink invocation. Print referent of a symlink. +* realpath: (coreutils)realpath invocation. Print resolved file names. * rm: (coreutils)rm invocation. Remove files. * rmdir: (coreutils)rmdir invocation. Remove empty directories. +* runcon: (coreutils)runcon invocation. Run in specified SELinux CTX. * seq: (coreutils)seq invocation. Print numeric sequences * sha1sum: (coreutils)sha1sum invocation. Print or check SHA-1 digests. * sha2: (coreutils)sha2 utilities. Print or check SHA-2 digests. @@ -100,25 +109,28 @@ * shuf: (coreutils)shuf invocation. Shuffling text files. * sleep: (coreutils)sleep invocation. Delay for a specified time. * sort: (coreutils)sort invocation. Sort text files. -* split: (coreutils)split invocation. Split into fixed-size pieces. +* split: (coreutils)split invocation. Split into pieces. * stat: (coreutils)stat invocation. Report file(system) status. +* stdbuf: (coreutils)stdbuf invocation. Modify stdio buffering. * stty: (coreutils)stty invocation. Print/change terminal settings. -* su: (coreutils)su invocation. Modify user and group ID. * sum: (coreutils)sum invocation. Print traditional checksum. -* sync: (coreutils)sync invocation. Synchronize memory and disk. +* sync: (coreutils)sync invocation. Synchronize memory to disk. * tac: (coreutils)tac invocation. Reverse files. * tail: (coreutils)tail invocation. Output the last part of files. * tee: (coreutils)tee invocation. Redirect to multiple files. * test: (coreutils)test invocation. File/string tests. +* timeout: (coreutils)timeout invocation. Run with time limit. * touch: (coreutils)touch invocation. Change file timestamps. * tr: (coreutils)tr invocation. Translate characters. * true: (coreutils)true invocation. Do nothing, successfully. +* truncate: (coreutils)truncate invocation. Shrink/extend size of a file. * tsort: (coreutils)tsort invocation. Topological sort. * tty: (coreutils)tty invocation. Print terminal name. * uname: (coreutils)uname invocation. Print system information. * unexpand: (coreutils)unexpand invocation. Convert spaces to tabs. * uniq: (coreutils)uniq invocation. Uniquify files. * unlink: (coreutils)unlink invocation. Removal via unlink(2). +* uptime: (coreutils)uptime invocation. Print uptime and load. * users: (coreutils)users invocation. Print current user names. * vdir: (coreutils)vdir invocation. List directories verbosely. * wc: (coreutils)wc invocation. Line, word, and byte counts. @@ -128,15 +140,14 @@ @end direntry @copying -This manual documents version @value{VERSION} of the @sc{gnu} core +This manual documents version @value{VERSION} of the GNU core utilities, including the standard programs for text and file manipulation. -Copyright @copyright{} 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2004, -2005, 2006 Free Software Foundation, Inc. +Copyright @copyright{} 1994-2016 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.2 or +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 @@ -145,7 +156,7 @@ Free Documentation License''. @end copying @titlepage -@title @sc{gnu} @code{Coreutils} +@title GNU @code{Coreutils} @subtitle Core GNU utilities @subtitle for version @value{VERSION}, @value{UPDATED} @author David MacKenzie et al. @@ -154,7 +165,8 @@ Free Documentation License''. @vskip 0pt plus 1filll @insertcopying @end titlepage - +@shortcontents +@contents @ifnottex @node Top @@ -169,205 +181,213 @@ Free Documentation License''. @cindex file utilities @menu -* Introduction:: Caveats, overview, and authors. -* Common options:: Common options. -* Output of entire files:: cat tac nl od -* Formatting file contents:: fmt pr fold -* Output of parts of files:: head tail split csplit -* Summarizing files:: wc sum cksum md5sum sha1sum sha2 -* Operating on sorted files:: sort shuf uniq comm ptx tsort -* Operating on fields within a line:: cut paste join -* Operating on characters:: tr expand unexpand -* Directory listing:: ls dir vdir dircolors -* Basic operations:: cp dd install mv rm shred -* Special file types:: ln mkdir rmdir mkfifo mknod -* Changing file attributes:: chgrp chmod chown touch -* Disk usage:: df du stat sync -* Printing text:: echo printf yes -* Conditions:: false true test expr -* Redirection:: tee -* File name manipulation:: dirname basename pathchk -* Working context:: pwd stty printenv tty -* User information:: id logname whoami groups users who -* System context:: date uname hostname hostid -* Modified command invocation:: chroot env nice nohup su -* Process control:: kill -* Delaying:: sleep -* Numeric operations:: factor seq -* File permissions:: Access modes. -* Date input formats:: Specifying date strings. -* Opening the software toolbox:: The software tools philosophy. -* Copying This Manual:: License for copying this manual. -* Index:: General index. +* Introduction:: Caveats, overview, and authors +* Common options:: Common options +* Output of entire files:: cat tac nl od base32 base64 +* Formatting file contents:: fmt pr fold +* Output of parts of files:: head tail split csplit +* Summarizing files:: wc sum cksum md5sum sha1sum sha2 +* Operating on sorted files:: sort shuf uniq comm ptx tsort +* Operating on fields:: cut paste join +* Operating on characters:: tr expand unexpand +* Directory listing:: ls dir vdir dircolors +* Basic operations:: cp dd install mv rm shred +* Special file types:: mkdir rmdir unlink mkfifo mknod ln link readlink +* Changing file attributes:: chgrp chmod chown touch +* Disk usage:: df du stat sync truncate +* Printing text:: echo printf yes +* Conditions:: false true test expr +* Redirection:: tee +* File name manipulation:: dirname basename pathchk mktemp realpath +* Working context:: pwd stty printenv tty +* User information:: id logname whoami groups users who +* System context:: date arch nproc uname hostname hostid uptime +* SELinux context:: chcon runcon +* Modified command invocation:: chroot env nice nohup stdbuf timeout +* Process control:: kill +* Delaying:: sleep +* Numeric operations:: factor numfmt seq +* File permissions:: Access modes +* Date input formats:: Specifying date strings +* Opening the software toolbox:: The software tools philosophy +* GNU Free Documentation License:: Copying and sharing this manual +* Concept index:: General index @detailmenu --- The Detailed Node Listing --- Common Options -* Exit status:: Indicating program success or failure. -* Backup options:: Backup options -* Block size:: Block size -* Disambiguating names and IDs:: chgrp and chown owner and group syntax -* Random sources:: Sources of random data -* Target directory:: Target directory -* Trailing slashes:: Trailing slashes -* Traversing symlinks:: Traversing symlinks to directories -* Treating / specially:: Treating / specially -* Standards conformance:: Standards conformance +* Exit status:: Indicating program success or failure +* Backup options:: Backup options +* Block size:: Block size +* Floating point:: Floating point number representation +* Signal specifications:: Specifying signals +* Disambiguating names and IDs:: chgrp, chown, chroot, id: user and group syntax +* Random sources:: Sources of random data +* Target directory:: Target directory +* Trailing slashes:: Trailing slashes +* Traversing symlinks:: Traversing symlinks to directories +* Treating / specially:: Treating / specially +* Standards conformance:: Standards conformance +* Multi-call invocation:: Multi-call program invocation Output of entire files -* cat invocation:: Concatenate and write files. -* tac invocation:: Concatenate and write files in reverse. -* nl invocation:: Number lines and write files. -* od invocation:: Write files in octal or other formats. -* base64 invocation:: Transform data into printable data. +* cat invocation:: Concatenate and write files +* tac invocation:: Concatenate and write files in reverse +* nl invocation:: Number lines and write files +* od invocation:: Write files in octal or other formats +* base32 invocation:: Transform data into printable data +* base64 invocation:: Transform data into printable data Formatting file contents -* fmt invocation:: Reformat paragraph text. -* pr invocation:: Paginate or columnate files for printing. -* fold invocation:: Wrap input lines to fit in specified width. +* fmt invocation:: Reformat paragraph text +* pr invocation:: Paginate or columnate files for printing +* fold invocation:: Wrap input lines to fit in specified width Output of parts of files -* head invocation:: Output the first part of files. -* tail invocation:: Output the last part of files. -* split invocation:: Split a file into fixed-size pieces. -* csplit invocation:: Split a file into context-determined pieces. +* head invocation:: Output the first part of files +* tail invocation:: Output the last part of files +* split invocation:: Split a file into fixed-size pieces +* csplit invocation:: Split a file into context-determined pieces Summarizing files -* wc invocation:: Print newline, word, and byte counts. -* sum invocation:: Print checksum and block counts. -* cksum invocation:: Print CRC checksum and byte counts. -* md5sum invocation:: Print or check MD5 digests. -* sha1sum invocation:: Print or check SHA-1 digests. -* sha2 utilities:: Print or check SHA-2 digests. +* wc invocation:: Print newline, word, and byte counts +* sum invocation:: Print checksum and block counts +* cksum invocation:: Print CRC checksum and byte counts +* md5sum invocation:: Print or check MD5 digests +* sha1sum invocation:: Print or check SHA-1 digests +* sha2 utilities:: Print or check SHA-2 digests Operating on sorted files -* sort invocation:: Sort text files. -* shuf invocation:: Shuffle text files. -* uniq invocation:: Uniquify files. -* comm invocation:: Compare two sorted files line by line. -* ptx invocation:: Produce a permuted index of file contents. -* tsort invocation:: Topological sort. +* sort invocation:: Sort text files +* shuf invocation:: Shuffle text files +* uniq invocation:: Uniquify files +* comm invocation:: Compare two sorted files line by line +* ptx invocation:: Produce a permuted index of file contents +* tsort invocation:: Topological sort @command{ptx}: Produce permuted indexes -* General options in ptx:: Options which affect general program behavior. -* Charset selection in ptx:: Underlying character set considerations. -* Input processing in ptx:: Input fields, contexts, and keyword selection. -* Output formatting in ptx:: Types of output format, and sizing the fields. -* Compatibility in ptx:: The @acronym{GNU} extensions to @command{ptx} +* General options in ptx:: Options which affect general program behavior +* Charset selection in ptx:: Underlying character set considerations +* Input processing in ptx:: Input fields, contexts, and keyword selection +* Output formatting in ptx:: Types of output format, and sizing the fields +* Compatibility in ptx:: The GNU extensions to @command{ptx} -Operating on fields within a line +Operating on fields -* cut invocation:: Print selected parts of lines. -* paste invocation:: Merge lines of files. -* join invocation:: Join lines on a common field. +* cut invocation:: Print selected parts of lines +* paste invocation:: Merge lines of files +* join invocation:: Join lines on a common field Operating on characters -* tr invocation:: Translate, squeeze, and/or delete characters. -* expand invocation:: Convert tabs to spaces. -* unexpand invocation:: Convert spaces to tabs. +* tr invocation:: Translate, squeeze, and/or delete characters +* expand invocation:: Convert tabs to spaces +* unexpand invocation:: Convert spaces to tabs @command{tr}: Translate, squeeze, and/or delete characters -* Character sets:: Specifying sets of characters. -* Translating:: Changing one set of characters to another. -* Squeezing:: Squeezing repeats and deleting. +* Character sets:: Specifying sets of characters +* Translating:: Changing one set of characters to another +* Squeezing and deleting:: Removing characters Directory listing -* ls invocation:: List directory contents -* dir invocation:: Briefly list directory contents -* vdir invocation:: Verbosely list directory contents -* dircolors invocation:: Color setup for @command{ls} +* ls invocation:: List directory contents +* dir invocation:: Briefly list directory contents +* vdir invocation:: Verbosely list directory contents +* dircolors invocation:: Color setup for @command{ls} @command{ls}: List directory contents -* Which files are listed:: Which files are listed -* What information is listed:: What information is listed -* Sorting the output:: Sorting the output -* More details about version sort:: More details about version sort -* General output formatting:: General output formatting -* Formatting the file names:: Formatting the file names +* Which files are listed:: Which files are listed +* What information is listed:: What information is listed +* Sorting the output:: Sorting the output +* Details about version sort:: More details about version sort +* General output formatting:: General output formatting +* Formatting the file names:: Formatting the file names Basic operations -* cp invocation:: Copy files and directories -* dd invocation:: Convert and copy a file -* install invocation:: Copy files and set attributes -* mv invocation:: Move (rename) files -* rm invocation:: Remove files or directories -* shred invocation:: Remove files more securely +* cp invocation:: Copy files and directories +* dd invocation:: Convert and copy a file +* install invocation:: Copy files and set attributes +* mv invocation:: Move (rename) files +* rm invocation:: Remove files or directories +* shred invocation:: Remove files more securely Special file types -* link invocation:: Make a hard link via the link syscall -* ln invocation:: Make links between files -* mkdir invocation:: Make directories -* mkfifo invocation:: Make FIFOs (named pipes) -* mknod invocation:: Make block or character special files -* readlink invocation:: Print the referent of a symbolic link -* rmdir invocation:: Remove empty directories -* unlink invocation:: Remove files via unlink syscall +* link invocation:: Make a hard link via the link syscall +* ln invocation:: Make links between files +* mkdir invocation:: Make directories +* mkfifo invocation:: Make FIFOs (named pipes) +* mknod invocation:: Make block or character special files +* readlink invocation:: Print value of a symlink or canonical file name +* rmdir invocation:: Remove empty directories +* unlink invocation:: Remove files via unlink syscall Changing file attributes -* chown invocation:: Change file owner and group -* chgrp invocation:: Change group ownership -* chmod invocation:: Change access permissions -* touch invocation:: Change file timestamps +* chown invocation:: Change file owner and group +* chgrp invocation:: Change group ownership +* chmod invocation:: Change access permissions +* touch invocation:: Change file timestamps Disk usage -* df invocation:: Report file system disk space usage -* du invocation:: Estimate file space usage -* stat invocation:: Report file or file system status -* sync invocation:: Synchronize data on disk with memory +* df invocation:: Report file system disk space usage +* du invocation:: Estimate file space usage +* stat invocation:: Report file or file system status +* sync invocation:: Synchronize cached writes to persistent storage +* truncate invocation:: Shrink or extend the size of a file Printing text -* echo invocation:: Print a line of text -* printf invocation:: Format and print data -* yes invocation:: Print a string until interrupted +* echo invocation:: Print a line of text +* printf invocation:: Format and print data +* yes invocation:: Print a string until interrupted Conditions -* false invocation:: Do nothing, unsuccessfully -* true invocation:: Do nothing, successfully -* test invocation:: Check file types and compare values -* expr invocation:: Evaluate expressions +* false invocation:: Do nothing, unsuccessfully +* true invocation:: Do nothing, successfully +* test invocation:: Check file types and compare values +* expr invocation:: Evaluate expressions @command{test}: Check file types and compare values -* File type tests:: File type tests -* Access permission tests:: Access permission tests -* File characteristic tests:: File characteristic tests -* String tests:: String tests -* Numeric tests:: Numeric tests +* File type tests:: File type tests +* Access permission tests:: Access permission tests +* File characteristic tests:: File characteristic tests +* String tests:: String tests +* Numeric tests:: Numeric tests @command{expr}: Evaluate expression -* String expressions:: + : match substr index length -* Numeric expressions:: + - * / % -* Relations for expr:: | & < <= = == != >= > -* Examples of expr:: Examples of using @command{expr} +* String expressions:: + : match substr index length +* Numeric expressions:: + - * / % +* Relations for expr:: | & < <= = == != >= > +* Examples of expr:: Examples of using @command{expr} Redirection -* tee invocation:: Redirect output to multiple files +* tee invocation:: Redirect output to multiple files or processes File name manipulation * basename invocation:: Strip directory and suffix from a file name -* dirname invocation:: Strip non-directory suffix from a file name -* pathchk invocation:: Check file name portability +* dirname invocation:: Strip last file name component +* pathchk invocation:: Check file name validity and portability +* mktemp invocation:: Create temporary file or directory +* realpath invocation:: Print resolved file names Working context @@ -378,13 +398,13 @@ Working context @command{stty}: Print or change terminal characteristics -* Control:: Control settings -* Input:: Input settings -* Output:: Output settings -* Local:: Local settings -* Combination:: Combination settings -* Characters:: Special characters -* Special:: Special settings +* Control:: Control settings +* Input:: Input settings +* Output:: Output settings +* Local:: Local settings +* Combination:: Combination settings +* Characters:: Special characters +* Special:: Special settings User information @@ -397,10 +417,13 @@ User information System context +* arch invocation:: Print machine hardware name * date invocation:: Print or set system date and time +* nproc invocation:: Print the number of processors * uname invocation:: Print system information * hostname invocation:: Print or set system name -* hostid invocation:: Print numeric host identifier. +* hostid invocation:: Print numeric host identifier +* uptime invocation:: Print system uptime and load @command{date}: Print or set system date and time @@ -408,9 +431,15 @@ System context * Date conversion specifiers:: %[aAbBcCdDeFgGhjmuUVwWxyY] * Literal conversion specifiers:: %[%nt] * Padding and other flags:: Pad with zeros, spaces, etc. -* Setting the time:: Changing the system clock. -* Options for date:: Instead of the current time. -* Examples of date:: Examples. +* Setting the time:: Changing the system clock +* Options for date:: Instead of the current time +* Date input formats:: Specifying date strings +* Examples of date:: Examples + +SELinux context + +* chcon invocation:: Change SELinux context of file +* runcon invocation:: Run a command in specified SELinux context Modified command invocation @@ -418,7 +447,8 @@ Modified command invocation * env invocation:: Run a command in a modified environment * nice invocation:: Run a command with modified niceness * nohup invocation:: Run a command immune to hangups -* su invocation:: Run a command with substitute user and group ID +* stdbuf invocation:: Run a command with modified I/O buffering +* timeout invocation:: Run a command with a time limit Process control @@ -431,27 +461,29 @@ Delaying Numeric operations * factor invocation:: Print prime factors +* numfmt invocation:: Reformat numbers * seq invocation:: Print numeric sequences File permissions -* Mode Structure:: Structure of file mode bits. -* Symbolic Modes:: Mnemonic representation of file mode bits. -* Numeric Modes:: File mode bits as octal numbers. -* Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories. +* Mode Structure:: Structure of file mode bits +* Symbolic Modes:: Mnemonic representation of file mode bits +* Numeric Modes:: File mode bits as octal numbers +* Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories Date input formats -* General date syntax:: Common rules. -* Calendar date items:: 19 Dec 1994. -* Time of day items:: 9:20pm. -* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}. -* Day of week items:: Monday and others. -* Relative items in date strings:: next tuesday, 2 years ago. -* Pure numbers in date strings:: 19931219, 1440. -* Seconds since the Epoch:: @@1078100502. -* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0". -* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al. +* General date syntax:: Common rules +* Calendar date items:: 19 Dec 1994 +* Time of day items:: 9:20pm +* Time zone items:: EST, PDT, UTC, @dots{} +* Combined date and time of day items:: 1972-09-24T20:02:00,000000-0500 +* Day of week items:: Monday and others +* Relative items in date strings:: next tuesday, 2 years ago +* Pure numbers in date strings:: 19931219, 1440 +* Seconds since the Epoch:: @@1078100502 +* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0" +* Authors of parse_datetime:: Bellovin, Eggert, Salz, Berets, et al. Opening the software toolbox @@ -465,7 +497,7 @@ Opening the software toolbox Copying This Manual -* GNU Free Documentation License:: License for copying this manual. +* GNU Free Documentation License:: Copying and sharing this manual @end detailmenu @end menu @@ -476,17 +508,26 @@ Copying This Manual 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 @sc{gnu} community +please get involved in improving this manual. The entire GNU community will benefit. -@cindex @acronym{POSIX} -The @sc{gnu} utilities documented here are mostly compatible with the -@acronym{POSIX} standard. +@cindex POSIX +The GNU utilities documented here are mostly compatible with the +POSIX standard. @cindex bugs, reporting -Please report bugs to @email{bug-coreutils@@gnu.org}. Remember -to include the version number, machine architecture, input files, and + +Please report bugs to @email{bug-coreutils@@gnu.org}. +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 +expected, what you got, and why it is wrong. + +If you have a problem with @command{sort}, try running @samp{sort +--debug}, as it can can often help find and fix problems without +having to wait for an answer to a bug report. If the debug output +does not suffice to fix the problem on your own, please compress and +attach it to the rest of your bug report. + +Although diffs are welcome, please include a description of the problem as well, since this is sometimes difficult to infer. @xref{Bugs, , , gcc, Using and Porting GNU CC}. @@ -514,7 +555,7 @@ insights to the overall process. @macro optBackup @item -b -@itemx @w{@kbd{--backup}[=@var{method}]} +@itemx --backup[=@var{method}] @opindex -b @opindex --backup @vindex VERSION_CONTROL @@ -534,7 +575,7 @@ Append @var{suffix} to each backup file made with @option{-b}. @macro optTargetDirectory @item -t @var{directory} -@itemx @w{@kbd{--target-directory}=@var{directory}} +@itemx --target-directory=@var{directory} @opindex -t @opindex --target-directory @cindex target directory @@ -554,8 +595,46 @@ Do not treat the last operand specially when it is a directory or a symbolic link to a directory. @xref{Target directory}. @end macro +@macro outputNUL +@cindex output NUL-byte-terminated lines +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 even when that output would contain data with embedded newlines. +@end macro + +@macro optNull +@item -0 +@itemx --null +@opindex -0 +@opindex --null +@outputNUL +@end macro + +@macro optZero +@item -z +@itemx --zero +@opindex -z +@opindex --zero +@outputNUL +@end macro + +@macro optZeroTerminated +@item -z +@itemx --zero-terminated +@opindex -z +@opindex --zero-terminated +@cindex process zero-terminated items +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 @samp{perl -0} or +@samp{find -print0} and @samp{xargs -0} which do the same in order to +reliably handle arbitrary file names (even those containing blanks +or other special characters). +@end macro + @macro optSi -@itemx --si +@item --si @opindex --si @cindex SI output Append an SI-style abbreviation to each size, such as @samp{M} for @@ -574,22 +653,64 @@ you prefer powers of 1024. @cindex human-readable output Append a size letter to each size, such as @samp{M} for mebibytes. Powers of 1024 are used, not 1000; @samp{M} stands for 1,048,576 bytes. +This option is equivalent to @option{--block-size=human-readable}. Use the @option{--si} option if you prefer powers of 1000. @end macro @macro optStripTrailingSlashes -@itemx @w{@kbd{--strip-trailing-slashes}} +@item --strip-trailing-slashes @opindex --strip-trailing-slashes @cindex stripping trailing slashes Remove any trailing slashes from each @var{source} argument. @xref{Trailing slashes}. @end macro +@macro mayConflictWithShellBuiltIn{cmd} +@cindex conflicts with shell built-ins +@cindex built-in shell commands, conflicts with +Due to shell aliases and built-in @command{\cmd\} functions, using an +unadorned @command{\cmd\} interactively or in a script may get you +different functionality than that described here. Invoke it via +@command{env} (i.e., @code{env \cmd\ @dots{}}) to avoid interference +from the shell. + +@end macro + +@macro multiplierSuffixes{varName} +@var{\varName\} may be, or may be an integer optionally followed by, +one of the following multiplicative suffixes: +@example +@samp{b} => 512 ("blocks") +@samp{KB} => 1000 (KiloBytes) +@samp{K} => 1024 (KibiBytes) +@samp{MB} => 1000*1000 (MegaBytes) +@samp{M} => 1024*1024 (MebiBytes) +@samp{GB} => 1000*1000*1000 (GigaBytes) +@samp{G} => 1024*1024*1024 (GibiBytes) +@end example +and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}. +@end macro + +@c FIXME: same as above, but no ``blocks'' line. +@macro multiplierSuffixesNoBlocks{varName} +@var{\varName\} may be, or may be an integer optionally followed by, +one of the following multiplicative suffixes: +@example +@samp{KB} => 1000 (KiloBytes) +@samp{K} => 1024 (KibiBytes) +@samp{MB} => 1000*1000 (MegaBytes) +@samp{M} => 1024*1024 (MebiBytes) +@samp{GB} => 1000*1000*1000 (GigaBytes) +@samp{G} => 1024*1024*1024 (GibiBytes) +@end example +and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}. +@end macro + @cindex 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 @sc{gnu} program accepts (or should accept) +described here. (In fact, every GNU program accepts (or should accept) these options.) @vindex POSIXLY_CORRECT @@ -607,8 +728,15 @@ program description. For example, the @command{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, @samp{rmdir +--ignore-fail-on-non-empty} can be invoked as @samp{rmdir +--ignore-fail} or even @samp{rmdir --i}. Ambiguous options, such as +@samp{ls --h}, are identified as such. + Some of these programs recognize the @option{--help} and @option{--version} -options only when one of them is the sole command line argument. +options only when one of them is the sole command line argument. For +these programs, abbreviations of the long options are not always recognized. @table @samp @@ -634,25 +762,27 @@ operands even if they begin with @samp{-}. For example, @samp{sort -- @cindex standard input @cindex standard output A single @samp{-} 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, @samp{sort -} reads from standard input, -and is equivalent to plain @samp{sort}, and @samp{tee -} writes an -extra copy of its input to standard output. Unless otherwise -specified, @samp{-} can appear as any operand that requires a file +stands for a file operand, and some tools treat it as standard input, or as +standard output if that is clear from the context. For example, @samp{sort -} +reads from standard input, and is equivalent to plain @samp{sort}. Unless +otherwise specified, a @samp{-} can appear as any operand that requires a file name. @menu * Exit status:: Indicating program success or failure. * Backup options:: -b -S, in some programs. * Block size:: BLOCK_SIZE and --block-size, in some programs. -* Disambiguating names and IDs:: chgrp and chown owner and group syntax +* Floating point:: Floating point number representation. +* Signal specifications:: Specifying signals using the --signal option. +* Disambiguating names and IDs:: chgrp, chown, chroot, id: user and group syntax * Random sources:: --random-source, in some programs. * Target directory:: Specifying a target directory, in some programs. * Trailing slashes:: --strip-trailing-slashes, in some programs. * Traversing symlinks:: -H, -L, or -P, in some programs. * Treating / specially:: --preserve-root and --no-preserve-root. -* Special built-in utilities:: @command{break}, @command{:}, @command{eval}, @dots{} -* Standards conformance:: Conformance to the @acronym{POSIX} standard. +* Special built-in utilities:: @command{break}, @command{:}, @dots{} +* Standards conformance:: Conformance to the POSIX standard. +* Multi-call invocation:: Multi-call program invocation. @end menu @@ -668,16 +798,16 @@ Nearly every command invocation yields an integral @dfn{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 -@samp{1}, though it may differ on unusual platforms as @acronym{POSIX} +@samp{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 @samp{0} and @samp{1}. Here are some of the exceptions: -@command{chroot}, @command{env}, @command{expr}, -@command{nice}, @command{nohup}, @command{printenv}, -@command{sort}, @command{su}, @command{test}, @command{tty}. +@command{chroot}, @command{env}, @command{expr}, @command{nice}, +@command{nohup}, @command{numfmt}, @command{printenv}, @command{sort}, +@command{stdbuf}, @command{test}, @command{timeout}, @command{tty}. @node Backup options @@ -685,7 +815,7 @@ Here are some of the exceptions: @cindex backup options -Some @sc{gnu} programs (at least @command{cp}, @command{install}, +Some GNU programs (at least @command{cp}, @command{install}, @command{ln}, and @command{mv}) optionally make backups of files before writing new versions. These options control the details of these backups. The options are also @@ -694,7 +824,7 @@ briefly mentioned in the descriptions of the particular programs. @table @samp @item -b -@itemx @w{@kbd{--backup}[=@var{method}]} +@itemx --backup[=@var{method}] @opindex -b @opindex --backup @vindex VERSION_CONTROL @@ -759,7 +889,7 @@ set, the default is @samp{~}, just as in Emacs. @cindex block size -Some @sc{gnu} programs (at least @command{df}, @command{du}, and +Some GNU programs (at least @command{df}, @command{du}, and @command{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. @@ -814,10 +944,11 @@ A block size specification can be a positive integer specifying the number of bytes per block, or it can be @code{human-readable} or @code{si} to select a human-readable format. Integers may be followed by suffixes that are upward compatible with the -@uref{http://www.bipm.fr/enus/3_SI/si-prefixes.html, SI prefixes} +@uref{http://www.bipm.org/en/publications/si-brochure/chapter3.html, +SI prefixes} for decimal multiples and with the -@uref{http://physics.nist.gov/cuu/Units/binary.html, IEC 60027-2 -prefixes for binary multiples}. +@uref{http://physics.nist.gov/cuu/Units/binary.html, ISO/IEC 80000-13 +(formerly IEC 60027-2) prefixes} for binary multiples. With human-readable formats, output sizes are followed by a size letter such as @samp{M} for megabytes. @code{BLOCK_SIZE=human-readable} uses @@ -858,58 +989,56 @@ kilobyte: @math{10^3 = 1000}. @itemx K @itemx KiB @cindex kibibyte, definition of -kibibyte: @math{2^10 = 1024}. @samp{K} is special: the SI prefix is -@samp{k} and the IEC 60027-2 prefix is @samp{Ki}, but tradition and -@acronym{POSIX} use @samp{k} to mean @samp{KiB}. +kibibyte: @math{2^{10} = 1024}. @samp{K} is special: the SI prefix is +@samp{k} and the ISO/IEC 80000-13 prefix is @samp{Ki}, but tradition and +POSIX use @samp{k} to mean @samp{KiB}. @item MB @cindex megabyte, definition of megabyte: @math{10^6 = 1,000,000}. @item M @itemx MiB @cindex mebibyte, definition of -mebibyte: @math{2^20 = 1,048,576}. +mebibyte: @math{2^{20} = 1,048,576}. @item GB @cindex gigabyte, definition of gigabyte: @math{10^9 = 1,000,000,000}. @item G @itemx GiB @cindex gibibyte, definition of -gibibyte: @math{2^30 = 1,073,741,824}. +gibibyte: @math{2^{30} = 1,073,741,824}. @item TB @cindex terabyte, definition of -terabyte: @math{10^12 = 1,000,000,000,000}. +terabyte: @math{10^{12} = 1,000,000,000,000}. @item T @itemx TiB @cindex tebibyte, definition of -tebibyte: @math{2^40 = 1,099,511,627,776}. +tebibyte: @math{2^{40} = 1,099,511,627,776}. @item PB @cindex petabyte, definition of -petabyte: @math{10^15 = 1,000,000,000,000,000}. +petabyte: @math{10^{15} = 1,000,000,000,000,000}. @item P @itemx PiB @cindex pebibyte, definition of -pebibyte: @math{2^50 = 1,125,899,906,842,624}. +pebibyte: @math{2^{50} = 1,125,899,906,842,624}. @item EB @cindex exabyte, definition of -exabyte: @math{10^18 = 1,000,000,000,000,000,000}. +exabyte: @math{10^{18} = 1,000,000,000,000,000,000}. @item E @itemx EiB @cindex exbibyte, definition of -exbibyte: @math{2^60 = 1,152,921,504,606,846,976}. +exbibyte: @math{2^{60} = 1,152,921,504,606,846,976}. @item ZB @cindex zettabyte, definition of -zettabyte: @math{10^21 = 1,000,000,000,000,000,000,000} +zettabyte: @math{10^{21} = 1,000,000,000,000,000,000,000} @item Z @itemx ZiB -@math{2^70 = 1,180,591,620,717,411,303,424}. -(@samp{Zi} is a @acronym{GNU} extension to IEC 60027-2.) +@math{2^{70} = 1,180,591,620,717,411,303,424}. @item YB @cindex yottabyte, definition of -yottabyte: @math{10^24 = 1,000,000,000,000,000,000,000,000}. +yottabyte: @math{10^{24} = 1,000,000,000,000,000,000,000,000}. @item Y @itemx YiB -@math{2^80 = 1,208,925,819,614,629,174,706,176}. -(@samp{Yi} is a @acronym{GNU} extension to IEC 60027-2.) +@math{2^{80} = 1,208,925,819,614,629,174,706,176}. @end table @opindex -k @@ -924,34 +1053,156 @@ option is equivalent to @option{--block-size=1K}, which is the default unless the @env{POSIXLY_CORRECT} environment variable is set. The @option{-h} or @option{--human-readable} option is equivalent to @option{--block-size=human-readable}. The @option{--si} option is -equivalent to @option{--block-size=si}. +equivalent to @option{--block-size=si}. Note for @command{ls} +the @option{-k} option does not control the display of the +apparent file sizes, whereas the @option{--block-size} option does. + +@node Floating point +@section Floating point numbers +@cindex floating point +@cindex IEEE floating point + +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 +@uref{http://@/www.validlab.com/@/goldberg/@/paper.pdf, What Every +Computer Scientist Should Know About Floating-Point Arithmetic}. + +@vindex LC_NUMERIC +Commands that accept floating point numbers as options, operands or +input use the standard C functions @code{strtod} and @code{strtold} to +convert from text to floating point numbers. These floating point +numbers therefore can use scientific notation like @code{1.0e-34} and +@code{-10e100}. Commands that parse floating point also understand +case-insensitive @code{inf}, @code{infinity}, and @code{NaN}, although +whether such values are useful depends on the command in question. +Modern C implementations also accept hexadecimal floating point +numbers such as @code{-0x.ep-3}, which stands for @minus{}14/16 times +@math{2^-3}, which equals @minus{}0.109375. The @env{LC_NUMERIC} +locale determines the decimal-point character. @xref{Parsing of +Floats,,, libc, The GNU C Library Reference Manual}. + +@node Signal specifications +@section Signal specifications +@cindex signals, specifying + +A @var{signal} may be a signal name like @samp{HUP}, or a signal +number like @samp{1}, or an exit status of a process terminated by the +signal. A signal name can be given in canonical form or prefixed by +@samp{SIG}@. The case of the letters is ignored. The following signal names +and numbers are supported on all POSIX compliant systems: + +@table @samp +@item HUP +1. Hangup. +@item INT +2. Terminal interrupt. +@item QUIT +3. Terminal quit. +@item ABRT +6. Process abort. +@item KILL +9. Kill (cannot be caught or ignored). +@item ALRM +14. Alarm Clock. +@item TERM +15. Termination. +@end table + +@noindent +Other supported signal names have system-dependent corresponding +numbers. All systems conforming to POSIX 1003.1-2001 also +support the following signals: + +@table @samp +@item BUS +Access to an undefined portion of a memory object. +@item CHLD +Child process terminated, stopped, or continued. +@item CONT +Continue executing, if stopped. +@item FPE +Erroneous arithmetic operation. +@item ILL +Illegal Instruction. +@item PIPE +Write on a pipe with no one to read it. +@item SEGV +Invalid memory reference. +@item STOP +Stop executing (cannot be caught or ignored). +@item TSTP +Terminal stop. +@item TTIN +Background process attempting read. +@item TTOU +Background process attempting write. +@item URG +High bandwidth data is available at a socket. +@item USR1 +User-defined signal 1. +@item USR2 +User-defined signal 2. +@end table + +@noindent +POSIX 1003.1-2001 systems that support the XSI extension +also support the following signals: + +@table @samp +@item POLL +Pollable event. +@item PROF +Profiling timer expired. +@item SYS +Bad system call. +@item TRAP +Trace/breakpoint trap. +@item VTALRM +Virtual timer expired. +@item XCPU +CPU time limit exceeded. +@item XFSZ +File size limit exceeded. +@end table + +@noindent +POSIX 1003.1-2001 systems that support the XRT extension +also support at least eight real-time signals called @samp{RTMIN}, +@samp{RTMIN+1}, @dots{}, @samp{RTMAX-1}, @samp{RTMAX}. @node Disambiguating names and IDs -@section chown and chgrp: Disambiguating user names and IDs +@section chown, chgrp, chroot, id: Disambiguating user names and IDs @cindex user names, disambiguating @cindex user IDs, disambiguating @cindex group names, disambiguating @cindex group IDs, disambiguating @cindex disambiguating group names and IDs -Since the @var{owner} and @var{group} arguments to @command{chown} and -@command{chgrp} may be specified as names or numeric IDs, there is an +Since the @var{user} and @var{group} arguments to these commands +may be specified as names or numeric IDs, there is an apparent ambiguity. What if a user or group @emph{name} is a string of digits? @footnote{Using a number as a user name is common in some environments.} -Should the command interpret it as a user name or as an ID? -@acronym{POSIX} requires that @command{chown} and @command{chgrp} +Should the command interpret it as a user name or as an ID@? +POSIX requires that these commands first attempt to resolve the specified string as a name, and -only once that fails, then try to interpret it as an ID. +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 @samp{42} is a user name that maps to some other user ID, say 1000. Simply invoking @code{chown 42 F}, will set @file{F}s owner ID to 1000---not what you intended. -GNU @command{chown} and @command{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. +GNU @command{chown}, @command{chgrp}, @command{chroot}, and @command{id} +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 @samp{+}, in order to force its interpretation as an integer: @@ -961,8 +1212,7 @@ chgrp +$numeric_group_id another-file chown +0:+0 / @end example -GNU @command{chown} and @command{chgrp} -skip the name look-up process for each @samp{+}-prefixed string, +The name look-up process is skipped for each @samp{+}-prefixed string, because a string containing @samp{+} is never a valid user or group name. This syntax is accepted on most common Unix systems, but not on Solaris 10. @@ -976,12 +1226,19 @@ sometimes need random data to do their work. For example, @samp{sort -R} must choose a hash function at random, and it needs random data to make this selection. -Normally these commands use the device file @file{/dev/urandom} as the +By default these commands use an internal pseudo-random generator +initialized by a small amount of entropy, but can be directed to use +an external source with the @option{--random-source=@var{file}} option. +An error is reported if @var{file} does not contain enough bytes. + +For example, the device file @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. +cryptographically secure pseudo-random number generator. But be aware +that this device is not designed for bulk random data generation +and is relatively slow. @file{/dev/urandom} suffices for most practical uses, but applications requiring high-value or long-term protection of private data may @@ -989,20 +1246,24 @@ require an alternate data source like @file{/dev/random} or @file{/dev/arandom}. The set of available sources depends on your operating system. -To use such a source, specify the @option{--random-source=@var{file}} -option, e.g., @samp{shuf --random-source=/dev/random}. The contents -of @var{file} should be as random as possible. An error is reported -if @var{file} does not contain enough bytes to randomize the input -adequately. - 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. +@cindex random seed +Rather than depending on a file, one can generate a reproducible +arbitrary amount of pseudo-random data given a seed value, using +for example: -Some old-fashioned or stripped-down operating systems lack support for -@command{/dev/urandom}. On these systems commands like @command{shuf} -by default fall back on an internal pseudorandom generator initialized -by a small amount of entropy. +@example +get_seeded_random() +@{ + seed="$1" + openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt \ + </dev/zero 2>/dev/null +@} + +shuf -i1-100 --random-source=<(get_seeded_random 42) +@end example @node Target directory @section Target directory @@ -1039,7 +1300,7 @@ treated as a directory and want a diagnostic otherwise, you can use the @option{--target-directory} (@option{-t}) option. @item -t @var{directory} -@itemx @w{@kbd{--target-directory}=@var{directory}} +@itemx --target-directory=@var{directory} @opindex --target-directory @cindex target directory @cindex destination directory @@ -1062,7 +1323,7 @@ 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 @w{@kbd{--target-directory}} (@option{-t}) option allows the @command{cp}, +The @option{--target-directory} (@option{-t}) option allows the @command{cp}, @command{install}, @command{ln}, and @command{mv} programs to be used conveniently with @command{xargs}. For example, you can move the files from the current directory to a sibling directory, @code{d} like this: @@ -1072,7 +1333,7 @@ ls | xargs mv -t ../d -- @end smallexample However, this doesn't move files whose names begin with @samp{.}. -If you use the @sc{gnu} @command{find} program, you can move those +If you use the GNU @command{find} program, you can move those files too, with this command: @example @@ -1084,7 +1345,7 @@ 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 -@sc{gnu} @command{find} and @sc{gnu} @command{xargs}: +GNU @command{find} and GNU @command{xargs}: @example find . -mindepth 1 -maxdepth 1 -print0 \ @@ -1104,9 +1365,9 @@ options cannot be combined. @cindex trailing slashes -Some @sc{gnu} programs (at least @command{cp} and @command{mv}) allow you to +Some GNU programs (at least @command{cp} and @command{mv}) allow you to remove any trailing slashes from each @var{source} argument before -operating on it. The @w{@kbd{--strip-trailing-slashes}} option enables +operating on it. The @option{--strip-trailing-slashes} option enables this behavior. This is useful when a @var{source} argument may have a trailing slash and @@ -1118,7 +1379,7 @@ option, @command{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 @emph{directory} and not the symbolic link. Although it may seem surprising that such behavior -be the default, it is required by @acronym{POSIX} and is consistent with +be the default, it is required by POSIX and is consistent with other parts of that standard. @node Traversing symlinks @@ -1127,7 +1388,7 @@ other parts of that standard. @cindex symbolic link to directory, controlling traversal of The following options modify how @command{chown} and @command{chgrp} -@c FIXME: note that `du' has these options, too, but they have slightly +@c FIXME: note that 'du' has these options, too, but they have slightly @c different meaning. traverse a hierarchy when the @option{--recursive} (@option{-R}) option is also specified. @@ -1146,7 +1407,7 @@ a symlink or its referent. @macro choptH @item -H @opindex -H -@cindex symbolic link to directory, traverse each that is specified on the command line +@cindex symbolic link to directory, traverse if on the command line If @option{--recursive} (@option{-R}) is specified and a command line argument is a symbolic link to a directory, traverse it. @end macro @@ -1175,18 +1436,18 @@ or @option{-P} is specified. @node Treating / specially -@section Treating / specially +@section Treating @file{/} specially Certain commands can operate destructively on entire hierarchies. For example, if a user with appropriate privileges mistakenly runs @samp{rm -rf / tmp/junk}, that may remove all files on the entire system. Since there are so few legitimate uses for such a command, -@sc{gnu} @command{rm} normally declines to operate on any directory +GNU @command{rm} normally declines to operate on any directory that resolves to @file{/}. If you really want to try to remove all the files on your system, you can use the @option{--no-preserve-root} option, but the default behavior, specified by the -@option{--preserve-option}, is safer for most purposes. +@option{--preserve-root} option, is safer for most purposes. The commands @command{chgrp}, @command{chmod} and @command{chown} can also operate destructively on entire hierarchies, so they too @@ -1194,7 +1455,7 @@ support these options. Although, unlike @command{rm}, they don't actually unlink files, these commands are arguably more dangerous when operating recursively on @file{/}, since they often work much more quickly, and hence damage more files before an alert user can -interrupt them. Tradition and @acronym{POSIX} require these commands +interrupt them. Tradition and POSIX require these commands to operate recursively on @file{/}, so they default to @option{--no-preserve-root}, but using the @option{--preserve-root} option makes them safer for most purposes. For convenience you can @@ -1216,7 +1477,7 @@ 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 @acronym{POSIX} 1003.1-2004. +by POSIX 1003.1-2004. @quotation @t{.@: : break continue eval exec exit export readonly @@ -1236,33 +1497,56 @@ generates an error message instead of suspending. @section Standards conformance @vindex POSIXLY_CORRECT -In a few cases, the @sc{gnu} utilities' default behavior is -incompatible with the @acronym{POSIX} standard. To suppress these +In a few cases, the GNU utilities' default behavior is +incompatible with the POSIX standard. To suppress these incompatibilities, define the @env{POSIXLY_CORRECT} environment -variable. Unless you are checking for @acronym{POSIX} conformance, you +variable. Unless you are checking for POSIX conformance, you probably do not need to define @env{POSIXLY_CORRECT}. -Newer versions of @acronym{POSIX} are occasionally incompatible with older -versions. For example, older versions of @acronym{POSIX} required the +Newer versions of POSIX are occasionally incompatible with older +versions. For example, older versions of POSIX required the command @samp{sort +1} to sort based on the second and succeeding -fields in each input line, but starting with @acronym{POSIX} 1003.1-2001 +fields in each input line, but starting with POSIX 1003.1-2001 the same command is required to sort the file named @file{+1}, and you must instead use the command @samp{sort -k 2} to get the field-based sort. @vindex _POSIX2_VERSION -The @sc{gnu} utilities normally conform to the version of @acronym{POSIX} +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 @acronym{POSIX}, define the @env{_POSIX2_VERSION} +different version of POSIX, define the @env{_POSIX2_VERSION} environment variable to a value of the form @var{yyyymm} specifying -the year and month the standard was adopted. Two values are currently +the year and month the standard was adopted. Three values are currently supported for @env{_POSIX2_VERSION}: @samp{199209} stands for -@acronym{POSIX} 1003.2-1992, and @samp{200112} stands for @acronym{POSIX} -1003.1-2001. For example, if you have a newer system but are running software -that assumes an older version of @acronym{POSIX} and uses @samp{sort +1} +POSIX 1003.2-1992, @samp{200112} stands for POSIX +1003.1-2001, and @samp{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 @samp{sort +1} or @samp{tail +10}, you can work around any compatibility problems by setting @samp{_POSIX2_VERSION=199209} in your environment. +@c This node is named "Multi-call invocation", not the usual +@c "coreutils invocation", so that shell commands like +@c 'info coreutils "touch invocation"' work as expected. +@node Multi-call invocation +@section @command{coreutils}: Multi-call program + +@pindex multicall +@cindex combined +@cindex calling combined multi-call program + +The @command{coreutils} command invokes an individual utility, either +implicitly selected by the last component of the name used to invoke +@command{coreutils}, or explicitly with the +@option{--coreutils-prog} option. Synopsis: + +@example +coreutils @option{--coreutils-prog=PROGRAM} @dots{} +@end example + +The @command{coreutils} command is not installed by default, so +portable scripts should not rely on its existence. + @node Output of entire files @chapter Output of entire files @@ -1277,6 +1561,7 @@ in some way. * tac invocation:: Concatenate and write files in reverse. * nl invocation:: Number lines and write files. * od invocation:: Write files in octal or other formats. +* base32 invocation:: Transform data into printable data. * base64 invocation:: Transform data into printable data. @end menu @@ -1308,7 +1593,7 @@ Equivalent to @option{-vET}. @itemx --number-nonblank @opindex -b @opindex --number-nonblank -Number all nonblank output lines, starting with 1. +Number all nonempty output lines, starting with 1. @item -e @opindex -e @@ -1324,14 +1609,17 @@ Display a @samp{$} after the end of each line. @itemx --number @opindex -n @opindex --number -Number all output lines, starting with 1. +Number all output lines, starting with 1. This option is ignored +if @option{-b} is in effect. @item -s @itemx --squeeze-blank @opindex -s @opindex --squeeze-blank +@cindex squeezing empty lines @cindex squeezing blank lines -Replace multiple adjacent blank lines with a single blank line. +Suppress repeated adjacent blank lines; output just one empty line +instead of several. @item -t @opindex -t @@ -1345,7 +1633,7 @@ Display TAB characters as @samp{^I}. @item -u @opindex -u -Ignored; for @acronym{POSIX} compatibility. +Ignored; for POSIX compatibility. @item -v @itemx --show-nonprinting @@ -1411,21 +1699,30 @@ precedes in the file. @itemx --regex @opindex -r @opindex --regex -Treat the separator string as a regular expression. Users of @command{tac} -on MS-DOS/MS-Windows should note that, since @command{tac} reads files in -binary mode, each line of a text file might end with a CR/LF pair -instead of the Unix-style LF. +Treat the separator string as a regular expression. @item -s @var{separator} @itemx --separator=@var{separator} @opindex -s @opindex --separator Use @var{separator} as the record separator, instead of newline. +Note an empty @var{separator} is treated as a zero byte. +I.e., input and output items are delimited with ASCII NUL. @end table +On systems like MS-DOS that distinguish between text and binary files, +@command{tac} reads and writes in binary mode. + @exitstatus +Example: + +@example +# Reverse a file character by character. +tac -r -s 'x\|[^x]' +@end example + @node nl invocation @section @command{nl}: Number lines and write files @@ -1525,9 +1822,9 @@ Analogous to @option{--body-numbering}. Analogous to @option{--body-numbering}. @item -i @var{number} -@itemx --page-increment=@var{number} +@itemx --line-increment=@var{number} @opindex -i -@opindex --page-increment +@opindex --line-increment Increment line numbers by @var{number} (default 1). @item -l @var{number} @@ -1606,7 +1903,8 @@ Synopses: @smallexample od [@var{option}]@dots{} [@var{file}]@dots{} od [-abcdfilosx]@dots{} [@var{file}] [[+]@var{offset}[.][b]] -od [@var{option}]@dots{} --traditional [@var{file}] [[+]@var{offset}[.][b] [[+]@var{label}[.][b]]] +od [@var{option}]@dots{} --traditional [@var{file}]@c + [[+]@var{offset}[.][b] [[+]@var{label}[.][b]]] @end smallexample Each line of output consists of the offset in the input, followed by @@ -1654,6 +1952,16 @@ none (do not print offsets). The default is octal. +@item --endian=@var{order} +@opindex --endian +@cindex byte-swapping +@cindex endianness +Reorder input bytes, to handle inputs with differing byte orders, +or to provide consistent output independent of the endian convention +of the current system. Swapping is performed according to the +specified @option{--type} size and endian @var{order}, which can be +@samp{little} or @samp{big}. + @item -j @var{bytes} @itemx --skip-bytes=@var{bytes} @opindex -j @@ -1661,8 +1969,8 @@ The default is octal. Skip @var{bytes} input bytes before formatting and writing. If @var{bytes} begins with @samp{0x} or @samp{0X}, it is interpreted in hexadecimal; otherwise, if it begins with @samp{0}, in octal; otherwise, -in decimal. Appending @samp{b} multiplies @var{bytes} by 512, @samp{k} -by 1024, and @samp{m} by 1048576. +in decimal. +@multiplierSuffixes{bytes} @item -N @var{bytes} @itemx --read-bytes=@var{bytes} @@ -1671,16 +1979,18 @@ by 1024, and @samp{m} by 1048576. Output at most @var{bytes} bytes of the input. Prefixes and suffixes on @code{bytes} are interpreted as for the @option{-j} option. -@item -S @var{n} -@itemx --strings[=@var{n}] +@item -S @var{bytes} +@itemx --strings[=@var{bytes}] @opindex -S @opindex --strings @cindex string constants, outputting Instead of the normal output, output only @dfn{string constants}: at -least @var{n} consecutive @acronym{ASCII} graphic characters, -followed by a null (zero) byte. +least @var{bytes} consecutive ASCII graphic characters, +followed by a zero byte (ASCII NUL). +Prefixes and suffixes on @var{bytes} are interpreted as for the +@option{-j} option. -If @var{n} is omitted with @option{--strings}, the default is 3. +If @var{bytes} is omitted with @option{--strings}, the default is 3. @item -t @var{type} @itemx --format=@var{type} @@ -1694,18 +2004,19 @@ 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 @acronym{ASCII} character representation of the printable characters +of the single byte character representation of the printable characters to the output line generated by the type specification. @table @samp @item a named character, ignoring high-order bit @item c -@acronym{ASCII} character or backslash escape, +printable single byte character, C backslash escape +or a 3 digit octal sequence @item d signed decimal @item f -floating point +floating point (@pxref{Floating point}) @item o octal @item u @@ -1715,7 +2026,7 @@ hexadecimal @end table The type @code{a} outputs things like @samp{sp} for space, @samp{nl} for -newline, and @samp{nul} for a null (zero) byte. Only the least significant +newline, and @samp{nul} for a zero byte. Only the least significant seven bits of each byte is used; the high-order bit is ignored. Type @code{c} outputs @samp{ }, @samp{\n}, and @code{\0}, respectively. @@ -1774,7 +2085,7 @@ omitted, the default is 32. @end table The next several options are shorthands for format specifications. -@sc{gnu} @command{od} accepts any combination of shorthands and format +GNU @command{od} accepts any combination of shorthands and format specification options. These options accumulate. @table @samp @@ -1789,8 +2100,8 @@ Output as octal bytes. Equivalent to @samp{-t o1}. @item -c @opindex -c -Output as @acronym{ASCII} characters or backslash escapes. Equivalent to -@samp{-t c}. +Output as printable single byte characters, C backslash escapes +or 3 digit octal sequences. Equivalent to @samp{-t c}. @item -d @opindex -d @@ -1841,16 +2152,29 @@ address. @exitstatus + +@node base32 invocation +@section @command{base32}: Transform data into printable data + +@pindex base32 +@cindex base32 encoding + +@command{base32} transforms data read from a file, or standard input, +into (or from) base32 encoded form. The base32 encoded form uses +printable ASCII characters to represent binary data. +The usage and options of this command are precisely the +same as for @command{base64}. @xref{base64 invocation}. + + @node base64 invocation -@section @command{base64}: Transform data into printable data. +@section @command{base64}: Transform data into printable data @pindex base64 @cindex base64 encoding @command{base64} transforms data read from a file, or standard input, into (or from) base64 encoded form. The base64 encoded form uses -printable @acronym{ASCII} characters to represent binary data, see -@uref{ftp://ftp.rfc-editor.org/in-notes/rfc3548.txt, RFC 3548}. +printable ASCII characters to represent binary data. Synopses: @smallexample @@ -1859,18 +2183,21 @@ base64 --decode [@var{option}]@dots{} [@var{file}] @end smallexample The base64 encoding expands data to roughly 133% of the original. +The base32 encoding expands data to roughly 160% of the original. +The format conforms to +@uref{ftp://ftp.rfc-editor.org/in-notes/rfc4648.txt, RFC 4648}. The program accepts the following options. Also see @ref{Common options}. @table @samp -@item -w @var{COLS} -@itemx --wrap=@var{COLS} +@item -w @var{cols} +@itemx --wrap=@var{cols} @opindex -w @opindex --wrap @cindex wrap data @cindex column to wrap data after -During encoding, wrap lines after @var{COLS} characters. This must be +During encoding, wrap lines after @var{cols} characters. This must be a positive number. The default is to wrap after 76 characters. Use the value 0 to @@ -1996,9 +2323,15 @@ between sentences to two spaces. @opindex -@var{width} @opindex -w @opindex --width -Fill output lines up to @var{width} characters (default 75). @command{fmt} -initially tries to make lines about 7% shorter than this, to give it -room to balance line lengths. +Fill output lines up to @var{width} characters (default 75 or @var{goal} +plus 10, if @var{goal} is provided). + +@item -g @var{goal} +@itemx --goal=@var{goal} +@opindex -g +@opindex --goal +@command{fmt} initially tries to make lines @var{goal} characters wide. +By default, this is 7% shorter than @var{width}. @item -p @var{prefix} @itemx --prefix=@var{prefix} @@ -2012,7 +2345,6 @@ leaving the code unchanged. @exitstatus - @node pr invocation @section @command{pr}: Paginate or columnate files for printing @@ -2034,11 +2366,9 @@ pr [@var{option}]@dots{} [@var{file}]@dots{} 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. -With the @option{-F} -option, a 3-line header is printed: the leading two blank lines are -omitted; no footer is used. The default @var{page_length} in both cases is 66 -lines. The default number of text lines changes from 56 (without @option{-F}) -to 63 (with @option{-F}). The text line of the header takes the form +The default @var{page_length} is 66 +lines. The default number of text lines is therefore 56. +The text line of the header takes the form @samp{@var{date} @var{string} @var{page}}, with spaces inserted around @var{string} so that the line takes up the full @var{page_width}. Here, @var{date} is the date (see the @option{-D} or @option{--date-format} @@ -2058,44 +2388,14 @@ For single column output no line truncation occurs by default. Use @option{-W} option to truncate lines in that case. -The following changes were made in version 1.22i and apply to later -versions of @command{pr}: -@c FIXME: this whole section here sounds very awkward to me. I -@c made a few small changes, but really it all needs to be redone. - Brian -@c OK, I fixed another sentence or two, but some of it I just don't understand. -@ - Brian -@itemize @bullet - -@item -Some small @var{letter options} (@option{-s}, @option{-w}) have been -redefined for better @acronym{POSIX} compliance. The output of some further -cases has been adapted to other Unix systems. These changes are not -compatible with earlier versions of the program. - -@item -Some @var{new capital letter} options (@option{-J}, @option{-S}, @option{-W}) -have been introduced to turn off unexpected interferences of small letter -options. The @option{-N} option and the second argument @var{last_page} -of @samp{+FIRST_PAGE} offer more flexibility. The detailed handling of -form feeds set in the input files requires the @option{-T} option. - -@item -Capital letter options override small letter ones. - -@item -Some of the option-arguments (compare @option{-s}, @option{-e}, -@option{-i}, @option{-n}) cannot be specified as separate arguments from the -preceding option letter (already stated in the @acronym{POSIX} specification). -@end itemize - The program accepts the following options. Also see @ref{Common options}. @table @samp @item +@var{first_page}[:@var{last_page}] @itemx --pages=@var{first_page}[:@var{last_page}] -@c The two following @opindex lines evoke warnings because they contain `:' -@c The `info' spec does not permit that. If we use those lines, we end +@c The two following @opindex lines evoke warnings because they contain ':' +@c The 'info' spec does not permit that. If we use those lines, we end @c up with truncated index entries that don't work. @c @opindex +@var{first_page}[:@var{last_page}] @c @opindex --pages=@var{first_page}[:@var{last_page}] @@ -2155,7 +2455,7 @@ Double space the output. @cindex time formats @cindex formatting times Format header dates using @var{format}, using the same conventions as -for the command @samp{date +@var{format}}; @xref{date invocation}. +for the command @samp{date +@var{format}}. @xref{date invocation}. Except for directives, which start with @samp{%}, characters in @var{format} are printed unchanged. You can use this option to specify an arbitrary string in place of the header date, @@ -2163,10 +2463,10 @@ e.g., @option{--date-format="Monday morning"}. @vindex POSIXLY_CORRECT @vindex LC_TIME -Normally the date -format defaults to @samp{%Y-%m-%d %H:%M} (for example, @samp{2001-12-04 -23:59}); but if the @env{POSIXLY_CORRECT} environment variable is set -and the @env{LC_TIME} locale category specifies the @acronym{POSIX} +The default date format is @samp{%Y-%m-%d %H:%M} (for example, +@samp{2001-12-04 23:59}); +but if the @env{POSIXLY_CORRECT} environment variable is set +and the @env{LC_TIME} locale category specifies the POSIX locale, the default is @samp{%b %e %H:%M %Y} (for example, @samp{Dec@ @ 4 23:59 2001}. @@ -2174,7 +2474,7 @@ locale, the default is @samp{%b %e %H:%M %Y} (for example, Time stamps are listed according to the time zone rules specified by the @env{TZ} environment variable, or by the system default rules if @env{TZ} is not set. @xref{TZ Variable,, Specifying the Time Zone -with @env{TZ}, libc, The GNU C Library}. +with @env{TZ}, libc, The GNU C Library Reference Manual}. @item -e[@var{in-tabchar}[@var{in-tabwidth}]] @itemx --expand-tabs[=@var{in-tabchar}[@var{in-tabwidth}]] @@ -2192,12 +2492,11 @@ is 8). @opindex -F @opindex -f @opindex --form-feed -Use a form feed instead of newlines to separate output pages. The default -page length of 66 lines is not altered. But the number of lines of text -per page changes from default 56 to 63 lines. +Use a form feed instead of newlines to separate output pages. This does +not alter the default page length of 66 lines. -@item -h @var{HEADER} -@itemx --header=@var{HEADER} +@item -h @var{header} +@itemx --header=@var{header} @opindex -h @opindex --header Replace the file name in the header with the centered string @var{header}. @@ -2224,7 +2523,7 @@ Merge lines of full length. Used together with the column options no column alignment used; may be used with @option{--sep-string[=@var{string}]}. @option{-J} has been introduced (together with @option{-W} and @option{--sep-string}) -to disentangle the old (@acronym{POSIX}-compliant) options @option{-w} and +to disentangle the old (POSIX-compliant) options @option{-w} and @option{-s} along with the three column options. @@ -2234,9 +2533,8 @@ to disentangle the old (@acronym{POSIX}-compliant) options @option{-w} and @opindex --length Set the page length to @var{page_length} (default 66) lines, including the lines of the header [and the footer]. If @var{page_length} is less -than or equal to 10 (or <= 3 with @option{-F}), the header and footer are -omitted, and all form feeds set in input files are eliminated, as if -the @option{-T} option had been given. +than or equal to 10, the header and footer are omitted, as if the +@option{-t} option had been given. @item -m @itemx --merge @@ -2268,14 +2566,14 @@ first line of the input file (not the first line printed, compare the Optional argument @var{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 @var{TAB}-width varies -with the @var{TAB}-position, e.g., with the left @var{margin} specified +printed with single column output only. The TAB width varies +with the TAB position, e.g., with the left @var{margin} specified by @option{-o} option. With multicolumn output priority is given to -@samp{equal width of output columns} (a @acronym{POSIX} specification). -The @var{TAB}-width is fixed to the value of the first column and does +@samp{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 @var{margin}. That means a fixed number of spaces is always printed in the place of the -@var{number-separator tab}. The tabification depends upon the output +@var{number-separator} TAB@. The tabification depends upon the output position. @item -N @var{line_number} @@ -2312,10 +2610,10 @@ Separate columns by a single character @var{char}. The default for character} with @option{-w}. Without @option{-s} the default separator @samp{space} is set. @option{-s[char]} turns off line truncation of all three column options (@option{-COLUMN}|@option{-a -COLUMN}|@option{-m}) unless -@option{-w} is set. This is a @acronym{POSIX}-compliant formulation. +@option{-w} is set. This is a POSIX-compliant formulation. -@item -S@var{string} +@item -S[@var{string}] @itemx --sep-string[=@var{string}] @opindex -S @opindex --sep-string @@ -2325,8 +2623,8 @@ does not affect line truncation or column alignment. Without @option{-S}, and with @option{-J}, @command{pr} uses the default output separator, TAB@. Without @option{-S} or @option{-J}, @command{pr} uses a @samp{space} -(same as @option{-S"@w{ }"}). @option{--sep-string} with no -@samp{=@var{string}} is equivalent to @option{--sep-string=""}. +(same as @option{-S"@w{ }"}). +If no @samp{@var{string}} argument is specified, @samp{""} is assumed. @item -t @itemx --omit-header @@ -2358,25 +2656,28 @@ Print nonprinting characters in octal backslash notation. @opindex -w @opindex --width Set page width to @var{page_width} characters for multiple text-column -output only (default for @var{page_width} is 72). @option{-s[CHAR]} turns -off the default page width and any line truncation and column alignment. +output only (default for @var{page_width} is 72). The specified +@var{page_width} is rounded down so that columns have equal width. +@option{-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 @var{page_width} setting is possible with single column output. -A @acronym{POSIX}-compliant formulation. +A POSIX-compliant formulation. @item -W @var{page_width} @itemx --page_width=@var{page_width} @opindex -W @opindex --page_width -Set the page width to @var{page_width} characters. That's valid with and -without a column option. Text lines are truncated, unless @option{-J} -is used. Together with one of the three column options +Set the page width to @var{page_width} characters, honored with and +without a column option. With a column option, the specified @var{page_width} +is rounded down so that columns have equal width. Text lines are truncated, +unless @option{-J} is used. Together with one of the three column options (@option{-@var{column}}, @option{-a -@var{column}} or @option{-m}) column alignment is always used. The separator options @option{-S} or @option{-s} -don't affect the @option{-W} option. Default is 72 characters. Without +don't disable the @option{-W} option. Default is 72 characters. Without @option{-W @var{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 @option{-W 72 -J}. The header +most frequent tasks). That's equivalent to @option{-W 72 -J}@. The header line is never truncated. @end table @@ -2453,7 +2754,7 @@ These commands output pieces of the input. @menu * head invocation:: Output the first part of files. * tail invocation:: Output the last part of files. -* split invocation:: Split a file into fixed-size pieces. +* split invocation:: Split a file into pieces. * csplit invocation:: Split a file into context-determined pieces. @end menu @@ -2486,23 +2787,23 @@ The program accepts the following options. Also see @ref{Common options}. @table @samp -@item -c @var{n} -@itemx --bytes=@var{n} +@item -c [-]@var{num} +@itemx --bytes=[-]@var{num} @opindex -c @opindex --bytes -Print the first @var{n} bytes, instead of initial lines. Appending -@samp{b} multiplies @var{n} by 512, @samp{k} by 1024, and @samp{m} -by 1048576. -However, if @var{n} starts with a @samp{-}, -print all but the last @var{n} bytes of each file. - -@itemx -n @var{n} -@itemx --lines=@var{n} +Print the first @var{num} bytes, instead of initial lines. +However, if @var{num} is prefixed with a @samp{-}, +print all but the last @var{num} bytes of each file. +@multiplierSuffixes{num} + +@item -n [-]@var{num} +@itemx --lines=[-]@var{num} @opindex -n @opindex --lines -Output the first @var{n} lines. -However, if @var{n} starts with a @samp{-}, -print all but the last @var{n} lines of each file. +Output the first @var{num} lines. +However, if @var{num} is prefixed with a @samp{-}, +print all but the last @var{num} lines of each file. +Size multiplier suffixes are the same as with the @option{-c} option. @item -q @itemx --quiet @@ -2518,15 +2819,17 @@ Never print file name headers. @opindex --verbose Always print file name headers. +@optZeroTerminated + @end table For compatibility @command{head} also supports an obsolete option syntax -@option{-@var{count}@var{options}}, which is recognized only if it is -specified first. @var{count} is a decimal number optionally followed +@option{-[@var{num}][bkm][cqv]}, which is recognized only if it is +specified first. @var{num} is a decimal number optionally followed by a size letter (@samp{b}, @samp{k}, @samp{m}) as in @option{-c}, or @samp{l} to mean count by lines, or other option letters (@samp{cqv}). -Scripts intended for standard hosts should use @option{-c @var{count}} -or @option{-n @var{count}} instead. If your script must also run on +Scripts intended for standard hosts should use @option{-c @var{num}} +or @option{-n @var{num}} instead. If your script must also run on hosts that support only the obsolete syntax, it is usually simpler to avoid @command{head}, e.g., by using @samp{sed 5q} instead of @samp{head -5}. @@ -2549,39 +2852,44 @@ tail [@var{option}]@dots{} [@var{file}]@dots{} @end example If more than one @var{file} is specified, @command{tail} prints a -one-line header consisting of: +one-line header before the output for each @var{file}, consisting of: @example ==> @var{file name} <== @end example -@noindent -before the output for each @var{file}. +For further processing of tail output, it can be useful to convert the +file headers to line prefixes, which can be done like: + +@example +tail @dots{} | +awk ' + /^==> .* <==$/ @{prefix=substr($0,5,length-8)":"; next@} + @{print prefix$0@} +' | @dots{} +@end example @cindex BSD @command{tail} -@sc{gnu} @command{tail} can output any amount of data (some other versions of +GNU @command{tail} can output any amount of data (some other versions of @command{tail} cannot). It also has no @option{-r} option (print in reverse), since reversing a file is really a different job from printing the end of a file; BSD @command{tail} (which is the one with @option{-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 @sc{gnu} @command{tac} command. - -If any option-argument is a number @var{n} starting with a @samp{+}, -@command{tail} begins printing with the @var{n}th item from the start of -each file, instead of from the end. +the GNU @command{tac} command. The program accepts the following options. Also see @ref{Common options}. @table @samp -@item -c @var{bytes} -@itemx --bytes=@var{bytes} +@item -c [+]@var{num} +@itemx --bytes=[+]@var{num} @opindex -c @opindex --bytes -Output the last @var{bytes} bytes, instead of final lines. Appending -@samp{b} multiplies @var{bytes} by 512, @samp{k} by 1024, and @samp{m} -by 1048576. +Output the last @var{num} bytes, instead of final lines. +However, if @var{num} is prefixed with a @samp{+}, start printing with +byte @var{num} from the start of each file, instead of from the end. +@multiplierSuffixes{num} @item -f @itemx --follow[=@var{how}] @@ -2603,8 +2911,10 @@ If you'd like to continue to track the end of a growing file even after it has been unlinked, use @option{--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 -@option{--follow=name} to track the named file by reopening it periodically -to see if it has been removed and recreated by some other program. +@option{--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, @command{tail} prints a message saying the file has been truncated @@ -2623,9 +2933,22 @@ growing. The option values @samp{descriptor} and @samp{name} may be specified only with the long form of the option, not with @option{-f}. -@vindex POSIXLY_CORRECT -If @env{POSIXLY_CORRECT} is set, the @option{-f} option is ignored if +The @option{-f} option is ignored if no @var{file} operand is specified and standard input is a FIFO or a pipe. +Likewise, the @option{-f} option has no effect for any +operand specified as @samp{-}, 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, @command{tail} sleeps for one second between checks--- +use @option{--sleep-interval=@var{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: + +@example +alias tail='tail -s.1' +@end example @item -F @opindex -F @@ -2633,25 +2956,29 @@ This option is the same as @option{--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. -@itemx --retry -@opindex --retry -This option is useful mainly when following by name (i.e., with -@option{--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. +@item --max-unchanged-stats=@var{n} +@opindex --max-unchanged-stats +When tailing a file by name, if there have been @var{n} (default +n=@value{DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS}) consecutive +iterations for which the file has not changed, then +@code{open}/@code{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. -@itemx --sleep-interval=@var{number} -@opindex --sleep-interval -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 @command{tail} have required that -@var{number} be an integer. However, GNU @command{tail} accepts -an arbitrary floating point number (using a period before any -fractional digits). +@item -n [+]@var{num} +@itemx --lines=[+]@var{} +@opindex -n +@opindex --lines +Output the last @var{num} lines. +However, if @var{num} is prefixed with a @samp{+}, start printing with +line @var{num} from the start of each file, instead of from the end. +Size multiplier suffixes are the same as with the @option{-c} option. -@itemx --pid=@var{pid} +@item --pid=@var{pid} @opindex --pid When following by name or by descriptor, you may specify the process ID, @var{pid}, of the sole writer of all @var{file} arguments. Then, shortly @@ -2674,24 +3001,6 @@ terminate until long after the real writer has terminated. Note that @option{--pid} cannot be supported on some systems; @command{tail} will print a warning if this is the case. -@itemx --max-unchanged-stats=@var{n} -@opindex --max-unchanged-stats -When tailing a file by name, if there have been @var{n} (default -n=@value{DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS}) consecutive -iterations for which the file has not changed, then -@code{open}/@code{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 following by name. - -@itemx -n @var{n} -@itemx --lines=@var{n} -@opindex -n -@opindex --lines -Output the last @var{n} lines. - @item -q @itemx --quiet @itemx --silent @@ -2700,19 +3009,52 @@ Output the last @var{n} lines. @opindex --silent Never print file name headers. +@item --retry +@opindex --retry +Indefinitely try to open the specified file. +This option is useful mainly when following (and otherwise issues a warning). + +When following by file descriptor (i.e., with @option{--follow=descriptor}), +this option only affects the initial open of the file, as after a successful +open, @command{tail} will start following the file descriptor. + +When following by name (i.e., with @option{--follow=name}), @command{tail} +infinitely retries to re-open the given files until killed. + +Without this option, when @command{tail} encounters a file that doesn't +exist or is otherwise inaccessible, it reports that fact and +never checks it again. + +@item -s @var{number} +@itemx --sleep-interval=@var{number} +@opindex -s +@opindex --sleep-interval +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 @command{tail} have required that +@var{number} be an integer. However, GNU @command{tail} accepts +an arbitrary floating point number. @xref{Floating point}. +When @command{tail} uses inotify, this polling-related option +is usually ignored. However, if you also specify @option{--pid=@var{p}}, +@command{tail} checks whether process @var{p} is alive at least +every @var{number} seconds. + @item -v @itemx --verbose @opindex -v @opindex --verbose Always print file name headers. +@optZeroTerminated + @end table For compatibility @command{tail} also supports an obsolete usage -@samp{tail -[@var{count}][bcl][f] [@var{file}]}, which is recognized +@samp{tail -[@var{num}][bcl][f] [@var{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, @var{count} is an optional decimal number optionally +file. In the option, @var{num} is an optional decimal number optionally followed by a size letter (@samp{b}, @samp{c}, @samp{l}) to mean count by 512-byte blocks, bytes, or lines, optionally followed by @samp{f} which has the same meaning as @option{-f}. @@ -2726,8 +3068,8 @@ This obsolete behavior can be enabled or disabled with the conformance}). Scripts intended for use on standard hosts should avoid obsolete -syntax and should use @option{-c @var{count}[b]}, @option{-n -@var{count}}, and/or @option{-f} instead. If your script must also +syntax and should use @option{-c @var{num}[b]}, @option{-n +@var{num}}, and/or @option{-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 @samp{sed -n '$p'} rather than @samp{tail -1}. If that's not possible, the script @@ -2735,7 +3077,7 @@ can use a test like @samp{if tail -c +1 </dev/null >/dev/null 2>&1; then @dots{}} 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 @acronym{POSIX} +beware usages whose behaviors differ depending on the POSIX version. For example, avoid @samp{tail - main.c}, since it might be interpreted as either @samp{tail main.c} or as @samp{tail -- - main.c}; avoid @samp{tail -c 4}, since it might mean either @samp{tail @@ -2746,15 +3088,15 @@ mean either @samp{tail ./+4} or @samp{tail -n +4}. @node split invocation -@section @command{split}: Split a file into fixed-size pieces +@section @command{split}: Split a file into pieces. @pindex split @cindex splitting a file into pieces @cindex pieces, splitting a file into -@command{split} creates output files containing consecutive sections of -@var{input} (standard input if none is given or @var{input} is -@samp{-}). Synopsis: +@command{split} creates output files containing consecutive or interleaved +sections of @var{input} (standard input if none is given or @var{input} +is @samp{-}). Synopsis: @example split [@var{option}] [@var{input} [@var{prefix}]] @@ -2767,64 +3109,232 @@ left over for the last section), into each output file. The output files' names consist of @var{prefix} (@samp{x} by default) followed by a group of characters (@samp{aa}, @samp{ab}, @dots{} by default), such that concatenating the output files in traditional -sorted order by file name produces -the original input file. If the output file names are exhausted, -@command{split} reports an error without deleting the output files -that it did create. +sorted order by file name produces the original input file (except +@option{-nr/@var{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. +(@samp{yz}, @samp{zaaa}, @samp{zaab}, @dots{}). In this way an arbitrary +number of output files are supported, which sort as described above, +even in the presence of an @option{--additional-suffix} option. +If the @option{-a} option is specified and the output file names are +exhausted, @command{split} reports an error without deleting the +output files that it did create. The program accepts the following options. Also see @ref{Common options}. @table @samp -@item -a @var{length} -@itemx --suffix-length=@var{length} -@opindex -a -@opindex --suffix-length -Use suffixes of length @var{length}. The default @var{length} is 2. - @item -l @var{lines} @itemx --lines=@var{lines} @opindex -l @opindex --lines Put @var{lines} lines of @var{input} into each output file. +If @option{--separator} is specified, then @var{lines} determines +the number of records. For compatibility @command{split} also supports an obsolete -option syntax @option{-@var{lines}}. New scripts should use @option{-l -@var{lines}} instead. +option syntax @option{-@var{lines}}. New scripts should use +@option{-l @var{lines}} instead. -@item -b @var{bytes} -@itemx --bytes=@var{bytes} +@item -b @var{size} +@itemx --bytes=@var{size} @opindex -b @opindex --bytes -Put the first @var{bytes} bytes of @var{input} into each output file. -Appending @samp{b} multiplies @var{bytes} by 512, @samp{k} by 1024, and -@samp{m} by 1048576. +Put @var{size} bytes of @var{input} into each output file. +@multiplierSuffixes{size} -@item -C @var{bytes} -@itemx --line-bytes=@var{bytes} +@item -C @var{size} +@itemx --line-bytes=@var{size} @opindex -C @opindex --line-bytes Put into each output file as many complete lines of @var{input} as -possible without exceeding @var{bytes} bytes. For lines longer than -@var{bytes} bytes, put @var{bytes} bytes into each output file until -less than @var{bytes} bytes of the line are left, then continue -normally. @var{bytes} has the same format as for the @option{--bytes} -option. +possible without exceeding @var{size} bytes. Individual lines or records +longer than @var{size} bytes are broken into multiple files. +@var{size} has the same format as for the @option{--bytes} option. +If @option{--separator} is specified, then @var{lines} determines +the number of records. + +@item --filter=@var{command} +@opindex --filter +With this option, rather than simply writing to each output file, +write through a pipe to the specified shell @var{command} for each output file. +@var{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: + +@example +xz -dc BIG.xz | split -b200G --filter='xz > $FILE.xz' - big- +@end example + +Assuming a 10:1 compression ratio, that would create about fifty 20GiB files +with names @file{big-aa.xz}, @file{big-ab.xz}, @file{big-ac.xz}, etc. + +@item -n @var{chunks} +@itemx --number=@var{chunks} +@opindex -n +@opindex --number + +Split @var{input} to @var{chunks} output files where @var{chunks} may be: + +@example +@var{n} generate @var{n} files based on current size of @var{input} +@var{k}/@var{n} only output @var{k}th of @var{n} to stdout +l/@var{n} generate @var{n} files without splitting lines or records +l/@var{k}/@var{n} likewise but only output @var{k}th of @var{n} to stdout +r/@var{n} like @samp{l} but use round robin distribution +r/@var{k}/@var{n} likewise but only output @var{k}th of @var{n} to stdout +@end example + +Any excess bytes remaining after dividing the @var{input} +into @var{n} chunks, are assigned to the last chunk. +Any excess bytes appearing after the initial calculation are discarded +(except when using @samp{r} mode). + +All @var{n} files are created even if there are fewer than @var{n} lines, +or the @var{input} is truncated. + +For @samp{l} mode, chunks are approximately @var{input} size / @var{n}. +The @var{input} is partitioned into @var{n} equal sized portions, with +the last assigned any excess. If a line @emph{starts} within a partition +it is written completely to the corresponding file. Since lines or records +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/record is so long as to completely overlap the partition. + +For @samp{r} mode, the size of @var{input} is irrelevant, +and so can be a pipe for example. + +@item -a @var{length} +@itemx --suffix-length=@var{length} +@opindex -a +@opindex --suffix-length +Use suffixes of length @var{length}. If a @var{length} of 0 is specified, +this is the same as if (any previous) @option{-a} was not specified, and +thus enables the default behavior, which starts the suffix length at 2, +and unless @option{-n} or @option{--numeric-suffixes=@var{from}} is +specified, will auto increase the length by 2 as required. @item -d -@itemx --numeric-suffixes +@itemx --numeric-suffixes[=@var{from}] @opindex -d @opindex --numeric-suffixes -Use digits in suffixes rather than lower-case letters. +Use digits in suffixes rather than lower-case letters. The numerical +suffix counts from @var{from} if specified, 0 otherwise. + +@var{from} is supported with the long form option, and is used to either set the +initial suffix for a single run, or to set the suffix offset for independently +split inputs, and consequently the auto suffix length expansion described above +is disabled. Therefore you may also want to use option @option{-a} to allow +suffixes beyond @samp{99}. Note if option @option{--number} is specified and +the number of files is less than @var{from}, a single run is assumed and the +minimum suffix length required is automatically determined. + +@item --additional-suffix=@var{suffix} +@opindex --additional-suffix +Append an additional @var{suffix} to output file names. @var{suffix} +must not contain slash. -@itemx --verbose +@item -e +@itemx --elide-empty-files +@opindex -e +@opindex --elide-empty-files +Suppress the generation of zero-length output files. This can happen +with the @option{--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. + +@item -t @var{separator} +@itemx --separator=@var{separator} +@opindex -t +@opindex --separator +@cindex line separator character +@cindex record separator character +Use character @var{separator} as the record separator instead of the default +newline character (ASCII LF). +To specify ASCII NUL as the separator, use the two-character string @samp{\0}, +e.g., @samp{split -t '\0'}. + +@item -u +@itemx --unbuffered +@opindex -u +@opindex --unbuffered +Immediately copy input to output in @option{--number r/@dots{}} mode, +which is a much slower mode of operation. + +@item --verbose @opindex --verbose -Write a diagnostic to standard error just before each output file is opened. +Write a diagnostic just before each output file is opened. @end table @exitstatus +Here are a few examples to illustrate how the +@option{--number} (@option{-n}) option works: + +Notice how, by default, one line may be split onto two or more: + +@example +$ seq -w 6 10 > k; split -n3 k; head xa? +==> xaa <== +06 +07 +==> xab <== + +08 +0 +==> xac <== +9 +10 +@end example + +Use the "l/" modifier to suppress that: + +@example +$ seq -w 6 10 > k; split -nl/3 k; head xa? +==> xaa <== +06 +07 + +==> xab <== +08 +09 + +==> xac <== +10 +@end example + +Use the "r/" modifier to distribute lines in a round-robin fashion: + +@example +$ seq -w 6 10 > k; split -nr/3 k; head xa? +==> xaa <== +06 +09 + +==> xab <== +07 +10 + +==> xac <== +08 +@end example + +You can also extract just the Kth chunk. +This extracts and prints just the 7th "chunk" of 33: + +@example +$ seq 100 > k; split -nl/7/33 k +20 +21 +22 +@end example + @node csplit invocation @section @command{csplit}: Split a file into context-determined pieces @@ -2901,19 +3411,20 @@ The program accepts the following options. Also see @ref{Common options}. @cindex output file name prefix Use @var{prefix} as the output file name prefix. -@item -b @var{suffix} -@itemx --suffix=@var{suffix} +@item -b @var{format} +@itemx --suffix-format=@var{format} @opindex -b -@opindex --suffix +@opindex --suffix-format @cindex output file name suffix -Use @var{suffix} as the output file name suffix. When this option is +Use @var{format} as the output file name suffix. When this option is specified, the suffix string must include exactly one @code{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 integer argument to readable form; thus, only @samp{d}, @samp{i}, +binary unsigned integer argument to readable form. The format letters +@samp{d} and @samp{i} are aliases for @samp{u}, and the @samp{u}, @samp{o}, @samp{x}, and @samp{X} conversions are allowed. The -entire @var{suffix} is given (with the current output file number) to +entire @var{format} is given (with the current output file number) to @code{sprintf(3)} to form the file name suffixes for each of the individual output files in turn. If this option is used, the @option{--digits} option is ignored. @@ -2931,6 +3442,12 @@ long instead of the default 2. @opindex --keep-files Do not remove output files when errors are encountered. +@item --suppress-matched +@opindex --suppress-matched +Do not output lines matching the specified @var{pattern}. +I.e., suppress the boundary line from the start of the second +and subsequent splits. + @item -z @itemx --elide-empty-files @opindex -z @@ -2956,6 +3473,75 @@ Do not print counts of output file sizes. @exitstatus +Here is an example of its usage. +First, create an empty directory for the exercise, +and cd into it: + +@example +$ mkdir d && cd d +@end example + +Now, split the sequence of 1..14 on lines that end with 0 or 5: + +@example +$ seq 14 | csplit - '/[05]$/' '@{*@}' +8 +10 +15 +@end example + +Each number printed above is the size of an output +file that csplit has just created. +List the names of those output files: + +@example +$ ls +xx00 xx01 xx02 +@end example + +Use @command{head} to show their contents: + +@example +$ head xx* +==> xx00 <== +1 +2 +3 +4 + +==> xx01 <== +5 +6 +7 +8 +9 + +==> xx02 <== +10 +11 +12 +13 +14 +@end example + +Example of splitting input by empty lines: + +@example +$ csplit --suppress-matched @var{input.txt} '/^$/' '@{*@}' +@end example + +@c +@c TODO: "uniq" already supports "--group". +@c when it gets the "--key" option, uncomment this example. +@c +@c Example of splitting input file, based on the value of column 2: +@c +@c @example +@c $ cat @var{input.txt} | +@c sort -k2,2 | +@c uniq --group -k2,2 | +@c csplit -m '/^$/' '@{*@}' +@c @end example @node Summarizing files @chapter Summarizing files @@ -3003,7 +3589,7 @@ 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 @acronym{GNU} extension, if only one count is printed, +However, as a GNU extension, if only one count is printed, it is guaranteed to be printed without leading spaces. By default, @command{wc} prints three counts: the newline, words, and byte @@ -3019,7 +3605,9 @@ prints both the byte counts and the word counts. With the @option{--max-line-length} option, @command{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. +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 @ref{Common options}. @@ -3053,30 +3641,42 @@ Print only the newline counts. @itemx --max-line-length @opindex -L @opindex --max-line-length -Print only the maximum line lengths. - -@itemx --files0-from=@var{FILE} -@opindex --files0-from=@var{FILE} -@cindex including files from @command{du} -Rather than processing files named on the command line, process those -named in file @var{FILE}; each name is terminated by a null byte. -This is useful when -the list of file names is so long that it may exceed a command line +Print only the maximum display widths. +Tabs are set at every 8th column. +Display widths of wide characters are considered. +Non-printable characters are given 0 width. + +@macro filesZeroFromOption{cmd,withTotalOption,subListOutput} +@item --files0-from=@var{file} +@opindex --files0-from=@var{file} +@c This is commented out to avoid a texi2dvi failure. +@c texi2dvi (GNU Texinfo 4.11) 1.104 +@c @cindex including files from @command{\cmd\} +Disallow processing files named on the command line, and instead process +those named in file @var{file}; each name being terminated by a zero byte +(ASCII NUL). +This is useful \withTotalOption\ +when the list of file names is so long that it may exceed a command line length limitation. -In such cases, running @command{wc} via @command{xargs} is undesirable -because it splits the list into pieces and makes @command{wc} print a -total for each sublist rather than for the entire list. -One way to produce a list of null-byte-terminated file names is with @sc{gnu} -@command{find}, using its @option{-print0} predicate. For example, to find -the length of the longest line in any @file{.c} or @file{.h} file in the -current hierarchy, do this: +In such cases, running @command{\cmd\} via @command{xargs} is undesirable +because it splits the list into pieces and makes @command{\cmd\} print +\subListOutput\ for each sublist rather than for the entire list. +One way to produce a list of ASCII NUL terminated file +names is with GNU +@command{find}, using its @option{-print0} predicate. +If @var{file} is @samp{-} then the ASCII NUL terminated +file names are read from standard input. +@end macro +@filesZeroFromOption{wc,,a total} + +For example, to find the length of the longest line in any @file{.c} or +@file{.h} file in the current hierarchy, do this: @example -find . -name '*.[ch]' -print0 | wc -L --files0-from=- | tail -n1 +find . -name '*.[ch]' -print0 | + wc -L --files0-from=- | tail -n1 @end example -Do not specify any @var{FILE} on the command line when using this option. - @end table @exitstatus @@ -3102,7 +3702,7 @@ is given, file names are also printed (by default). (With the @option{--sysv} option, corresponding file names are printed when there is at least one file argument.) -By default, @sc{gnu} @command{sum} computes checksums using an algorithm +By default, GNU @command{sum} computes checksums using an algorithm compatible with BSD @command{sum} and prints file sizes in units of 1024-byte blocks. @@ -3157,7 +3757,7 @@ by comparing the @command{cksum} output for the received files with the @command{cksum} output for the original files (typically given in the distribution). -The CRC algorithm is specified by the @acronym{POSIX} standard. It is not +The CRC algorithm is specified by the POSIX standard. It is not compatible with the BSD or System V @command{sum} algorithms (see the previous section); it is more robust. @@ -3183,14 +3783,12 @@ options}. Note: The MD5 digest is more reliable than a simple CRC (provided by the @command{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 truly -secure against malicious tampering: although finding a file with a -given MD5 fingerprint, or modifying a file so as to retain its MD5 are -considered infeasible at the moment, it is known how to produce -different files with identical MD5 (a ``collision''), something which -can be a security issue in certain contexts. For more secure hashes, -consider using SHA-1 or SHA-2. @xref{sha1sum invocation}, and -@ref{sha2 utilities}. +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. @xref{sha2 utilities}. If a @var{file} is specified as @samp{-} or if no files are given @command{md5sum} computes the checksum for the standard input. @@ -3201,8 +3799,11 @@ consistent. Synopsis: md5sum [@var{option}]@dots{} [@var{file}]@dots{} @end example -For each @var{file}, @samp{md5sum} outputs the MD5 checksum, a flag -indicating a binary or text input file, and the file name. +For each @var{file}, @samp{md5sum} outputs by default, the MD5 checksum, +a space, a flag indicating binary or text input mode, and the file name. +Binary mode is indicated with @samp{*}, text mode with @samp{ } (space). +Binary mode is the default on systems where it's significant, +otherwise text mode is the default. If @var{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 @@ -3220,8 +3821,8 @@ The program accepts the following options. Also see @ref{Common options}. @cindex binary input files Treat each input file as binary, by reading it in binary mode and outputting a @samp{*} flag. This is the inverse of @option{--text}. -On systems like @acronym{GNU} that do not distinguish between binary -and text files, this option merely flags each input file as binary: +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. @@ -3233,9 +3834,11 @@ Read file names and checksum information (not data) from each whether the checksums match the contents of the named files. The input to this mode of @command{md5sum} is usually the output of a prior, checksum-generating run of @samp{md5sum}. -Each valid line of input consists of an MD5 checksum, a binary/text -flag, and then a file name. -Binary files are marked with @samp{*}, text with @samp{ }. +Three input formats are supported. Either the default output +format described above, the @option{--tag} output format, +or the BSD reversed mode format which is similar to the default mode, +but doesn't use a character to distinguish binary and text modes. +@sp 1 For each such line, @command{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 @@ -3250,7 +3853,24 @@ an MD5 checksum inconsistent with the associated file, or if no valid line is found, @command{md5sum} exits with nonzero status. Otherwise, it exits successfully. -@itemx --status +@item --ignore-missing +@opindex --ignore-missing +@cindex verifying MD5 checksums +This option is useful only when verifying checksums. +When verifying checksums, don't fail or report any status +for missing files. This is useful when verifying a subset +of downloaded files given a larger list of checksums. + +@item --quiet +@opindex --quiet +@cindex verifying MD5 checksums +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. + +@item --status @opindex --status @cindex verifying MD5 checksums This option is useful only when verifying checksums. @@ -3262,6 +3882,17 @@ 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. +@item --tag +@opindex --tag +@cindex BSD output +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 @samp{\} +at the start of the line, being used. +The @option{--tag} option implies binary mode, and is disallowed with +@option{--text} mode as supporting that would unnecessarily complicate +the output format, while providing little benefit. + @item -t @itemx --text @opindex -t @@ -3269,10 +3900,10 @@ indicating there was a failure. @cindex text input files Treat each input file as text, by reading it in text mode and outputting a @samp{ } flag. This is the inverse of @option{--binary}. -This option is the default on systems like @acronym{GNU} that do not +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. +terminal. This mode is never defaulted to if @option{--tag} is used. @item -w @itemx --warn @@ -3283,6 +3914,13 @@ 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. +@item --strict +@opindex --strict +@cindex verifying MD5 checksums +When verifying checksums, +if one or more input line is invalid, +exit nonzero after all warnings have been issued. + @end table @exitstatus @@ -3339,12 +3977,10 @@ The commands @command{sha224sum}, @command{sha256sum}, @command{sha384sum} and @command{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 @command{md5sum}. +these commands are precisely the same as for @command{md5sum} +and @command{sha1sum}. @xref{md5sum invocation}. -Note: The SHA384 and SHA512 digests are considerably slower to -compute, especially on 32-bit computers, than SHA224 or SHA256. - @node Operating on sorted files @chapter Operating on sorted files @@ -3361,7 +3997,6 @@ These commands work with (or produce) sorted files. * comm invocation:: Compare two sorted files line by line. * ptx invocation:: Produce a permuted index of file contents. * tsort invocation:: Topological sort. -* tsort background:: Where tsort came from. @end menu @@ -3380,6 +4015,42 @@ output. Synopsis: sort [@var{option}]@dots{} [@var{file}]@dots{} @end example +@cindex sort stability +@cindex sort's last-resort comparison +Many options affect how @command{sort} compares lines; if the results +are unexpected, try the @option{--debug} option to see what happened. +A pair of lines is compared as follows: +@command{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, @command{sort} uses a default key of +the entire line. Finally, as a last resort when all keys compare +equal, @command{sort} compares entire lines as if no ordering options +other than @option{--reverse} (@option{-r}) were specified. The +@option{--stable} (@option{-s}) option disables this @dfn{last-resort +comparison} so that lines in which all fields compare equal are left +in their original relative order. The @option{--unique} +(@option{-u}) option also disables the last-resort comparison. +@vindex LC_ALL +@vindex LC_COLLATE + +Unless otherwise specified, all comparisons use the character collating +sequence specified by the @env{LC_COLLATE} locale.@footnote{If you +use a non-POSIX locale (e.g., by setting @env{LC_ALL} +to @samp{en_US}), then @command{sort} may produce output that is sorted +differently than you're accustomed to. In that case, set the @env{LC_ALL} +environment variable to @samp{C}@. Note that setting only @env{LC_COLLATE} +has two problems. First, it is ineffective if @env{LC_ALL} is also set. +Second, it has undefined behavior if @env{LC_CTYPE} (or @env{LANG}, if +@env{LC_CTYPE} is unset) is set to an incompatible value. For example, +you get undefined behavior if @env{LC_CTYPE} is @code{ja_JP.PCK} but +@env{LC_COLLATE} is @code{en_US.UTF-8}.} +A line's trailing newline is not part of the line for comparison +purposes. If the final byte of an input file is not a newline, GNU +@command{sort} silently supplies one. GNU @command{sort} (as +specified for all GNU utilities) has no limit on input line length or +restrictions on bytes allowed within lines. + @command{sort} has three modes of operation: sort (the default), merge, and check for sortedness. The following options change the operation mode: @@ -3421,41 +4092,6 @@ works. @end table -@cindex sort stability -@cindex sort's last-resort comparison -A pair of lines is compared as follows: -@command{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, @command{sort} uses a default key of -the entire line. Finally, as a last resort when all keys compare -equal, @command{sort} compares entire lines as if no ordering options -other than @option{--reverse} (@option{-r}) were specified. The -@option{--stable} (@option{-s}) option disables this @dfn{last-resort -comparison} so that lines in which all fields compare equal are left -in their original relative order. The @option{--unique} -(@option{-u}) option also disables the last-resort comparison. - -@vindex LC_ALL -@vindex LC_COLLATE -Unless otherwise specified, all comparisons use the character collating -sequence specified by the @env{LC_COLLATE} locale.@footnote{If you -use a non-@acronym{POSIX} locale (e.g., by setting @env{LC_ALL} -to @samp{en_US}), then @command{sort} may produce output that is sorted -differently than you're accustomed to. In that case, set the @env{LC_ALL} -environment variable to @samp{C}. Note that setting only @env{LC_COLLATE} -has two problems. First, it is ineffective if @env{LC_ALL} is also set. -Second, it has undefined behavior if @env{LC_CTYPE} (or @env{LANG}, if -@env{LC_CTYPE} is unset) is set to an incompatible value. For example, -you get undefined behavior if @env{LC_CTYPE} is @code{ja_JP.PCK} but -@env{LC_COLLATE} is @code{en_US.UTF-8}.} - -@sc{gnu} @command{sort} (as specified for all @sc{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, @sc{gnu} -@command{sort} silently supplies one. A line's trailing newline is not -part of the line for comparison purposes. - @cindex exit status of @command{sort} Exit status: @@ -3475,7 +4111,7 @@ 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-@acronym{POSIX} +not specify any special options of their own. In pre-POSIX versions of @command{sort}, global options affect only later key fields, so portable shell scripts should specify global options first. @@ -3489,7 +4125,9 @@ so portable shell scripts should specify global options first. @vindex LC_CTYPE Ignore leading blanks when finding sort keys in each line. By default a blank is a space or a tab, but the @env{LC_CTYPE} locale -can change this. +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 @option{-k} option. @item -d @itemx --dictionary-order @@ -3501,7 +4139,7 @@ can change this. @vindex LC_CTYPE Sort in @dfn{phone directory} order: ignore all characters except letters, digits and blanks when sorting. -By default letters and digits are those of @acronym{ASCII} and a blank +By default letters and digits are those of ASCII and a blank is a space or a tab, but the @env{LC_CTYPE} locale can change this. @item -f @@ -3514,18 +4152,21 @@ is a space or a tab, but the @env{LC_CTYPE} locale can change this. Fold lowercase characters into the equivalent uppercase characters when comparing so that, for example, @samp{b} and @samp{B} sort as equal. The @env{LC_CTYPE} locale determines character types. +When used with @option{--unique} those lower case equivalent lines are +thrown away. (There is currently no way to throw away the upper case +equivalent instead. (Any @option{--reverse} given would only affect +the final result, after the throwing away.)) @item -g @itemx --general-numeric-sort +@itemx --sort=general-numeric @opindex -g @opindex --general-numeric-sort +@opindex --sort @cindex general numeric sort @vindex LC_NUMERIC -Sort numerically, using the standard C function @code{strtod} to convert -a prefix of each line to a double-precision floating point number. -This allows floating point numbers to be specified in scientific notation, -like @code{1.0e-34} and @code{10e100}. -The @env{LC_NUMERIC} locale determines the decimal-point character. +Sort numerically, converting a prefix of each line to a long +double-precision floating point number. @xref{Floating point}. Do not report overflow, underflow, or conversion errors. Use the following collating sequence: @@ -3547,6 +4188,30 @@ Use this option only if there is no alternative; it is much slower than @option{--numeric-sort} (@option{-n}) and it can lose information when converting to floating point. +@item -h +@itemx --human-numeric-sort +@itemx --sort=human-numeric +@opindex -h +@opindex --human-numeric-sort +@opindex --sort +@cindex human numeric sort +@vindex LC_NUMERIC +Sort numerically, first by numeric sign (negative, zero, or positive); +then by SI suffix (either empty, or @samp{k} or @samp{K}, or +one of @samp{MGTPEZY}, in that order; @pxref{Block size}); and finally +by numeric value. For example, @samp{1023M} sorts before @samp{1G} +because @samp{M} (mega) precedes @samp{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 @command{df}, @command{du}, or @command{ls} commands that are +invoked with their @option{--human-readable} or @option{--si} options. +The syntax for numbers is the same as for the @option{--numeric-sort} +option; the SI suffix must immediately follow the number. +Note also the @command{numfmt} command, which can be used to reformat +numbers to human format @emph{after} the sort, thus often allowing +sort to operate on more accurate numbers. + @item -i @itemx --ignore-nonprinting @opindex -i @@ -3561,13 +4226,15 @@ This option has no effect if the stronger @option{--dictionary-order} @item -M @itemx --month-sort +@itemx --sort=month @opindex -M @opindex --month-sort +@opindex --sort @cindex months, sorting by @vindex LC_TIME 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 @samp{JAN} < @samp{FEB} < @dots{} < @samp{DEC}. +compared in the order @samp{JAN} < @samp{FEB} < @dots{} < @samp{DEC}@. Invalid names compare low to valid names. The @env{LC_TIME} locale category determines the month spellings. By default a blank is a space or a tab, but the @env{LC_CTYPE} locale @@ -3575,8 +4242,10 @@ can change this. @item -n @itemx --numeric-sort +@itemx --sort=numeric @opindex -n @opindex --numeric-sort +@opindex --sort @cindex numeric sort @vindex LC_NUMERIC Sort numerically. The number begins each line and consists @@ -3594,6 +4263,15 @@ Neither a leading @samp{+} nor exponential notation is recognized. To compare such strings numerically, use the @option{--general-numeric-sort} (@option{-g}) option. +@item -V +@itemx --version-sort +@opindex -V +@opindex --version-sort +@cindex version number 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. (@xref{Details about version sort}.) + @item -r @itemx --reverse @opindex -r @@ -3604,8 +4282,10 @@ appear earlier in the output instead of later. @item -R @itemx --random-sort +@itemx --sort=random @opindex -R @opindex --random-sort +@opindex --sort @cindex random sort Sort by hashing the input keys and then sorting the hash values. Choose the hash function at random, ensuring that it is free of @@ -3636,9 +4316,11 @@ standard input to standard output. Terminate with an error if @var{prog} exits with nonzero status. -Whitespace and the backslash character should not appear in +White space and the backslash character should not appear in @var{prog}; they are reserved for future use. +@filesZeroFromOption{sort,,sorted output} + @item -k @var{pos1}[,@var{pos2}] @itemx --key=@var{pos1}[,@var{pos2}] @opindex -k @@ -3660,7 +4342,40 @@ according to different rules; see below for details. Keys can span multiple fields. Example: To sort on the second field, use @option{--key=2,2} -(@option{-k 2,2}). See below for more examples. +(@option{-k 2,2}). See below for more notes on keys and more examples. +See also the @option{--debug} option to help determine the part +of the line being used in the sort. + +@item --debug +Highlight the portion of each line used for sorting. +Also issue warnings about questionable usage to stderr. + +@item --batch-size=@var{nmerge} +@opindex --batch-size +@cindex number of inputs to merge, nmerge +Merge at most @var{nmerge} inputs at once. + +When @command{sort} has to merge more than @var{nmerge} inputs, +it merges them in groups of @var{nmerge}, saving the result in +a temporary file, which is then used as an input in a subsequent merge. + +A large value of @var{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 @var{nmerge} may reduce memory +requirements and I/O at the expense of temporary storage consumption and +merge performance. + +The value of @var{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 @var{nmerge} may be bounded by a resource limit for open +file descriptors. The commands @samp{ulimit -n} or @samp{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 @var{nmerge} exceeds the resource limit, @command{sort} +silently uses a smaller value. @item -o @var{output-file} @itemx --output=@var{output-file} @@ -3670,7 +4385,7 @@ Example: To sort on the second field, use @option{--key=2,2} Write output to @var{output-file} instead of standard output. Normally, @command{sort} reads all input before opening @var{output-file}, so you can safely sort a file in place by using -commands like @code{sort -o F F} and @code{cat F | sort -o F}. +commands like @code{sort -o F F} and @code{cat F | sort -o F}@. However, @command{sort} with @option{--merge} (@option{-m}) can open the output file before reading all input, so a command like @code{cat F | sort -m -o F - G} is not safe as @command{sort} might start @@ -3678,7 +4393,7 @@ writing @file{F} before @command{cat} is done reading it. @vindex POSIXLY_CORRECT On newer systems, @option{-o} cannot appear after an input file if -@env{POSIXLY_CORRECT} is set, e.g., @samp{sort F -o F}. Portable +@env{POSIXLY_CORRECT} is set, e.g., @samp{sort F -o F}@. Portable scripts should specify @option{-o @var{output-file}} before any input files. @@ -3710,7 +4425,7 @@ Use a main-memory sort buffer of the given @var{size}. By default, @var{size} to be interpreted as a percentage of physical memory. Appending @samp{K} multiplies @var{size} by 1024 (the default), @samp{M} by 1,048,576, @samp{G} by 1,073,741,824, and so on for -@samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}. Appending +@samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}@. Appending @samp{b} causes @var{size} to be interpreted as a byte count, with no multiplication. @@ -3740,9 +4455,8 @@ However, fields that extend to the end of the line, as @option{-k 2}, or fields consisting of a range, as @option{-k 2,3}, retain the field separators present between the endpoints of the range. -To specify a null character (@acronym{ASCII} @sc{nul}) as -the field separator, use the two-character string @samp{\0}, e.g., -@samp{sort -t '\0'}. +To specify ASCII NUL as the field separator, +use the two-character string @samp{\0}, e.g., @samp{sort -t '\0'}. @item -T @var{tempdir} @itemx --temporary-directory=@var{tempdir} @@ -3757,6 +4471,15 @@ 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. +@item --parallel=@var{n} +@opindex --parallel +@cindex multithreaded sort +Set the number of sorts run in parallel to @var{n}. By default, +@var{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 @var{n} threads increases the memory usage by +a factor of log @var{n}. Also see @ref{nproc invocation}. + @item -u @itemx --unique @opindex -u @@ -3775,40 +4498,33 @@ For example, @code{sort -n -u} inspects only the value of the initial numeric string when checking for uniqueness, whereas @code{sort -n | uniq} inspects the entire line. @xref{uniq invocation}. -@item -z -@itemx --zero-terminated -@opindex -z -@opindex --zero-terminated -@cindex sort zero-terminated lines -Treat the input as a set of lines, each terminated by a null character -(@acronym{ASCII} @sc{nul}) instead of a line feed -(@acronym{ASCII} @sc{lf}). -This option can be useful in conjunction with @samp{perl -0} or -@samp{find -print0} and @samp{xargs -0} which do the same in order to -reliably handle arbitrary file names (even those containing blanks -or other special characters). +@optZeroTerminated +@macro newlineFieldSeparator +Note with @option{-z} the newline character is treated as a field separator. +@end macro @end table Historical (BSD and System V) implementations of @command{sort} have differed in their interpretation of some options, particularly -@option{-b}, @option{-f}, and @option{-n}. @sc{gnu} sort follows the @acronym{POSIX} +@option{-b}, @option{-f}, and @option{-n}. +GNU sort follows the POSIX behavior, which is usually (but not always!) like the System V behavior. -According to @acronym{POSIX}, @option{-n} no longer implies @option{-b}. For +According to POSIX, @option{-n} no longer implies @option{-b}. For consistency, @option{-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 @option{-b}. A position in a sort field specified with @option{-k} may have any -of the option letters @samp{Mbdfinr} appended to it, in which case the -global ordering options are not used for that particular field. The +of the option letters @samp{MbdfghinRrV} appended to it, in which case no +global ordering options are inherited by that particular field. The @option{-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 @option{-t} -is not used, then @option{-k} is typically combined with @option{-b}, -@option{-g}, @option{-M}, or @option{-n}; otherwise the varying -numbers of leading blanks in fields can cause confusing results. +is not used, then @option{-k} is typically combined with @option{-b} or +an option that implicitly ignores leading blanks (@samp{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 @option{-b} @@ -3819,6 +4535,11 @@ is counted from the first nonblank character of the field. @vindex POSIXLY_CORRECT On older systems, @command{sort} supports an obsolete origin-zero syntax @samp{+@var{pos1} [-@var{pos2}]} for specifying sort keys. +The obsolete sequence @samp{sort +@var{a}.@var{x} -@var{b}.@var{y}} +is equivalent to @samp{sort -k @var{a+1}.@var{x+1},@var{b}} if @var{y} +is @samp{0} or absent, otherwise it is equivalent to @samp{sort -k +@var{a+1}.@var{x+1},@var{b+1}.@var{y}}. + This obsolete behavior can be enabled or disabled with the @env{_POSIX2_VERSION} environment variable (@pxref{Standards conformance}); it can also be enabled when @env{POSIXLY_CORRECT} is @@ -3844,6 +4565,13 @@ sort -n -r @end example @item +Run no more than 4 sorts concurrently, using a buffer size of 10M. + +@example +sort --parallel=4 -S 10M +@end example + +@item 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 @@ -3950,10 +4678,24 @@ by the sort operation. @c and converting each @samp{\0} back to the original record delimiter. @c @c @example -@c printf 'c\n\nb\n\na\n'|perl -0pe 's/\n\n/\n\0/g'|sort -z|perl -0pe 's/\0/\n/g' +@c printf 'c\n\nb\n\na\n' | +@c perl -0pe 's/\n\n/\n\0/g' | +@c sort -z | +@c perl -0pe 's/\0/\n/g' @c @end example @item +Use the common DSU, Decorate Sort Undecorate idiom to +sort lines according to their length. + +@example +awk '@{print length, $0@}' /etc/passwd | sort -n | cut -f2- -d' ' +@end example + +In general this technique can be used to sort data that the @command{sort} +command does not support, or is inefficient at, sorting directly. + +@item 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 @@ -4010,12 +4752,12 @@ operation modes: @table @samp -@item -n @var{lines} -@itemx --head-lines=@var{lines} +@item -n @var{count} +@itemx --head-count=@var{count} @opindex -n -@opindex --head-lines +@opindex --head-count @cindex head of output -Output at most @var{lines} lines. By default, all input lines are +Output at most @var{count} lines. By default, all input lines are output. @item -o @var{output-file} @@ -4034,18 +4776,19 @@ commands like @code{shuf -o F <F} and @code{cat F | shuf -o F}. Use @var{file} as a source of random data used to determine which permutation to generate. @xref{Random sources}. -@item -z -@itemx --zero-terminated -@opindex -z -@opindex --zero-terminated -@cindex sort zero-terminated lines -Treat the input and output as a set of lines, each terminated by a zero byte -(@acronym{ASCII} @sc{nul} (Null) character) instead of an -@acronym{ASCII} @sc{lf} (Line Feed). -This option can be useful in conjunction with @samp{perl -0} or -@samp{find -print0} and @samp{xargs -0} which do the same in order to -reliably handle arbitrary file names (even those containing blanks -or other special characters). +@item -r +@itemx --repeat +@opindex -r +@opindex --repeat +@cindex repeat output values +Repeat output values, that is, select with replacement. With this +option the output is not a permutation of the input; instead, each +output line is randomly chosen from all the inputs. This option is +typically combined with @option{--head-count}; if +@option{--head-count} is not given, @command{shuf} repeats +indefinitely. + +@optZeroTerminated @end table @@ -4098,12 +4841,26 @@ and the command @samp{shuf -i 1-4} might output: @end example @noindent -These examples all have four input lines, so @command{shuf} might +The above examples all have four input lines, so @command{shuf} might produce any of the twenty-four possible permutations of the input. In -general, if there are @var{N} input lines, there are @var{N}! (i.e., -@var{N} factorial, or @var{N} * (@var{N} - 1) * @dots{} * 1) possible +general, if there are @var{n} input lines, there are @var{n}! (i.e., +@var{n} factorial, or @var{n} * (@var{n} - 1) * @dots{} * 1) possible output permutations. +@noindent +To output 50 random numbers each in the range 0 through 9, use: + +@example +shuf -r -n 50 -i 0-9 +@end example + +@noindent +To simulate 100 coin flips, use: + +@example +shuf -r -n 100 -e Head Tail +@end example + @exitstatus @@ -4132,8 +4889,8 @@ duplicate lines, perhaps you want to use @code{sort -u}. @xref{sort invocation}. @vindex LC_COLLATE -Comparisons use the character collating sequence specified by the -@env{LC_COLLATE} locale category. +Comparisons honor the rules specified by the @env{LC_COLLATE} +locale category. If no @var{output} file is specified, @command{uniq} writes to standard output. @@ -4202,8 +4959,9 @@ Do not discard the second and subsequent repeated input lines, but discard lines that are not repeated. This option is useful mainly in conjunction with other options e.g., to ignore case or to compare only selected fields. -The optional @var{delimit-method} tells how to delimit -groups of repeated lines, and must be one of the following: +The optional @var{delimit-method}, supported with the long form option, +specifies how to delimit groups of repeated lines, and must be one of the +following: @table @samp @@ -4213,29 +4971,68 @@ This is equivalent to @option{--all-repeated} (@option{-D}). @item prepend Output a newline before each group of repeated lines. +@macro nulOutputNote +With @option{--zero-terminated} (@option{-z}), use a zero +byte (ASCII NUL) instead of a newline as the delimiter. +@end macro +@nulOutputNote @item separate Separate groups of repeated lines with a single newline. This is the same as using @samp{prepend}, except that -there is no newline before the first group, and hence +no delimiter is inserted before the first group, and hence may be better suited for output direct to users. +@nulOutputNote @end table +@macro ambiguousGroupNote Note that when groups are delimited and the input stream contains -two or more consecutive blank lines, then the output is ambiguous. -To avoid that, filter the input through @samp{tr -s '\n'} to replace -each sequence of consecutive newlines with a single newline. +blank lines, then the output is ambiguous. +To avoid that, filter the input through @samp{tr -s '\\n'} to +remove blank lines. +@end macro +@ambiguousGroupNote -This is a @sc{gnu} extension. +This is a GNU extension. @c FIXME: give an example showing *how* it's useful +@item --group[=@var{delimit-method}] +@opindex --group +@cindex all lines, grouping +Output all lines, and delimit each unique group. +@nulOutputNote +The optional @var{delimit-method} specifies how to delimit +groups, and must be one of the following: + +@table @samp + +@item separate +Separate unique groups with a single delimiter. +This is the default delimiting method if none is specified, +and better suited for output direct to users. + +@item prepend +Output a delimiter before each group of unique items. + +@item append +Output a delimiter after each group of unique items. + +@item both +Output a delimiter around each group of unique items. +@end table + +@ambiguousGroupNote + +This is a GNU extension. + @item -u @itemx --unique @opindex -u @opindex --unique @cindex unique lines, outputting -Discard the first repeated line. When used by itself, this option -causes @command{uniq} to print unique lines, and nothing else. +Discard the last line that would be output for a repeated input group. +When used by itself, this option causes @command{uniq} to print unique +lines, and nothing else. @item -w @var{n} @itemx --check-chars=@var{n} @@ -4245,6 +5042,9 @@ Compare at most @var{n} characters on each line (after skipping any specified fields and characters). By default the entire rest of the lines are compared. +@optZeroTerminated +@newlineFieldSeparator + @end table @exitstatus @@ -4279,173 +5079,60 @@ contains lines unique to @var{file1}, column two contains lines unique to @var{file2}, and column three contains lines common to both files. Columns are separated by a single TAB character. @c FIXME: when there's an option to supply an alternative separator -@c string, append `by default' to the above sentence. +@c string, append "by default" to the above sentence. @opindex -1 @opindex -2 @opindex -3 The options @option{-1}, @option{-2}, and @option{-3} suppress printing of -the corresponding columns. Also see @ref{Common options}. +the corresponding columns (and separators). Also see @ref{Common options}. Unlike some other comparison utilities, @command{comm} has an exit status that does not depend on the result of the comparison. Upon normal completion @command{comm} produces an exit code of zero. If there is an error it exits with nonzero status. +@macro checkOrderOption{cmd} +If the @option{--check-order} option is given, unsorted inputs will +cause a fatal error message. If the option @option{--nocheck-order} +is given, unsorted inputs will never cause an error message. If neither +of these options is given, wrongly sorted inputs are diagnosed +only if an input file is found to contain unpairable +@ifset JOIN_COMMAND +lines, and when both input files are non empty. +@end ifset +@ifclear JOIN_COMMAND +lines. +@end ifclear +If an input file is diagnosed as being unsorted, the @command{\cmd\} +command will exit with a nonzero status (and the output should not be used). + +Forcing @command{\cmd\} to process wrongly sorted input files +containing unpairable lines by specifying @option{--nocheck-order} is +not guaranteed to produce any particular output. The output will +probably not correspond with whatever you hoped it would be. +@end macro +@checkOrderOption{comm} -@node tsort invocation -@section @command{tsort}: Topological sort - -@pindex tsort -@cindex topological sort - -@command{tsort} performs a topological sort on the given @var{file}, or -standard input if no input file is given or for a @var{file} of -@samp{-}. For more details and some history, see @ref{tsort background}. -Synopsis: - -@example -tsort [@var{option}] [@var{file}] -@end example - -@command{tsort} reads its input as pairs of strings, separated by blanks, -indicating a partial ordering. The output is a total ordering that -corresponds to the given partial ordering. - -For example - -@example -tsort <<EOF -a b c -d -e f -b c d e -EOF -@end example - -@noindent -will produce the output - -@example -a -b -c -d -e -f -@end example - -Consider a more realistic example. -You have a large set of functions all in one file, and they may all be -declared static except one. Currently that one (say @code{main}) is the -first function defined in the file, and the ones it calls directly follow -it, followed by those they call, etc. Let's say that you are determined -to take advantage of prototypes, so you have to choose between declaring -all of those functions (which means duplicating a lot of information from -the definitions) and rearranging the functions so that as many as possible -are defined before they are used. One way to automate the latter process -is to get a list for each function of the functions it calls directly. -Many programs can generate such lists. They describe a call graph. -Consider the following list, in which a given line indicates that the -function on the left calls the one on the right directly. - -@example -main parse_options -main tail_file -main tail_forever -tail_file pretty_name -tail_file write_header -tail_file tail -tail_forever recheck -tail_forever pretty_name -tail_forever write_header -tail_forever dump_remainder -tail tail_lines -tail tail_bytes -tail_lines start_lines -tail_lines dump_remainder -tail_lines file_lines -tail_lines pipe_lines -tail_bytes xlseek -tail_bytes start_bytes -tail_bytes dump_remainder -tail_bytes pipe_bytes -file_lines dump_remainder -recheck pretty_name -@end example - -then you can use @command{tsort} to produce an ordering of those -functions that satisfies your requirement. - -@example -example$ tsort call-graph | tac -dump_remainder -start_lines -file_lines -pipe_lines -xlseek -start_bytes -pipe_bytes -tail_lines -tail_bytes -pretty_name -write_header -tail -recheck -parse_options -tail_file -tail_forever -main -@end example - -@command{tsort} detects any cycles in the input and writes the first cycle -encountered to standard error. - -Note that for a given partial ordering, generally there is no unique -total ordering. In the context of the call graph above, the function -@code{parse_options} may be placed anywhere in the list as long as it -precedes @code{main}. - -The only options are @option{--help} and @option{--version}. @xref{Common -options}. - -@node tsort background -@section @command{tsort}: Background - -@command{tsort} exists because very early versions of the Unix linker processed -an archive file exactly once, and in order. As @command{ld} read each object -in the archive, it decided whether it was needed in the program based on -whether it defined any symbols which were undefined at that point in -the link. +@table @samp -This meant that dependencies within the archive had to be handled -specially. For example, @code{scanf} probably calls @code{read}. That means -that in a single pass through an archive, it was important for @code{scanf.o} -to appear before read.o, because otherwise a program which calls -@code{scanf} but not @code{read} might end up with an unexpected unresolved -reference to @code{read}. +@item --check-order +Fail with an error message if either input file is wrongly ordered. -The way to address this problem was to first generate a set of -dependencies of one object file on another. This was done by a shell -script called @command{lorder}. The GNU tools don't provide a version of -lorder, as far as I know, but you can still find it in BSD -distributions. +@item --nocheck-order +Do not check that both input files are in sorted order. -Then you ran @command{tsort} over the @command{lorder} output, and you used the -resulting sort to define the order in which you added objects to the archive. +Other options are: -This whole procedure has been obsolete since about 1980, because -Unix archives now contain a symbol table (traditionally built by -@command{ranlib}, now generally built by @command{ar} itself), and the Unix -linker uses the symbol table to effectively make multiple passes over -an archive file. +@item --output-delimiter=@var{str} +Print @var{str} between adjacent output columns, +rather than the default of a single TAB character. -Anyhow, that's where tsort came from. To solve an old problem with -the way the linker handled archive files, which has since been solved -in different ways. +The delimiter @var{str} may not be empty. -@exitstatus +@optZeroTerminated +@end table @node ptx invocation @section @command{ptx}: Produce permuted indexes @@ -4461,15 +5148,15 @@ ptx -G [@var{option} @dots{}] [@var{input} [@var{output}]] @end example The @option{-G} (or its equivalent: @option{--traditional}) option disables -all @sc{gnu} extensions and reverts to traditional mode, thus introducing some +all GNU extensions and reverts to traditional mode, thus introducing some limitations and changing several of the program's default option values. -When @option{-G} is not specified, @sc{gnu} extensions are always enabled. -@sc{gnu} extensions to @command{ptx} are documented wherever appropriate in this -document. For the full list, see @xref{Compatibility in ptx}. +When @option{-G} is not specified, GNU extensions are always enabled. +GNU extensions to @command{ptx} are documented wherever appropriate in this +document. @xref{Compatibility in ptx}, for the full list. Individual options are explained in the following sections. -When @sc{gnu} extensions are enabled, there may be zero, one or several +When GNU extensions are enabled, there may be zero, one or several @var{file}s after the options. If there is no @var{file}, the program reads the standard input. If there is one or several @var{file}s, they give the name of input files which are all read in turn, as if all the @@ -4479,7 +5166,7 @@ file names and line numbers refer to individual text input files. In all cases, the program outputs the permuted index to the standard output. -When @sc{gnu} extensions are @emph{not} enabled, that is, when the program +When GNU extensions are @emph{not} enabled, that is, when the program operates in traditional mode, there may be zero, one or two parameters besides the options. If there are no parameters, the program reads the standard input and outputs the permuted index to the standard output. @@ -4489,11 +5176,11 @@ respectively the name of the @var{input} file to read and the name of the @var{output} file to produce. @emph{Be very careful} to note that, in this case, the contents of file given by the second parameter is destroyed. This behavior is dictated by System V @command{ptx} -compatibility; @sc{gnu} Standards normally discourage output parameters not +compatibility; GNU Standards normally discourage output parameters not introduced by an option. Note that for @emph{any} file named as the value of an option or as an -input text file, a single dash @kbd{-} may be used, in which case +input text file, a single dash @samp{-} may be used, in which case standard input is assumed. However, it would not make sense to use this convention more than once per program invocation. @@ -4513,7 +5200,7 @@ convention more than once per program invocation. @item -G @itemx --traditional -As already explained, this option disables all @sc{gnu} extensions to +As already explained, this option disables all GNU extensions to @command{ptx} and switches to traditional mode. @item --help @@ -4534,10 +5221,10 @@ processing. @c FIXME: People don't necessarily know what an IBM-PC was these days. As it is set up now, the program assumes that the input file is coded -using 8-bit @acronym{ISO} 8859-1 code, also known as Latin-1 character set, +using 8-bit ISO 8859-1 code, also known as Latin-1 character set, @emph{unless} it is compiled for MS-DOS, in which case it uses the -character set of the IBM-PC@. (@sc{gnu} @command{ptx} is not known to work on -smaller MS-DOS machines anymore.) Compared to 7-bit @acronym{ASCII}, the set +character set of the IBM-PC@. (GNU @command{ptx} is not known to work on +smaller MS-DOS machines anymore.) Compared to 7-bit ASCII, the set of characters which are letters is different; this alters the behavior of regular expression matching. Thus, the default regular expression for a keyword allows foreign or diacriticized letters. Keyword sorting, @@ -4548,6 +5235,8 @@ quite blindly. @item -f @itemx --ignore-case +@opindex -f +@opindex --ignore-case Fold lower case letters to upper case for sorting. @end table @@ -4560,6 +5249,8 @@ Fold lower case letters to upper case for sorting. @item -b @var{file} @itemx --break-file=@var{file} +@opindex -b +@opindex --break-file This option provides an alternative (to @option{-W}) method of describing which characters make up words. It introduces the name of a @@ -4569,14 +5260,16 @@ is not part of the Break file is a word constituent. If both options @option{-b} and @option{-W} are specified, then @option{-W} has precedence and @option{-b} is ignored. -When @sc{gnu} extensions are enabled, the only way to avoid newline as a +When GNU extensions are enabled, the only way to avoid newline as a break character is to write all the break characters in the file with no -newline at all, not even at the end of the file. When @sc{gnu} extensions +newline at all, not even at the end of the file. When GNU extensions are disabled, spaces, tabs and newlines are always considered as break characters even if not included in the Break file. @item -i @var{file} @itemx --ignore-file=@var{file} +@opindex -i +@opindex --ignore-file The file associated with this option contains a list of words which will never be taken as keywords in concordance output. It is called the @@ -4586,6 +5279,8 @@ end of line separation of words is not subject to the value of the @item -o @var{file} @itemx --only-file=@var{file} +@opindex -o +@opindex --only-file The file associated with this option contains a list of words which will be retained in concordance output; any word not mentioned in this file @@ -4599,36 +5294,41 @@ if it is listed in the Only file and not in the Ignore file. @item -r @itemx --references +@opindex -r +@opindex --references On each input line, the leading sequence of non-white space characters will be taken to be a reference that has the purpose of identifying this input -line in the resulting permuted index. For more information about reference -production, see @xref{Output formatting in ptx}. +line in the resulting permuted index. +@xref{Output formatting in ptx}, +for more information about reference production. Using this option changes the default value for option @option{-S}. Using this option, the program does not try very hard to remove references from contexts in output, but it succeeds in doing so @emph{when} the context ends exactly at the newline. If option -@option{-r} is used with @option{-S} default value, or when @sc{gnu} extensions +@option{-r} is used with @option{-S} default value, or when GNU extensions are disabled, this condition is always met and references are completely excluded from the output contexts. @item -S @var{regexp} @itemx --sentence-regexp=@var{regexp} +@opindex -S +@opindex --sentence-regexp This option selects which regular expression will describe the end of a line or the end of a sentence. In fact, this regular expression is not the only distinction between end of lines or end of sentences, and input line boundaries have no special significance outside this option. By -default, when @sc{gnu} extensions are enabled and if @option{-r} option is not +default, when GNU extensions are enabled and if @option{-r} option is not used, end of sentences are used. In this case, this @var{regex} is -imported from @sc{gnu} Emacs: +imported from GNU Emacs: @example [.?!][]\"')@}]*\\($\\|\t\\| \\)[ \t\n]* @end example -Whenever @sc{gnu} extensions are disabled or if @option{-r} option is used, end +Whenever GNU extensions are disabled or if @option{-r} option is used, end of lines are used; in this case, the default @var{regexp} is just: @example @@ -4658,10 +5358,12 @@ corresponding characters by @command{ptx} itself. @item -W @var{regexp} @itemx --word-regexp=@var{regexp} +@opindex -W +@opindex --word-regexp This option selects which regular expression will describe each keyword. -By default, if @sc{gnu} extensions are enabled, a word is a sequence of -letters; the @var{regexp} used is @samp{\w+}. When @sc{gnu} extensions are +By default, if GNU extensions are enabled, a word is a sequence of +letters; the @var{regexp} used is @samp{\w+}. When GNU extensions are disabled, a word is by default anything which ends with a space, a tab or a newline; the @var{regexp} used is @samp{[^ \t\n]+}. @@ -4681,14 +5383,14 @@ the corresponding characters by @command{ptx} itself. Output format is mainly controlled by the @option{-O} and @option{-T} options described in the table below. When neither @option{-O} nor @option{-T} are -selected, and if @sc{gnu} extensions are enabled, the program chooses an +selected, and if GNU extensions are enabled, the program chooses an output format suitable for a dumb terminal. Each keyword occurrence is output to the center of one line, surrounded by its left and right contexts. Each field is properly justified, so the concordance output can be readily observed. As a special feature, if automatic references are selected by option @option{-A} and are output before the left context, that is, if option @option{-R} is @emph{not} selected, then -a colon is added after the reference; this nicely interfaces with @sc{gnu} +a colon is added after the reference; this nicely interfaces with GNU Emacs @code{next-error} processing. In this default output format, each white space character, like newline and tab, is merely changed to exactly one space, with no special attempt to compress consecutive @@ -4702,16 +5404,20 @@ Output format is further controlled by the following options. @item -g @var{number} @itemx --gap-size=@var{number} +@opindex -g +@opindex --gap-size Select the size of the minimum white space gap between the fields on the output line. @item -w @var{number} @itemx --width=@var{number} +@opindex -w +@opindex --width Select the maximum output width of each final line. If references are used, they are included or excluded from the maximum output width -depending on the value of option @option{-R}. If this option is not +depending on the value of option @option{-R}@. If this option is not selected, that is, when references are output before the left context, the maximum output width takes into account the maximum length of all references. If this option is selected, that is, when references are @@ -4721,6 +5427,8 @@ them. @item -A @itemx --auto-reference +@opindex -A +@opindex --auto-reference Select automatic references. Each input line will have an automatic reference made up of the file name and the line ordinal, with a single @@ -4731,6 +5439,8 @@ reference is used at output time, overriding the input reference. @item -R @itemx --right-side-refs +@opindex -R +@opindex --right-side-refs In the default output format, when option @option{-R} is not used, any references produced by the effect of options @option{-r} or @option{-A} are @@ -4741,23 +5451,25 @@ context. For any other output format, option @option{-R} is ignored, with one exception: with @option{-R} the width of references is @emph{not} taken into account in total output width given by @option{-w}. -This option is automatically selected whenever @sc{gnu} extensions are +This option is automatically selected whenever GNU extensions are disabled. @item -F @var{string} -@itemx --flac-truncation=@var{string} +@itemx --flag-truncation=@var{string} +@opindex -F +@opindex --flag-truncation This option will request that any truncation in the output be reported using the string @var{string}. Most output fields theoretically extend towards the beginning or the end of the current line, or current -sentence, as selected with option @option{-S}. But there is a maximum +sentence, as selected with option @option{-S}@. But there is a maximum allowed output line width, changeable through option @option{-w}, which is further divided into space for various output fields. When a field has to be truncated because it cannot extend beyond the beginning or the end of the current line to fit in, then a truncation occurs. By default, the string used is a single slash, as in @option{-F /}. -@var{string} may have more than one character, as in @option{-F ...}. +@var{string} may have more than one character, as in @option{-F @dots{}}. Also, in the particular case when @var{string} is empty (@option{-F ""}), truncation flagging is disabled, and no truncation marks are appended in this case. @@ -4768,38 +5480,46 @@ the corresponding characters by @command{ptx} itself. @item -M @var{string} @itemx --macro-name=@var{string} +@opindex -M +@opindex --macro-name Select another @var{string} to be used instead of @samp{xx}, while generating output suitable for @command{nroff}, @command{troff} or @TeX{}. @item -O @itemx --format=roff +@opindex -O +@opindex --format=roff Choose an output format suitable for @command{nroff} or @command{troff} processing. Each output line will look like: @smallexample -.xx "@var{tail}" "@var{before}" "@var{keyword_and_after}" "@var{head}" "@var{ref}" +.xx "@var{tail}" "@var{before}" "@var{keyword_and_after}"@c + "@var{head}" "@var{ref}" @end smallexample so it will be possible to write a @samp{.xx} roff macro to take care of -the output typesetting. This is the default output format when @sc{gnu} +the output typesetting. This is the default output format when GNU extensions are disabled. Option @option{-M} can be used to change @samp{xx} to another macro name. In this output format, each non-graphical character, like newline and tab, is merely changed to exactly one space, with no special attempt to -compress consecutive spaces. Each quote character: @kbd{"} is doubled +compress consecutive spaces. Each quote character @samp{"} is doubled so it will be correctly processed by @command{nroff} or @command{troff}. @item -T @itemx --format=tex +@opindex -T +@opindex --format=tex Choose an output format suitable for @TeX{} processing. Each output line will look like: @smallexample -\xx @{@var{tail}@}@{@var{before}@}@{@var{keyword}@}@{@var{after}@}@{@var{head}@}@{@var{ref}@} +\xx @{@var{tail}@}@{@var{before}@}@{@var{keyword}@}@c +@{@var{after}@}@{@var{head}@}@{@var{ref}@} @end smallexample @noindent @@ -4810,16 +5530,16 @@ selected, the last parameter of each @code{\xx} call is inhibited. Option @option{-M} can be used to change @samp{xx} to another macro name. -In this output format, some special characters, like @kbd{$}, @kbd{%}, -@kbd{&}, @kbd{#} and @kbd{_} are automatically protected with a -backslash. Curly brackets @kbd{@{}, @kbd{@}} are protected with a +In this output format, some special characters, like @samp{$}, @samp{%}, +@samp{&}, @samp{#} and @samp{_} are automatically protected with a +backslash. Curly brackets @samp{@{}, @samp{@}} are protected with a backslash and a pair of dollar signs (to force mathematical mode). The backslash itself produces the sequence @code{\backslash@{@}}. Circumflex and tilde diacritical marks produce the sequence @code{^\@{ @}} and @code{~\@{ @}} respectively. Other diacriticized characters of the underlying character set produce an appropriate @TeX{} sequence as far as possible. The other non-graphical characters, like newline and tab, -and all other characters which are not part of @acronym{ASCII}, are merely +and all other characters which are not part of ASCII, are merely changed to exactly one space, with no special attempt to compress consecutive spaces. Let me know how to improve this special character processing for @TeX{}. @@ -4828,13 +5548,13 @@ processing for @TeX{}. @node Compatibility in ptx -@subsection The @sc{gnu} extensions to @command{ptx} +@subsection The GNU extensions to @command{ptx} This version of @command{ptx} contains a few features which do not exist in System V @command{ptx}. These extra features are suppressed by using the @option{-G} command line option, unless overridden by other command line -options. Some @sc{gnu} extensions cannot be recovered by overriding, so the -simple rule is to avoid @option{-G} if you care about @sc{gnu} extensions. +options. Some GNU extensions cannot be recovered by overriding, so the +simple rule is to avoid @option{-G} if you care about GNU extensions. Here are the differences between this program and System V @command{ptx}. @itemize @bullet @@ -4847,8 +5567,8 @@ or, if a second @var{file} parameter is given on the command, to that @var{file}. Having output parameters not introduced by options is a dangerous -practice which @sc{gnu} avoids as far as possible. So, for using @command{ptx} -portably between @sc{gnu} and System V, you should always use it with a +practice which GNU avoids as far as possible. So, for using @command{ptx} +portably between GNU and System V, you should always use it with a single input file, and always expect the result on standard output. You might also want to automatically configure in a @option{-G} option to @command{ptx} calls in products using @command{ptx}, if the configurator finds @@ -4857,9 +5577,9 @@ that the installed @command{ptx} accepts @option{-G}. @item The only options available in System V @command{ptx} are options @option{-b}, @option{-f}, @option{-g}, @option{-i}, @option{-o}, @option{-r}, @option{-t} and -@option{-w}. All other options are @sc{gnu} extensions and are not repeated in +@option{-w}. All other options are GNU extensions and are not repeated in this enumeration. Moreover, some options have a slightly different -meaning when @sc{gnu} extensions are enabled, as explained below. +meaning when GNU extensions are enabled, as explained below. @item By default, concordance output is not formatted for @command{troff} or @@ -4868,29 +5588,30 @@ or @command{nroff} output may still be selected through option @option{-O}. @item Unless @option{-R} option is used, the maximum reference width is -subtracted from the total output line width. With @sc{gnu} extensions +subtracted from the total output line width. With GNU extensions disabled, width of references is not taken into account in the output line width computations. @item -All 256 bytes, even null bytes, are always read and processed from -input file with no adverse effect, even if @sc{gnu} extensions are disabled. -However, System V @command{ptx} does not accept 8-bit characters, a few -control characters are rejected, and the tilde @kbd{~} is also rejected. +All 256 bytes, even ASCII NUL bytes, are always read and +processed from input file with no adverse effect, even if GNU extensions +are disabled. However, System V @command{ptx} does not accept 8-bit +characters, a few control characters are rejected, and the tilde +@samp{~} is also rejected. @item -Input line length is only limited by available memory, even if @sc{gnu} +Input line length is only limited by available memory, even if GNU extensions are disabled. However, System V @command{ptx} processes only the first 200 characters in each line. @item The break (non-word) characters default to be every character except all -letters of the underlying character set, diacriticized or not. When @sc{gnu} +letters of the underlying character set, diacriticized or not. When GNU extensions are disabled, the break characters default to space, tab and newline only. @item -The program makes better use of output line width. If @sc{gnu} extensions +The program makes better use of output line width. If GNU extensions are disabled, the program rather tries to imitate System V @command{ptx}, but still, there are some slight disposition glitches this program does not completely reproduce. @@ -4902,8 +5623,166 @@ allowed with System V @command{ptx}. @end itemize -@node Operating on fields within a line -@chapter Operating on fields within a line +@node tsort invocation +@section @command{tsort}: Topological sort + +@pindex tsort +@cindex topological sort + +@command{tsort} performs a topological sort on the given @var{file}, or +standard input if no input file is given or for a @var{file} of +@samp{-}. For more details and some history, see @ref{tsort background}. +Synopsis: + +@example +tsort [@var{option}] [@var{file}] +@end example + +@command{tsort} reads its input as pairs of strings, separated by blanks, +indicating a partial ordering. The output is a total ordering that +corresponds to the given partial ordering. + +For example + +@example +tsort <<EOF +a b c +d +e f +b c d e +EOF +@end example + +@noindent +will produce the output + +@example +a +b +c +d +e +f +@end example + +Consider a more realistic example. +You have a large set of functions all in one file, and they may all be +declared static except one. Currently that one (say @code{main}) is the +first function defined in the file, and the ones it calls directly follow +it, followed by those they call, etc. Let's say that you are determined +to take advantage of prototypes, so you have to choose between declaring +all of those functions (which means duplicating a lot of information from +the definitions) and rearranging the functions so that as many as possible +are defined before they are used. One way to automate the latter process +is to get a list for each function of the functions it calls directly. +Many programs can generate such lists. They describe a call graph. +Consider the following list, in which a given line indicates that the +function on the left calls the one on the right directly. + +@example +main parse_options +main tail_file +main tail_forever +tail_file pretty_name +tail_file write_header +tail_file tail +tail_forever recheck +tail_forever pretty_name +tail_forever write_header +tail_forever dump_remainder +tail tail_lines +tail tail_bytes +tail_lines start_lines +tail_lines dump_remainder +tail_lines file_lines +tail_lines pipe_lines +tail_bytes xlseek +tail_bytes start_bytes +tail_bytes dump_remainder +tail_bytes pipe_bytes +file_lines dump_remainder +recheck pretty_name +@end example + +then you can use @command{tsort} to produce an ordering of those +functions that satisfies your requirement. + +@example +example$ tsort call-graph | tac +dump_remainder +start_lines +file_lines +pipe_lines +xlseek +start_bytes +pipe_bytes +tail_lines +tail_bytes +pretty_name +write_header +tail +recheck +parse_options +tail_file +tail_forever +main +@end example + +@command{tsort} detects any cycles in the input and writes the first cycle +encountered to standard error. + +Note that for a given partial ordering, generally there is no unique +total ordering. In the context of the call graph above, the function +@code{parse_options} may be placed anywhere in the list as long as it +precedes @code{main}. + +The only options are @option{--help} and @option{--version}. @xref{Common +options}. + +@exitstatus + +@menu +* tsort background:: Where tsort came from. +@end menu + +@node tsort background +@subsection @command{tsort}: Background + +@command{tsort} exists because very early versions of the Unix linker processed +an archive file exactly once, and in order. As @command{ld} read each object +in the archive, it decided whether it was needed in the program based on +whether it defined any symbols which were undefined at that point in +the link. + +This meant that dependencies within the archive had to be handled +specially. For example, @code{scanf} probably calls @code{read}. That means +that in a single pass through an archive, it was important for @code{scanf.o} +to appear before read.o, because otherwise a program which calls +@code{scanf} but not @code{read} might end up with an unexpected unresolved +reference to @code{read}. + +The way to address this problem was to first generate a set of +dependencies of one object file on another. This was done by a shell +script called @command{lorder}. The GNU tools don't provide a version of +lorder, as far as I know, but you can still find it in BSD +distributions. + +Then you ran @command{tsort} over the @command{lorder} output, and you used the +resulting sort to define the order in which you added objects to the archive. + +This whole procedure has been obsolete since about 1980, because +Unix archives now contain a symbol table (traditionally built by +@command{ranlib}, now generally built by @command{ar} itself), and the Unix +linker uses the symbol table to effectively make multiple passes over +an archive file. + +Anyhow, that's where tsort came from. To solve an old problem with +the way the linker handled archive files, which has since been solved +in different ways. + + +@node Operating on fields +@chapter Operating on fields @menu * cut invocation:: Print selected parts of lines. @@ -4921,7 +5800,7 @@ input file, or standard input if no files are given or for a file name of @samp{-}. Synopsis: @example -cut [@var{option}]@dots{} [@var{file}]@dots{} +cut @var{option}@dots{} [@var{file}]@dots{} @end example In the table which follows, the @var{byte-list}, @var{character-list}, @@ -4968,7 +5847,28 @@ of selected bytes. Select for printing only the fields listed in @var{field-list}. Fields are separated by a TAB character by default. Also print any line that contains no delimiter character, unless the -@option{--only-delimited} (@option{-s}) option is specified +@option{--only-delimited} (@option{-s}) option is specified. + +Note @command{awk} supports more sophisticated field processing, +and by default will use (and discard) runs of blank characters to +separate fields, and ignore leading and trailing blanks. +@example +@verbatim +awk '{print $2}' # print the second field +awk '{print $NF-1}' # print the penultimate field +awk '{print $2,$1}' # reorder the first two fields +@end verbatim +@end example + +In the unlikely event that @command{awk} is unavailable, +one can use the @command{join} command, to process blank +characters as @command{awk} does above. +@example +@verbatim +join -a1 -o 1.2 - /dev/null # print the second field +join -a1 -o 1.2,1.1 - /dev/null # reorder the first two fields +@end verbatim +@end example @item -d @var{input_delim_byte} @itemx --delimiter=@var{input_delim_byte} @@ -4999,13 +5899,15 @@ ranges of selected bytes. @item --complement @opindex --complement -This option is a @acronym{GNU} extension. +This option is a GNU extension. Select for printing the complement of the bytes, characters or fields selected with the @option{-b}, @option{-c} or @option{-f} options. In other words, do @emph{not} print the bytes, characters or fields specified via those options. This option is useful when you have many fields and want to print all but a few of them. +@optZeroTerminated + @end table @exitstatus @@ -5022,8 +5924,13 @@ corresponding lines of each given file, separated by a TAB character. Standard input is used for a file name of @samp{-} or if no input files are given. -For example: +Synopsis: + +@example +paste [@var{option}]@dots{} [@var{file}]@dots{} +@end example +For example, with: @example $ cat num2 1 @@ -5032,16 +5939,37 @@ $ cat let3 a b c +@end example + +Take lines sequentially from each file: +@example $ paste num2 let3 1 a 2 b @ c @end example -Synopsis: +Duplicate lines from a file: +@example +$ paste num2 let3 num2 +1 a 1 +2 b 2 + @ c +@end example +Intermix lines from stdin: @example -paste [@var{option}]@dots{} [@var{file}]@dots{} +$ paste - let3 - < num2 +1 a 2 + @ b + @ c +@end example + +Join consecutive lines with a space: +@example +$ seq 4 | paste -d ' ' - - +1 2 +3 4 @end example The program accepts the following options. Also see @ref{Common options}. @@ -5076,6 +6004,8 @@ $ paste -d '%_' num2 let3 num2 %c_ @end example +@optZeroTerminated + @end table @exitstatus @@ -5112,11 +6042,13 @@ locales and options if the output of @command{sort} is fed to sort a file on its default join field, but if you select a non-default locale, join field, separator, or comparison options, then you should do so consistently between @command{join} and @command{sort}. +If @samp{join -t ''} is specified then the whole line is considered which +matches the default operation of sort. -As a @acronym{GNU} extension, if the input has no unpairable lines the -sort order can be any order that considers two fields to be equal if and -only if the sort comparison described above considers them to be equal. -For example: +If the input has no unpairable lines, a GNU extension is +available; the sort order can be any order that considers two fields +to be equal if and only if the sort comparison described above +considers them to be equal. For example: @example $ cat file1 @@ -5133,11 +6065,15 @@ c c1 c2 b b1 b2 @end example +@set JOIN_COMMAND +@checkOrderOption{join} +@clear JOIN_COMMAND + The defaults are: @itemize @item the join field is the first field in each line; @item fields in the input are separated by one or more blanks, with leading - blanks on the line ignored; +blanks on the line ignored; @item fields in the output are separated by a space; @item each output line consists of the join field, the remaining fields from @var{file1}, then the remaining fields from @var{file2}. @@ -5152,10 +6088,25 @@ The program accepts the following options. Also see @ref{Common options}. Print a line for each unpairable line in file @var{file-number} (either @samp{1} or @samp{2}), in addition to the normal output. +@item --check-order +Fail with an error message if either input file is wrongly ordered. + +@item --nocheck-order +Do not check that both input files are in sorted order. This is the default. + @item -e @var{string} @opindex -e -Replace those output fields that are missing in the input with -@var{string}. +Replace those output fields that are missing in the input with @var{string}. +I.e., missing fields specified with the @option{-12jo} options. + +@item --header +@opindex --header +Treat the first line of each input file as a header line. The header lines +will be joined and printed as the first output line. If @option{-o} is used to +specify output format, the header line will be printed according to the +specified format. The header lines will not be checked for ordering even if +@option{--check-order} is specified. Also if the header lines from each file +do not match, the heading fields from the first file will be used. @item -i @itemx --ignore-case @@ -5177,10 +6128,17 @@ Join on field @var{field} (a positive integer) of file 2. Equivalent to @option{-1 @var{field} -2 @var{field}}. @item -o @var{field-list} -Construct each output line according to the format in @var{field-list}. -Each element in @var{field-list} is either the single character @samp{0} or -has the form @var{m.n} where the file number, @var{m}, is @samp{1} or -@samp{2} and @var{n} is a positive field number. +@itemx -o auto +If the keyword @samp{auto} is specified, infer the output format from +the first line in each file. This is the same as the default output format +but also ensures the same number of fields are output for each line. +Missing fields are replaced with the @option{-e} option and extra fields +are discarded. + +Otherwise, construct each output line according to the format in +@var{field-list}. Each element in @var{field-list} is either the single +character @samp{0} or has the form @var{m.n} where the file number, @var{m}, +is @samp{1} or @samp{2} and @var{n} is a positive field number. A field specification of @samp{0} denotes the join field. In most cases, the functionality of the @samp{0} field spec @@ -5189,7 +6147,7 @@ to the join field. However, when printing unpairable lines (using either of the @option{-a} or @option{-v} options), there is no way to specify the join field using @var{m.n} in @var{field-list} if there are unpairable lines in both files. -To give @command{join} that functionality, @acronym{POSIX} invented the @samp{0} +To give @command{join} that functionality, POSIX invented the @samp{0} field specification notation. The elements in @var{field-list} @@ -5205,12 +6163,18 @@ option---are subject to the specified @var{field-list}. Use character @var{char} as the input and output field separator. Treat as significant each occurrence of @var{char} in the input file. Use @samp{sort -t @var{char}}, without the @option{-b} option of -@samp{sort}, to produce this ordering. +@samp{sort}, to produce this ordering. If @samp{join -t ''} is specified, +the whole line is considered, matching the default operation of sort. +If @samp{-t '\0'} is specified then the ASCII NUL +character is used to delimit the fields. @item -v @var{file-number} Print a line for each unpairable line in file @var{file-number} (either @samp{1} or @samp{2}), instead of the normal output. +@optZeroTerminated +@newlineFieldSeparator + @end table @exitstatus @@ -5221,7 +6185,7 @@ Print a line for each unpairable line in file @var{file-number} @cindex operating on characters -This commands operate on individual characters. +These commands operate on individual characters. @menu * tr invocation:: Translate, squeeze, and/or delete characters. @@ -5278,7 +6242,7 @@ options. @xref{Common options}. Options must precede operands. @menu * Character sets:: Specifying sets of characters. * Translating:: Changing one set of characters to another. -* Squeezing:: Squeezing repeats and deleting. +* Squeezing and deleting:: Removing characters. @end menu @@ -5317,8 +6281,9 @@ Control-I. @item \v Control-K. @item \@var{ooo} -The character with the value given by @var{ooo}, which is 1 to 3 -octal digits, +The 8-bit character with the value given by @var{ooo}, which is 1 to 3 +octal digits. Note that @samp{\400} is interpreted as the two-byte +sequence, @samp{\040} @samp{0}. @item \\ A backslash. @end table @@ -5336,7 +6301,7 @@ from @var{m} through @var{n}, in ascending order. @var{m} should collate before @var{n}; if it doesn't, an error results. As an example, @samp{0-9} is the same as @samp{0123456789}. -@sc{gnu} @command{tr} does not support the System V syntax that uses square +GNU @command{tr} does not support the System V syntax that uses square brackets to enclose ranges. Translations specified in that format sometimes work as expected, since the brackets are often transliterated to themselves. However, they should be avoided because they sometimes @@ -5344,10 +6309,10 @@ behave unexpectedly. For example, @samp{tr -d '[0-9]'} deletes brackets as well as digits. Many historically common and even accepted uses of ranges are not -portable. For example, on @acronym{EBCDIC} hosts using the @samp{A-Z} +portable. For example, on EBCDIC hosts using the @samp{A-Z} range will not do what most would expect because @samp{A} through @samp{Z} -are not contiguous as they are in @acronym{ASCII}. -If you can rely on a @acronym{POSIX} compliant version of @command{tr}, then +are not contiguous as they are in ASCII@. +If you can rely on a POSIX compliant version of @command{tr}, then the best way to work around this is to use character classes (see below). Otherwise, it is most portable (and most ugly) to enumerate the members of the ranges. @@ -5424,7 +6389,7 @@ The syntax @samp{[=@var{c}=]} expands to all of the characters that are equivalent to @var{c}, in no particular order. Equivalence classes are a relatively recent invention intended to support non-English alphabets. But there seems to be no standard way to define them or determine their -contents. Therefore, they are not fully implemented in @sc{gnu} @command{tr}; +contents. Therefore, they are not fully implemented in GNU @command{tr}; each character's equivalence class consists only of that character, which is of no particular use. @@ -5467,14 +6432,14 @@ typically have the same length. If @var{set1} is shorter than @var{set2}, the extra characters at the end of @var{set2} are ignored. On the other hand, making @var{set1} longer than @var{set2} is not -portable; @acronym{POSIX} says that the result is undefined. In this situation, +portable; POSIX says that the result is undefined. In this situation, BSD @command{tr} pads @var{set2} to the length of @var{set1} by repeating the last character of @var{set2} as many times as necessary. System V @command{tr} truncates @var{set1} to the length of @var{set2}. -By default, @sc{gnu} @command{tr} handles this case like BSD @command{tr}. +By default, GNU @command{tr} handles this case like BSD @command{tr}. When the @option{--truncate-set1} (@option{-t}) option is given, -@sc{gnu} @command{tr} handles this case like the System V @command{tr} +GNU @command{tr} handles this case like the System V @command{tr} instead. This option is ignored for operations other than translation. Acting like System V @command{tr} in this case breaks the relatively common @@ -5492,25 +6457,28 @@ newlines. @noindent By the way, the above idiom is not portable because it uses ranges, and it assumes that the octal code for newline is 012. -Assuming a @acronym{POSIX} compliant @command{tr}, here is a better way to write it: +Assuming a POSIX compliant @command{tr}, here is a better +way to write it: @example tr -cs '[:alnum:]' '[\n*]' @end example -@node Squeezing +@node Squeezing and deleting @subsection Squeezing repeats and deleting @cindex squeezing repeat characters @cindex deleting characters +@cindex removing characters When given just the @option{--delete} (@option{-d}) option, @command{tr} removes any input characters that are in @var{set1}. -When given just the @option{--squeeze-repeats} (@option{-s}) option, -@command{tr} replaces each input sequence of a repeated character that -is in @var{set1} with a single occurrence of that character. +When given just the @option{--squeeze-repeats} (@option{-s}) option +and not translating, @command{tr} replaces each input sequence of a +repeated character that is in @var{set1} with a single occurrence of +that character. When given both @option{--delete} and @option{--squeeze-repeats}, @command{tr} first performs any deletions using @var{set1}, then squeezes repeats @@ -5541,7 +6509,8 @@ tr -cs '[:alnum:]' '[\n*]' @end example @item -Convert each sequence of repeated newlines to a single newline: +Convert each sequence of repeated newlines to a single newline. +I.e., delete blank lines: @example tr -s '\n' @@ -5669,7 +6638,7 @@ characters) on each line to spaces. @command{unexpand} writes the contents of each given @var{file}, or standard input if none are given or for a @var{file} of @samp{-}, to standard output, converting blanks at the beginning of each line into -as many tab characters as needed. In the default @acronym{POSIX} +as many tab characters as needed. In the default POSIX locale, a @dfn{blank} is a space or a tab; other locales may specify additional blank characters. Synopsis: @@ -5748,7 +6717,7 @@ directory, acting as if it had been invoked with a single argument of @samp{.}. @vindex LC_ALL By default, the output is sorted alphabetically, according to the locale -settings in effect.@footnote{If you use a non-@acronym{POSIX} +settings in effect.@footnote{If you use a non-POSIX locale (e.g., by setting @env{LC_ALL} to @samp{en_US}), then @command{ls} may produce output that is sorted differently than you're accustomed to. In that case, set the @env{LC_ALL} environment variable to @samp{C}.} @@ -5768,8 +6737,12 @@ Exit status: @display 0 success -1 minor problems (e.g., a subdirectory was not found) -2 serious trouble (e.g., memory exhausted) +1 minor problems (e.g., failure to access a file or directory not + specified as a command line argument. This happens when listing a + directory in which entries are actively being removed or renamed.) +2 serious trouble (e.g., memory exhausted, invalid option, failure + to access a file or directory specified as a command line argument + or a directory loop) @end display Also see @ref{Common options}. @@ -5778,7 +6751,7 @@ Also see @ref{Common options}. * Which files are listed:: * What information is listed:: * Sorting the output:: -* More details about version sort:: +* Details about version sort:: * General output formatting:: * Formatting file timestamps:: * Formatting the file names:: @@ -5837,7 +6810,7 @@ command line unless the @option{--dereference-command-line} (@option{-H}), If a command line argument specifies a symbolic link, show information for the file the link references rather than for the link itself. -@itemx --dereference-command-line-symlink-to-dir +@item --dereference-command-line-symlink-to-dir @opindex --dereference-command-line-symlink-to-dir @cindex symbolic links, dereferencing Do not dereference symbolic links, with one exception: @@ -5858,6 +6831,8 @@ directories and the files separately using the selected sort key (see --sort option). That is, this option specifies a primary sort key, and the --sort option specifies a secondary key. +However, any use of @option{--sort=none} +(@option{-U}) disables this option altogether. @item --hide=PATTERN @opindex --hide=@var{pattern} @@ -5940,7 +6915,7 @@ the main output: @end example @noindent -The @var{begN} and @var{endN} are unsigned integers that record the +The @var{begn} and @var{endn} are unsigned integers that record the byte position of the beginning and end of each file name in the output. This makes it easy for Emacs to find the names, even when they contain unusual characters such as space or newline, without fancy searching. @@ -6023,7 +6998,7 @@ $ ls -blog --dired 'a b' If you use a quoting style that adds quote marks (e.g., @option{--quoting-style=c}), then the offsets include the quote marks. So beware that the user may select the quoting style via the environment -variable @env{QUOTING_STYLE}. Hence, applications using @option{--dired} +variable @env{QUOTING_STYLE}@. Hence, applications using @option{--dired} should either specify an explicit @option{--quoting-style=literal} option (aka @option{-N} or @option{--literal}) on the command line, or else be prepared to parse the escaped names. @@ -6043,7 +7018,7 @@ Produce long format directory listings, but don't display owner information. @opindex -G @opindex --no-group Inhibit display of group information in a long format directory listing. -(This is the default in some non-@sc{gnu} versions of @command{ls}, so we +(This is the default in some non-GNU versions of @command{ls}, so we provide this option for compatibility.) @optHumanReadable @@ -6164,9 +7139,11 @@ 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. -For a file with an extended access control list, a @samp{+} character is -listed. Basic access control lists are equivalent to the permissions -listed, and are not considered an alternate access method. +GNU @command{ls} uses a @samp{.} character to indicate a file +with a security context, but no other alternate access method. + +A file with any other combination of alternate access methods +is marked with a @samp{+} character. @item -n @itemx --numeric-uid-gid @@ -6204,6 +7181,16 @@ it also affects the HP-UX @command{ls} program. @optSi +@item -Z +@itemx --context +@opindex -Z +@opindex --context +@cindex SELinux +@cindex security context +Display the SELinux security context or @samp{?} if none is found. +When used with the @option{-l} option, print the security context +to the left of the size column. + @end table @@ -6213,7 +7200,7 @@ it also affects the HP-UX @command{ls} program. @cindex sorting @command{ls} output These options change the order in which @command{ls} sorts the information it outputs. By default, sorting is done by character code -(e.g., @acronym{ASCII} order). +(e.g., ASCII order). @table @samp @@ -6294,7 +7281,7 @@ directories, since not doing any sorting can be noticeably faster. @opindex version@r{, sorting option for @command{ls}} 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. (@xref{More details about version sort}.) +as an index/version number. (@xref{Details about version sort}.) @item -X @itemx --sort=extension @@ -6307,43 +7294,59 @@ after the last @samp{.}); files with no extension are sorted first. @end table -@node More details about version sort -@subsection More details about version sort +@node Details about version sort +@subsection Details about version sort -The version sort takes into account the fact that file names frequently include -indices or version numbers. Standard sorting functions usually do not produce -the ordering that people expect because comparisons are made on a -character-by-character basis. The version -sort addresses this problem, and is especially useful when browsing -directories that contain many files with indices/version numbers in their -names: +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: @example $ ls -1 $ ls -1v -foo.zml-1.gz foo.zml-1.gz -foo.zml-100.gz foo.zml-2.gz -foo.zml-12.gz foo.zml-6.gz -foo.zml-13.gz foo.zml-12.gz -foo.zml-2.gz foo.zml-13.gz -foo.zml-25.gz foo.zml-25.gz -foo.zml-6.gz foo.zml-100.gz +abc.zml-1.gz abc.zml-1.gz +abc.zml-12.gz abc.zml-2.gz +abc.zml-2.gz abc.zml-12.gz @end example -Note also that numeric parts with leading zeros are considered as -fractional one: +Version-sorted strings are compared such that if @var{ver1} and @var{ver2} +are version numbers and @var{prefix} and @var{suffix} (@var{suffix} matching +the regular expression @samp{(\.[A-Za-z~][A-Za-z0-9~]*)*}) are strings then +@var{ver1} < @var{ver2} implies that the name composed of +``@var{prefix} @var{ver1} @var{suffix}'' sorts before +``@var{prefix} @var{ver2} @var{suffix}''. + +Note also that leading zeros of numeric parts are ignored: @example $ ls -1 $ ls -1v -abc-1.007.tgz abc-1.007.tgz -abc-1.012b.tgz abc-1.01a.tgz +abc-1.007.tgz abc-1.01a.tgz +abc-1.012b.tgz abc-1.007.tgz abc-1.01a.tgz abc-1.012b.tgz @end example -This functionality is implemented using the @code{strverscmp} function. -@xref{String/Array Comparison, , , libc, The GNU C Library Reference Manual}. -One result of that implementation decision is that @code{ls -v} does not -use the locale category, @env{LC_COLLATE}. As a result, non-numeric prefixes -are sorted as if @env{LC_COLLATE} were set to @code{C}. +This functionality is implemented using gnulib's @code{filevercmp} function, +which has some caveats worth noting. + +@itemize @bullet +@item @env{LC_COLLATE} is ignored, which means @samp{ls -v} and @samp{sort -V} +will sort non-numeric prefixes as if the @env{LC_COLLATE} locale category +was set to @samp{C}@. +@item Some suffixes will not be matched by the regular +expression mentioned above. Consequently these examples may +not sort as you expect: + +@example +abc-1.2.3.4.7z +abc-1.2.3.7z +@end example + +@example +abc-1.2.3.4.x86_64.rpm +abc-1.2.3.x86_64.rpm +@end example +@end itemize @node General output formatting @subsection General output formatting @@ -6358,7 +7361,8 @@ These options affect the appearance of the overall output. @opindex --format @opindex single-column @r{output of files} List one file per line. This is the default for @command{ls} when standard -output is not a terminal. +output is not a terminal. See also the @option{-b} and @option{-q} options +to suppress direct output of newline characters within a file name. @item -C @itemx --format=vertical @@ -6368,7 +7372,7 @@ output is not a terminal. List files in columns, sorted vertically. This is the default for @command{ls} if standard output is a terminal. It is always the default for the @command{dir} program. -@sc{gnu} @command{ls} uses variable width columns to display as many files as +GNU @command{ls} uses variable width columns to display as many files as possible in the fewest lines. @item --color [=@var{when}] @@ -6394,6 +7398,23 @@ Piping a colorized listing through a pager like @command{more} or @command{less} usually produces unreadable results. However, using @code{more -f} does seem to work. +@vindex LS_COLORS +@vindex SHELL @r{environment variable, and color} +Note that using the @option{--color} option may incur a noticeable +performance penalty when run in a directory with very many entries, +because the default settings require that @command{ls} @code{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 +@command{dircolors} to set the @env{LS_COLORS} environment variable like this, +@example +eval $(dircolors -p | perl -pe \ + 's/^((CAP|S[ET]|O[TR]|M|E)\w+).*/$1 00/' | dircolors -) +@end example +and on a @code{dirent.d_type}-capable file system, @command{ls} +will perform only one @code{stat} call per command line argument. + @item -F @itemx --classify @itemx --indicator-style=classify @@ -6443,10 +7464,19 @@ Append @samp{*} for executable regular files, otherwise behave as for @end table @item -k +@itemx --kibibytes @opindex -k -Print file sizes in 1024-byte blocks, overriding the default block -size (@pxref{Block size}). -This option is equivalent to @option{--block-size=1K}. +@opindex --kibibytes +Set the default block size to its normal value of 1024 bytes, +overriding any contrary specification in environment variables +(@pxref{Block size}). This option is in turn overridden by the +@option{--block-size}, @option{-h} or @option{--human-readable}, and +@option{--si} options. + +The @option{-k} or @option{--kibibytes} option affects the +per-directory block count written by the @option{-l} and similar +options, and the size written by the @option{-s} or @option{--size} +option. It does not affect the file size written by @option{-l}. @item -m @itemx --format=commas @@ -6480,14 +7510,12 @@ Assume that each tab stop is @var{cols} columns wide. The default is 8. @command{ls} uses tabs where possible in the output, for efficiency. If @var{cols} is zero, do not use tabs at all. -@c FIXME: remove in 2009, if Apple Terminal has been fixed for long enough. -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-@acronym{ASCII} byte. If you use such a terminal emulator, use the -@option{-T0} option or put @code{TABSIZE=0} in your environment to tell +Some terminal emulators might not properly align columns to the right of a +TAB following a non-ASCII byte. You can avoid that issue by using the +@option{-T0} option or put @code{TABSIZE=0} in your environment, to tell @command{ls} to align using spaces, not tabs. -@item -w +@item -w @var{cols} @itemx --width=@var{cols} @opindex -w @opindex --width @@ -6495,7 +7523,9 @@ non-@acronym{ASCII} byte. If you use such a terminal emulator, use the Assume the screen is @var{cols} columns wide. The default is taken from the terminal settings if possible; otherwise the environment variable @env{COLUMNS} is used if it is set; otherwise the default -is 80. +is 80. With a @var{cols} value of @samp{0}, there is no limit on +the length of the output line, and that single output line will +be delimited with spaces, not tabs. @end table @@ -6503,12 +7533,12 @@ is 80. @node Formatting file timestamps @subsection Formatting file timestamps -By default, file timestamps are listed in abbreviated form. Most -locales use a timestamp like @samp{2002-03-30 23:45}. However, the -default @acronym{POSIX} locale uses a date like @samp{Mar 30@ @ 2002} -for non-recent timestamps, and a date-without-year and time like -@samp{Mar 30 23:45} for recent timestamps. +By default, file timestamps are listed in abbreviated form, using +a date like @samp{Mar 30@ @ 2002} for non-recent timestamps, and a +date-without-year and time like @samp{Mar 30 23:45} for recent timestamps. +This format can change depending on the current locale as detailed below. +@cindex clock skew A timestamp is considered to be @dfn{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, @@ -6519,7 +7549,7 @@ programs like @command{make} that rely on file timestamps. Time stamps are listed according to the time zone rules specified by the @env{TZ} environment variable, or by the system default rules if @env{TZ} is not set. @xref{TZ Variable,, Specifying the Time Zone -with @env{TZ}, libc, The GNU C Library}. +with @env{TZ}, libc, The GNU C Library Reference Manual}. The following option changes how file timestamps are printed. @@ -6546,25 +7576,25 @@ files; if you want output columns to line up, you may need to insert spaces in one of the two formats. @item full-iso -List timestamps in full using @acronym{ISO} 8601 date, time, and time zone -format with nanosecond precision, e.g., @samp{2002-03-30 +List timestamps in full using ISO 8601 date, time, and time zone +components with nanosecond precision, e.g., @samp{2002-03-30 23:45:56.477817180 -0700}. This style is equivalent to @samp{+%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 @command{make}'s behavior, since @acronym{GNU} @command{make} +explain @command{make}'s behavior, since GNU @command{make} uses the full timestamp to determine whether a file is out of date. @item long-iso -List @acronym{ISO} 8601 date and time in minutes, e.g., +List ISO 8601 date and time components with minute precision, e.g., @samp{2002-03-30 23:45}. These timestamps are shorter than @samp{full-iso} timestamps, and are usually good enough for everyday work. This style is equivalent to @samp{+%Y-%m-%d %H:%M}. @item iso -List @acronym{ISO} 8601 dates for non-recent timestamps (e.g., -@samp{2002-03-30@ }), and @acronym{ISO} 8601 month, day, hour, and +List ISO 8601 dates for non-recent timestamps (e.g., +@samp{2002-03-30@ }), and ISO 8601-like month, day, hour, and minute for recent timestamps (e.g., @samp{03-30 23:45}). These timestamps are uglier than @samp{long-iso} timestamps, but they carry nearly the same information in a smaller space and their brevity helps @@ -6588,7 +7618,7 @@ are harder for programs to parse because locale conventions vary so widely, but they are easier for many people to read. The @env{LC_TIME} locale category specifies the timestamp format. The -default @acronym{POSIX} locale uses timestamps like @samp{Mar 30@ +default POSIX locale uses timestamps like @samp{Mar 30@ @ 2002} and @samp{Mar 30 23:45}; in this locale, the following two @command{ls} invocations are equivalent: @@ -6607,21 +7637,21 @@ and might generate timestamps like @samp{30. M@"ar 2002@ } and @item posix-@var{style} @vindex LC_TIME -List @acronym{POSIX}-locale timestamps if the @env{LC_TIME} locale -category is @acronym{POSIX}, @var{style} timestamps otherwise. For +List POSIX-locale timestamps if the @env{LC_TIME} locale +category is POSIX, @var{style} timestamps otherwise. For example, the @samp{posix-long-iso} style lists timestamps like @samp{Mar 30@ @ 2002} and @samp{Mar 30 23:45} when in -the @acronym{POSIX} locale, and like @samp{2002-03-30 23:45} otherwise. +the POSIX locale, and like @samp{2002-03-30 23:45} otherwise. @end table @end table @vindex TIME_STYLE You can specify the default value of the @option{--time-style} option with the environment variable @env{TIME_STYLE}; if @env{TIME_STYLE} is not set -the default style is @samp{locale}. @acronym{GNU} Emacs 21.3 and +the default style is @samp{locale}. GNU Emacs 21.3 and later use the @option{--dired} option and therefore can parse any date format, but if you are using Emacs 21.1 or 21.2 and specify a -non-@acronym{POSIX} locale you may need to set +non-POSIX locale you may need to set @samp{TIME_STYLE="posix-long-iso"}. To avoid certain denial-of-service attacks, timestamps that would be @@ -6687,11 +7717,17 @@ Output strings as-is; this is the same as the @option{-N} or @item shell Quote strings for the shell if they contain shell metacharacters or would cause ambiguous output. -The quoting is suitable for @acronym{POSIX}-compatible shells like +The quoting is suitable for POSIX-compatible shells like @command{bash}, but it does not always work for incompatible shells like @command{csh}. @item shell-always Quote strings for the shell, even if they would normally not require quoting. +@item shell-escape +Like @samp{shell}, but also quoting non-printable characters using the POSIX +proposed @samp{$''} syntax suitable for most shells. +@item shell-escape-always +Like @samp{shell-escape}, but quote strings even if they would +normally not require quoting. @item c Quote strings as for C character string literals, including the surrounding double-quote characters; this is the same as the @@ -6708,14 +7744,14 @@ locale. @c Use @t instead of @samp to avoid duplicate quoting in some output styles. Quote strings as for C character string literals, except use surrounding quotation marks appropriate for the locale, and quote -@t{`like this'} instead of @t{"like +@t{'like this'} instead of @t{"like this"} in the default C locale. This looks nicer on many displays. @end table You can specify the default value of the @option{--quoting-style} option -with the environment variable @env{QUOTING_STYLE}. If that environment -variable is not set, the default value is @samp{literal}, but this -default may change to @samp{shell} in a future version of this package. +with the environment variable @env{QUOTING_STYLE}@. If that environment +variable is not set, the default value is @samp{shell-escape} when the +output is a terminal, and @samp{literal} otherwise. @item --show-control-chars @opindex --show-control-chars @@ -6749,6 +7785,8 @@ and special characters are represented by backslash escape sequences. -b}; that is, by default files are listed in long format and special characters are represented by backslash escape sequences. +@xref{ls invocation, @command{ls}}. + @node dircolors invocation @section @command{dircolors}: Color setup for @command{ls} @@ -6761,7 +7799,7 @@ terminal for color output from @command{ls} (and @command{dir}, etc.). Typical usage: @example -eval "`dircolors [@var{option}]@dots{} [@var{file}]`" +eval "$(dircolors [@var{option}]@dots{} [@var{file}])" @end example If @var{file} is specified, @command{dircolors} reads it to determine which @@ -6769,6 +7807,15 @@ colors to use for which file types and extensions. Otherwise, a precompiled database is used. For details on the format of these files, run @samp{dircolors --print-database}. +To make @command{dircolors} read a @file{~/.dircolors} file if it +exists, you can put the following lines in your @file{~/.bashrc} (or +adapt them to your favorite shell): + +@example +d=.dircolors +test -r $d && eval "$(dircolors $d)" +@end example + @vindex LS_COLORS @vindex SHELL @r{environment variable, and color} The output is a shell command to set the @env{LS_COLORS} environment @@ -6876,13 +7923,27 @@ By default, @command{cp} does not copy directories. However, the copy recursively by descending into source directories and copying files to corresponding destination directories. -By default, @command{cp} follows symbolic links only when not copying -recursively. This default can be overridden with the +When copying from a symbolic link, @command{cp} normally follows the +link only when not copying recursively or when @option{--link} +(@option{-l}) is used. This default can be overridden with the @option{--archive} (@option{-a}), @option{-d}, @option{--dereference} (@option{-L}), @option{--no-dereference} (@option{-P}), and @option{-H} options. If more than one of these options is specified, the last one silently overrides the others. +When copying to a symbolic link, @command{cp} follows the +link only when it refers to an existing regular file. +However, when copying to a dangling symbolic link, @command{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 @env{POSIXLY_CORRECT} to make @command{cp} attempt to create +the target of a dangling destination symlink, in spite of the possible risk. +Also, when an option like +@option{--backup} or @option{--link} acts to rename or remove the +destination before copying, @command{cp} renames or removes the +symbolic link rather than the file it points to. + By default, @command{cp} copies the contents of special files only when not copying recursively. This default can be overridden with the @option{--copy-contents} option. @@ -6907,10 +7968,18 @@ 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., @samp{ls -U} may list the entries in a copied directory in a different order). -Equivalent to @option{-dpPR}. +Try to preserve SELinux security context and extended attributes (xattr), +but ignore any failure to do that and print no corresponding diagnostic. +Equivalent to @option{-dR --preserve=all} with the reduced diagnostics. + +@item --attributes-only +@opindex --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 @option{--preserve} option for controlling which attributes to copy. @item -b -@itemx @w{@kbd{--backup}[=@var{method}]} +@itemx --backup[=@var{method}] @opindex -b @opindex --backup @vindex VERSION_CONTROL @@ -6925,10 +7994,12 @@ combination of options is this tiny Bourne shell script: @example #!/bin/sh # Usage: backup FILE... -# Create a @sc{gnu}-style backup of each listed FILE. +# Create a GNU-style backup of each listed FILE. +fail=0 for i; do - cp --backup --force -- "$i" "$i" + cp --backup --force --preserve=all -- "$i" "$i" || fail=1 done +exit $fail @end example @item --copy-contents @@ -6961,16 +8032,19 @@ Equivalent to @option{--no-dereference --preserve=links}. @opindex -f @opindex --force When copying without this option and an existing destination file cannot -be opened for writing, the copy fails. However, with @option{--force}), -when a destination file cannot be opened, @command{cp} then unlinks it and +be opened for writing, the copy fails. However, with @option{--force}, +when a destination file cannot be opened, @command{cp} then removes it and tries to open it again. Contrast this behavior with that enabled by @option{--link} and @option{--symbolic-link}, whereby the destination file -is never opened but rather is unlinked unconditionally. Also see the +is never opened but rather is removed unconditionally. Also see the description of @option{--remove-destination}. This option is independent of the @option{--interactive} or @option{-i} option: neither cancels the effect of the other. +This option is ignored when the @option{--no-clobber} or @option{-n} option +is also used. + @item -H @opindex -H If a command line argument specifies a symbolic link, then copy the @@ -6983,7 +8057,8 @@ via recursive traversal. @opindex -i @opindex --interactive When copying a file other than a directory, prompt whether to -overwrite an existing destination file. +overwrite an existing destination file. The @option{-i} option overrides +a previous @option{-n} option. @item -l @itemx --link @@ -6995,7 +8070,18 @@ Make hard links instead of copies of non-directories. @itemx --dereference @opindex -L @opindex --dereference -Always follow symbolic links. +Follow symbolic links when copying from them. +With this option, @command{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. + +@item -n +@itemx --no-clobber +@opindex -n +@opindex --no-clobber +Do not overwrite an existing file. The @option{-n} option overrides a previous +@option{-i} option. This option is mutually exclusive with @option{-b} or +@option{--backup} option. @item -P @itemx --no-dereference @@ -7003,58 +8089,92 @@ Always follow symbolic links. @opindex --no-dereference @cindex symbolic links, copying Copy symbolic links as symbolic links rather than copying the files that -they point to. +they point to. This option affects only symbolic links in the source; +symbolic links in the destination are always followed if possible. @item -p -@itemx @w{@kbd{--preserve}[=@var{attribute_list}]} +@itemx --preserve[=@var{attribute_list}] @opindex -p @opindex --preserve -@cindex file information, preserving +@cindex file information, preserving, extended attributes, xattr Preserve the specified attributes of the original files. If specified, the @var{attribute_list} must be a comma-separated list of one or more of the following strings: @table @samp -@itemx mode +@item mode Preserve the file mode bits and access control lists. -@itemx ownership +@item 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. -@itemx timestamps +@item timestamps Preserve the times of last access and last modification, when possible. -In general, it is not possible to preserve these attributes +On older systems, it is not possible to preserve these attributes when the affected file is a symbolic link. -However, FreeBSD now provides the @code{lutimes} function, which makes -it possibile even for symbolic links. However, this implementation does -not yet take advantage of that. -@c FIXME: once we provide lutimes support, update the above. -@itemx links +However, many systems now provide the @code{utimensat} function, +which makes it possible even for symbolic links. +@item links Preserve in the destination files any links between corresponding source files. -@c Give examples illustrating how hard links are preserved. -@c Also, show how soft links map to hard links with -L and -H. -@itemx all +Note that with @option{-L} or @option{-H}, this option can convert +symbolic links to hard links. For example, +@example +$ mkdir c; : > a; ln -s a b; cp -aH a b c; ls -i1 c +74161745 a +74161745 b +@end example +@noindent +Note the inputs: @file{b} is a symlink to regular file @file{a}, +yet the files in destination directory, @file{c/}, are hard-linked. +Since @option{-a} implies @option{--no-dereference} it would copy the symlink, +but the later @option{-H} tells @command{cp} to dereference the command line +arguments where it then sees two files with the same inode number. +Then the @option{--preserve=links} option also implied by @option{-a} +will preserve the perceived hard link. + +Here is a similar example that exercises @command{cp}'s @option{-L} option: +@smallexample +$ mkdir b c; (cd b; : > a; ln -s a b); cp -aL b c; ls -i1 c/b +74163295 a +74163295 b +@end smallexample + +@item context +Preserve SELinux security context of the file, or fail with full diagnostics. +@item xattr +Preserve extended attributes of the file, or fail with full diagnostics. +If @command{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 @option{--preserve=mode} or @option{--preserve=context}. +@item all Preserve all file attributes. -Equivalent to specifying all of the above. +Equivalent to specifying all of the above, but with the difference +that failure to preserve SELinux security context or extended attributes +does not change @command{cp}'s exit status. In contrast to @option{-a}, +all but @samp{Operation not supported} warnings are output. @end table Using @option{--preserve} with no @var{attribute_list} is equivalent to @option{--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. +In the absence of this option, the permissions of existing destination +files are unchanged. Each new file is created with the mode of the +corresponding source file minus the set-user-ID, set-group-ID, and +sticky bits as the create mode; the operating system then applies either +the umask or a default ACL, possibly resulting in a more restrictive +file mode. @xref{File permissions}. -@itemx @w{@kbd{--no-preserve}=@var{attribute_list}} +@item --no-preserve=@var{attribute_list} @cindex file information, preserving Do not preserve the specified attributes. The @var{attribute_list} has the same form as for @option{--preserve}. -@itemx --parents +@item --parents @opindex --parents @cindex parent directories and @command{cp} Form the name of each destination file by appending to the target @@ -7070,19 +8190,6 @@ cp --parents a/b/c existing_dir copies the file @file{a/b/c} to @file{existing_dir/a/b/c}, creating any missing intermediate directories. -@itemx @w{@kbd{--reply}=@var{how}} -@opindex --reply -@cindex interactivity -@c FIXME: remove in 2008 -@strong{Deprecated: to be removed in 2008.}@* -Using @option{--reply=yes} makes @command{cp} act as if @samp{yes} were -given as a response to every prompt about a destination file. That effectively -cancels any preceding @option{--interactive} or @option{-i} option. -Specify @option{--reply=no} to make @command{cp} act as if @samp{no} were -given as a response to every prompt about a destination file. -Specify @option{--reply=query} to make @command{cp} prompt the user -about each existing destination file. - @item -R @itemx -r @itemx --recursive @@ -7093,19 +8200,53 @@ about each existing destination file. @cindex copying directories recursively @cindex recursively copying directories @cindex non-directories, copying as special files -Copy directories recursively. Symbolic links are not followed by -default; see the @option{--archive} (@option{-a}), @option{-d}, +Copy directories recursively. By default, do not follow symbolic +links in the source unless used together with the @option{--link} +(@option{-l}) option; see the @option{--archive} (@option{-a}), @option{-d}, @option{--dereference} (@option{-L}), @option{--no-dereference} (@option{-P}), and @option{-H} options. Special files are copied by creating a destination file of the same type as the source; see the @option{--copy-contents} option. It is not portable to use @option{-r} to copy symbolic links or special files. On some -non-@sc{gnu} systems, @option{-r} implies the equivalent of +non-GNU systems, @option{-r} implies the equivalent of @option{-L} and @option{--copy-contents} for historical reasons. Also, it is not portable to use @option{-R} to copy symbolic links -unless you also specify @option{-P}, as @acronym{POSIX} allows +unless you also specify @option{-P}, as POSIX allows implementations that dereference symbolic links by default. +@item --reflink[=@var{when}] +@opindex --reflink[=@var{when}] +@cindex COW +@cindex clone +@cindex copy on write +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 @var{when} value can be one of the following: + +@table @samp +@item 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. + +@item auto +If the copy-on-write operation is not supported then fall back +to the standard copy behavior. +@end table + +This option is overridden by the @option{--link}, @option{--symbolic-link} +and @option{--attributes-only} options, thus allowing it to be used +to configure the default data copying behavior for @command{cp}. +For example, with the following alias, @command{cp} will use the +minimum amount of space supported by the file system. + +@example +alias cp='cp --reflink=auto --sparse=always' +@end example + @item --remove-destination @opindex --remove-destination Remove each existing destination file before attempting to open it @@ -7177,8 +8318,11 @@ 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 -@samp{cp -pu} commands are executed with the same source and -destination. +@samp{cp -pu} commands are executed with the same source and destination. +If @option{--preserve=links} is also specified (like with @samp{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. @item -v @itemx --verbose @@ -7195,6 +8339,25 @@ Skip subdirectories that are on different file systems from the one that the copy started on. However, mount point directories @emph{are} copied. +@macro optContext +@item -Z +@itemx --context[=@var{context}] +@opindex -Z +@opindex --context +@cindex SELinux, setting/restoring security context +@cindex security context +Without a specified @var{context}, adjust the SELinux security context according +to the system default type for destination files, similarly to the +@command{restorecon} command. +The long form of this option with a specific context specified, +will set the context for newly created files only. +With a specified context, if both SELinux and SMACK are disabled, a warning is +issued. +@end macro +@optContext +This option is mutually exclusive with the @option{--preserve=context} +option, and overrides the @option{--preserve=all} and @option{-a} options. + @end table @exitstatus @@ -7216,7 +8379,9 @@ dd @var{option} @end example The only options are @option{--help} and @option{--version}. -@xref{Common options}. @command{dd} accepts the following operands. +@xref{Common options}. @command{dd} accepts the following operands, +whose syntax was inspired by the DD (data definition) statement of +OS/360 JCL. @table @samp @@ -7236,6 +8401,7 @@ bytes (or the size specified with @samp{seek=}). @cindex input block size Set the input block size to @var{bytes}. This makes @command{dd} read @var{bytes} per block. +The default is 512 bytes. @item obs=@var{bytes} @opindex obs @@ -7243,6 +8409,7 @@ This makes @command{dd} read @var{bytes} per block. @cindex output block size Set the output block size to @var{bytes}. This makes @command{dd} write @var{bytes} per block. +The default is 512 bytes. @item bs=@var{bytes} @opindex bs @@ -7250,6 +8417,9 @@ This makes @command{dd} write @var{bytes} per block. Set both input and output block sizes to @var{bytes}. This makes @command{dd} read and write @var{bytes} per block, overriding any @samp{ibs} and @samp{obs} settings. +In addition, if no data-transforming @option{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. @item cbs=@var{bytes} @opindex cbs @@ -7262,18 +8432,57 @@ When converting variable-length records to fixed-length ones (@option{conv=block}) or the reverse (@option{conv=unblock}), use @var{bytes} as the fixed record length. -@item skip=@var{blocks} +@item skip=@var{n} @opindex skip -Skip @var{blocks} @samp{ibs}-byte blocks in the input file before copying. +Skip @var{n} @samp{ibs}-byte blocks in the input file before copying. +If @samp{iflag=skip_bytes} is specified, @var{n} is interpreted +as a byte count rather than a block count. -@item seek=@var{blocks} +@item seek=@var{n} @opindex seek -Skip @var{blocks} @samp{obs}-byte blocks in the output file before copying. +Skip @var{n} @samp{obs}-byte blocks in the output file before copying. +if @samp{oflag=seek_bytes} is specified, @var{n} is interpreted +as a byte count rather than a block count. -@item count=@var{blocks} +@item count=@var{n} @opindex count -Copy @var{blocks} @samp{ibs}-byte blocks from the input file, instead +Copy @var{n} @samp{ibs}-byte blocks from the input file, instead of everything until the end of the file. +if @samp{iflag=count_bytes} is specified, @var{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, @samp{iflag=fullblock} +will ensure that @samp{count=} corresponds to complete input blocks +rather than the traditional POSIX specified behavior of counting +input read operations. + +@item status=@var{level} +@opindex status +Transfer information is normally output to stderr upon +receipt of the @samp{INFO} signal or when @command{dd} exits. +Specifying @var{level} will adjust the amount of information printed, +with the last @var{level} specified taking precedence. + +@table @samp + +@item none +@opindex none @r{dd status=} +Do not print any informational or warning messages to stderr. +Error messages are output as normal. + +@item noxfer +@opindex noxfer @r{dd status=} +Do not print the final transfer rate and volume statistics +that normally make up the last status line. + +@item progress +@opindex progress @r{dd status=} +Print the transfer rate and volume statistics on stderr, +when processing each input block. Statistics are output +on a single line at most once every second, but updates +can be delayed when waiting on I/O. + +@end table @item conv=@var{conversion}[,@var{conversion}]@dots{} @opindex conv @@ -7286,24 +8495,29 @@ Conversions: @item ascii @opindex ascii@r{, converting to} -Convert @acronym{EBCDIC} to @acronym{ASCII}, -using the conversion table specified by @acronym{POSIX}. +Convert EBCDIC to ASCII, +using the conversion table specified by POSIX@. This provides a 1:1 translation for all 256 bytes. +This option implies @samp{conv=unblock}; input is converted to +ASCII before trailing spaces are deleted. @item ebcdic @opindex ebcdic@r{, converting to} -Convert @acronym{ASCII} to @acronym{EBCDIC}. +Convert ASCII to EBCDIC@. This is the inverse of the @samp{ascii} conversion. +This option implies @samp{conv=block}; trailing spaces are added +before being converted to EBCDIC@. @item ibm @opindex alternate ebcdic@r{, converting to} -Convert @acronym{ASCII} to alternate @acronym{EBCDIC}, -using the alternate conversion table specified by @acronym{POSIX}. +This acts like @samp{conv=ebcdic}, except it +uses the alternate conversion table specified by POSIX@. This is not a 1:1 translation, but reflects common historical practice for @samp{~}, @samp{[}, and @samp{]}. The @samp{ascii}, @samp{ebcdic}, and @samp{ibm} conversions are -mutually exclusive. +mutually exclusive. If you use any of these options, you should also +use the @samp{cbs=} option. @item block @opindex block @r{(space-padding)} @@ -7312,8 +8526,8 @@ input newline with a space and padding with spaces as necessary. @item unblock @opindex unblock -Replace trailing spaces in each @samp{cbs}-sized input block with a -newline. +Remove any trailing spaces in each @samp{cbs}-sized input block, +and append a newline. The @samp{block} and @samp{unblock} conversions are mutually exclusive. @@ -7327,29 +8541,50 @@ Change lowercase letters to uppercase. The @samp{lcase} and @samp{ucase} conversions are mutually exclusive. +@item sparse +@opindex 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 +@samp{conv=notrunc} or @samp{oflag=append}. +With @samp{conv=notrunc}, existing data in the output file +corresponding to NUL blocks from the input, will be untouched. +With @samp{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. + @item swab @opindex swab @r{(byte-swapping)} @cindex byte-swapping -Swap every pair of input bytes. @sc{gnu} @command{dd}, unlike others, works +Swap every pair of input bytes. GNU @command{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). -@item noerror -@opindex noerror -@cindex read errors, ignoring -Continue after read errors. +@item sync +@opindex sync @r{(padding with ASCII NULs)} +Pad every input block to size of @samp{ibs} with trailing zero bytes. +When used with @samp{block} or @samp{unblock}, pad with spaces instead of +zero bytes. -@item nocreat -@opindex nocreat -@cindex creating output file, avoiding -Do not create the output file; the output file must already exist. +@end table +The following ``conversions'' are really file flags +and don't affect internal processing: + +@table @samp @item excl @opindex excl @cindex creating output file, requiring Fail if the output file already exists; @command{dd} must create the output file itself. +@item nocreat +@opindex nocreat +@cindex creating output file, avoiding +Do not create the output file; the output file must already exist. + The @samp{excl} and @samp{nocreat} conversions are mutually exclusive. @item notrunc @@ -7357,11 +8592,10 @@ The @samp{excl} and @samp{nocreat} conversions are mutually exclusive. @cindex truncating output file, avoiding Do not truncate the output file. -@item sync -@opindex sync @r{(padding with nulls)} -Pad every input block to size of @samp{ibs} with trailing zero bytes. -When used with @samp{block} or @samp{unblock}, pad with spaces instead of -zero bytes. +@item noerror +@opindex noerror +@cindex read errors, ignoring +Continue after read errors. @item fdatasync @opindex fdatasync @@ -7402,10 +8636,22 @@ If you combine this flag with the @samp{of=@var{file}} operand, you should also specify @samp{conv=notrunc} unless you want the output file to be truncated before being appended to. +@item cio +@opindex cio +@cindex concurrent I/O +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. + @item direct @opindex direct @cindex direct I/O 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 @samp{oflag=direct} will cause writes to fail with @code{EINVAL} if the +output buffer size is not a multiple of 512. @item directory @opindex directory @@ -7428,6 +8674,38 @@ last-access and last-modified time) is not necessarily synchronized. @cindex synchronized data and metadata I/O Use synchronized I/O for both data and metadata. +@item nocache +@opindex nocache +@cindex discarding file cache +Request to discard the system data cache for a file. +When count=0 all cached data for the file is specified, +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. + +Note data that is not already persisted to storage will not +be discarded from cache, so note the use of the ``sync'' options +in the examples below, which are used to maximize the +effectiveness of the @samp{nocache} flag. + +Here are some usage examples: + +@example +# 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. +# See also the @samp{direct} flag. +dd if=ifile of=ofile iflag=nocache oflag=nocache,sync +@end example + @item nonblock @opindex nonblock @cindex nonblocking I/O @@ -7445,7 +8723,7 @@ idea to test it on your files before relying on it. @cindex controlling terminal Do not assign the file to be a controlling terminal for @command{dd}. This has no effect when the file is not a terminal. -On many hosts (e.g., @acronym{GNU}/Linux hosts), this option has no effect +On many hosts (e.g., GNU/Linux hosts), this option has no effect at all. @item nofollow @@ -7461,15 +8739,48 @@ Fail if the file has multiple hard links. @item binary @opindex binary @cindex binary I/O -Use binary I/O. This option has an effect only on nonstandard +Use binary I/O@. This option has an effect only on nonstandard platforms that distinguish binary from text I/O. @item text @opindex text @cindex text I/O -Use text I/O. Like @samp{binary}, this option has no effect on +Use text I/O@. Like @samp{binary}, this option has no effect on standard platforms. +@item fullblock +@opindex fullblock +Accumulate full blocks from input. The @code{read} system call +may return early if a full block is not available. +When that happens, continue calling @code{read} to fill the remainder +of the block. +This flag can be used only with @code{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 @samp{count=} argument is +interpreted as a block count rather than a count of read operations. + +@item count_bytes +@opindex count_bytes +Interpret the @samp{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 @code{iflag}. + +@item skip_bytes +@opindex skip_bytes +Interpret the @samp{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 @code{iflag}. + +@item seek_bytes +@opindex seek_bytes +Interpret the @samp{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 @code{oflag}. + @end table These flags are not supported on all systems, and @samp{dd} rejects @@ -7482,15 +8793,23 @@ affected file descriptors, even after @command{dd} exits. @end table @cindex multipliers after numbers -The numeric-valued strings above (@var{bytes} and @var{blocks}) can be -followed by a multiplier: @samp{b}=512, @samp{c}=1, +The numeric-valued strings above (@var{n} and @var{bytes}) +can be followed by a multiplier: @samp{b}=512, @samp{c}=1, @samp{w}=2, @samp{x@var{m}}=@var{m}, or any of the standard block size suffixes like @samp{k}=1024 (@pxref{Block size}). -Use different @command{dd} invocations to use different block sizes for -skipping and I/O@. 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: +Any block size you specify via @samp{bs=}, @samp{ibs=}, @samp{obs=}, @samp{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 @samp{skip_bytes}, +@samp{seek_bytes} and @samp{count_bytes} flags. Alternatively +the traditional method of separate @command{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: @example disk=/dev/rdsk/c0t1d0s2 @@ -7503,24 +8822,60 @@ tape=/dev/rmt/0 (dd bs=4k seek=1 count=0 && dd bs=512k) <$tape >$disk @end example -Sending an @samp{INFO} signal to a running @command{dd} -process makes it print I/O statistics to standard error -and then resume copying. In the example below, -@command{dd} is run in the background to copy 10 million blocks. +@cindex ddrescue +@cindex disks, failing +For failing disks, other tools come with a great variety of extra +functionality to ease the saving of as much data as possible before the +disk finally dies, e.g. +@uref{http://www.gnu.org/software/ddrescue/, GNU @command{ddrescue}}. +However, in some cases such a tool is not available or the administrator +feels more comfortable with the handling of @command{dd}. +As a simple rescue method, call @command{dd} as shown in the following +example: the options @samp{conv=noerror,sync} are used to continue +after read errors and to pad out bad reads with NULs, while +@samp{iflag=fullblock} caters for short reads (which traditionally never +occur on disk based devices): + +@example +# Rescue data from an (unmounted!) partition of a failing disk. +dd conv=noerror,sync iflag=fullblock </dev/sda1 > /mnt/rescue.img +@end example + +Sending an @samp{INFO} signal (or @samp{USR1} signal where that is unavailable) +to a running @command{dd} process makes it print I/O statistics to +standard error and then resume copying. In the example below, +@command{dd} is run in the background to copy 5GB of data. The @command{kill} command makes it output intermediate I/O statistics, -and when @command{dd} completes, it outputs the final statistics. +and when @command{dd} completes normally or is killed by the +@code{SIGINT} signal, it outputs the final statistics. + +@example +# Ignore the signal so we never inadvertently terminate the dd child. +# Note this is not needed when SIGINFO is available. +trap '' USR1 + +# Run dd with the fullblock iflag to avoid short reads +# which can be triggered by reception of signals. +dd iflag=fullblock if=/dev/zero of=/dev/null count=5000000 bs=1000 & pid=$! + +# Output stats every second. +while kill -s USR1 $pid 2>/dev/null; do sleep 1; done +@end example + +The above script will output in the following format: @example -$ 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 +3441325+0 records in +3441325+0 records out +3441325000 bytes (3.4 GB, 3.2 GiB) copied, 1.00036 s, 3.4 GB/s +5000000+0 records in +5000000+0 records out +5000000000 bytes (5.0 GB, 4.7 GiB) copied, 1.44433 s, 3.5 GB/s @end example +The @samp{status=progress} option periodically updates the last line +of the transfer statistics above. + @vindex POSIXLY_CORRECT On systems lacking the @samp{INFO} signal @command{dd} responds to the @samp{USR1} signal instead, unless the @env{POSIXLY_CORRECT} @@ -7572,16 +8927,40 @@ attributes of destination files. It is typically used in Makefiles to copy programs into their destination directories. It refuses to copy files onto themselves. +@cindex extended attributes, xattr +@command{install} never preserves extended attributes (xattr). + The program accepts the following options. Also see @ref{Common options}. @table @samp @optBackup +@item -C +@itemx --compare +@opindex -C +@opindex --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. +Note this option is best used in conjunction with @option{--user}, +@option{--group} and @option{--mode} options, lest @command{install} +incorrectly determines the default attributes that installed files would have +(as it doesn't consider setgid directories and POSIX default ACLs for example). +This could result in redundant copies or attributes that are not reset to the +correct defaults. + @item -c @opindex -c Ignored; for compatibility with old Unix versions of @command{install}. +@item -D +@opindex -D +Create any missing parent directories of @var{dest}, +then copy @var{source} to @var{dest}. +Explicitly specifying the @option{--target-directory=@var{dir}} will similarly +ensure the presence of that hierarchy before copying @var{source} arguments. + @item -d @itemx --directory @opindex -d @@ -7630,6 +9009,15 @@ ownership of installed files or directories to @var{owner}. The default is @code{root}. @var{owner} may be either a user name or a numeric user ID. +@item --preserve-context +@opindex --preserve-context +@cindex SELinux +@cindex security 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. + @item -p @itemx --preserve-timestamps @opindex -p @@ -7651,9 +9039,15 @@ to when they were last installed. @cindex stripping symbol table information Strip the symbol tables from installed binary executables. +@item --strip-program=@var{program} +@opindex --strip-program +@cindex symbol table information, stripping, program +Program used to strip binaries. + @optBackupSuffix @optTargetDirectory +Also specifying the @option{-D} option will ensure the directory is present. @optNoTargetDirectory @@ -7663,6 +9057,10 @@ Strip the symbol tables from installed binary executables. @opindex --verbose Print the name of each file before copying it. +@optContext +This option is mutually exclusive with the @option{--preserve-context} option. + + @end table @exitstatus @@ -7708,6 +9106,11 @@ 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. +@cindex extended attributes, xattr +@command{mv} always tries to copy extended attributes (xattr), which may +include SELinux context, ACLs or Capabilities. +Upon failure all but @samp{Operation not supported} warnings are output. + @cindex prompting, and @command{mv} If a destination file exists but is normally unwritable, standard input is a terminal, and the @option{-f} or @option{--force} option is not given, @@ -7715,10 +9118,18 @@ is a terminal, and the @option{-f} or @option{--force} option is not given, own the file, or have write permission on its directory.) If the response is not affirmative, the file is skipped. -@emph{Warning}: If you try to move a symlink that points to a directory, -and you specify the symlink with a trailing slash, then @command{mv} -doesn't move the symlink but instead moves the directory referenced -by the symlink. @xref{Trailing slashes}. +@emph{Warning}: Avoid specifying a source name with a trailing slash, +when it might be a symlink to a directory. +Otherwise, @command{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 +@code{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. +@xref{Trailing slashes}. + +@emph{Note}: @command{mv} will only replace empty directories in the +destination. Conflicting populated directories are skipped with a diagnostic. The program accepts the following options. Also see @ref{Common options}. @@ -7732,6 +9143,11 @@ The program accepts the following options. Also see @ref{Common options}. @opindex --force @cindex prompts, omitting Do not prompt the user before removing a destination file. +@macro mvOptsIfn +If you specify more than one of the @option{-i}, @option{-f}, @option{-n} +options, only the final one takes effect. +@end macro +@mvOptsIfn @item -i @itemx --interactive @@ -7741,21 +9157,16 @@ Do not prompt the user before removing a destination file. Prompt whether to overwrite each existing destination file, regardless of its permissions. If the response is not affirmative, the file is skipped. +@mvOptsIfn -@itemx @w{@kbd{--reply}=@var{how}} -@opindex --reply -@cindex interactivity -@c FIXME: remove in 2008 -@strong{Deprecated: to be removed in 2008.}@* -Specifying @option{--reply=yes} is equivalent to using @option{--force}. -Specify @option{--reply=no} to make @command{mv} act as if @samp{no} were -given as a response to every prompt about a destination file. -Specify @option{--reply=query} to make @command{mv} prompt the user -about each existing destination file. -Note that @option{--reply=no} has an effect only when @command{mv} would prompt -without @option{-i} or equivalent, i.e., when a destination file exists and is -not writable, standard input is a terminal, and no @option{-f} (or equivalent) -option is specified. +@item -n +@itemx --no-clobber +@opindex -n +@opindex --no-clobber +@cindex prompts, omitting +Do not overwrite an existing file. +@mvOptsIfn +This option is mutually exclusive with @option{-b} or @option{--backup} option. @item -u @itemx --update @@ -7784,6 +9195,16 @@ Print the name of each file before moving it. @optNoTargetDirectory +@item -Z +@itemx --context +@opindex -Z +@opindex --context +@cindex SELinux, restoring security context +@cindex security context +This option functions similarly to the @command{restorecon} command, +by adjusting the SELinux security context according +to the system default type for destination files. + @end table @exitstatus @@ -7816,7 +9237,8 @@ the @option{-f} or @option{--force} option is not given, or the If the response is not affirmative, the file is skipped. Any attempt to remove a file whose last file name component is -@file{.} or @file{..} is rejected without any prompting. +@file{.} or @file{..} is rejected without any prompting, as mandated +by POSIX. @emph{Warning}: If you use @command{rm} to remove a file, it is usually possible to recover the contents of that file. If you want more assurance @@ -7826,11 +9248,18 @@ The program accepts the following options. Also see @ref{Common options}. @table @samp +@item -d +@itemx --dir +@opindex -d +@opindex --dir +@cindex directories, removing +Remove the listed directories if they are empty. + @item -f @itemx --force @opindex -f @opindex --force -Ignore nonexistent files and never prompt the user. +Ignore nonexistent files and missing operands, and never prompt the user. Ignore any previous @option{--interactive} (@option{-i}) option. @item -i @@ -7847,7 +9276,7 @@ files are named or if a recursive removal is requested. Ignore any previous @option{--force} (@option{-f}) option. Equivalent to @option{--interactive=once}. -@itemx --interactive [=@var{when}] +@item --interactive [=@var{when}] @opindex --interactive Specify when to issue an interactive prompt. @var{when} may be omitted, or one of: @@ -7863,15 +9292,16 @@ removal is requested. Equivalent to @option{-I}. @vindex always @r{interactive option} - Prompt for every file being removed. Equivalent to @option{-i}. @end itemize -Specifying @option{--interactive} and no @var{when} is equivalent to +@option{--interactive} with no @var{when} is equivalent to @option{--interactive=always}. -@itemx --one-file-system +@item --one-file-system @opindex --one-file-system @cindex one file system, restricting @command{rm} to When removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument. +@cindex bind mount This option is useful when removing a build ``chroot'' hierarchy, which normally contains no valuable data. However, it is not uncommon to bind-mount @file{/home} into such a hierarchy, to make it easier to @@ -7884,7 +9314,7 @@ warn about and skip directories on other file systems. Of course, this will not save your @file{/home} if it and your chroot happen to be on the same file system. -@itemx --preserve-root +@item --preserve-root @opindex --preserve-root @cindex root directory, disallow recursive destruction Fail upon any attempt to remove the root directory, @file{/}, @@ -7892,7 +9322,7 @@ when used with the @option{--recursive} option. This is the default behavior. @xref{Treating / specially}. -@itemx --no-preserve-root +@item --no-preserve-root @opindex --no-preserve-root @cindex root directory, allow recursive destruction Do not treat @file{/} specially when removing recursively. @@ -7920,7 +9350,7 @@ Print the name of each file before removing it. @cindex files beginning with @samp{-}, removing @cindex @samp{-}, removing files beginning with One common question is how to remove files whose names begin with a -@samp{-}. @sc{gnu} @command{rm}, like every program that uses the @code{getopt} +@samp{-}. GNU @command{rm}, like every program that uses the @code{getopt} function to parse its arguments, lets you use the @samp{--} option to indicate that all following arguments are non-options. To remove a file called @file{-f} in the current directory, you could type either: @@ -7938,7 +9368,7 @@ rm ./-f @opindex - @r{and Unix @command{rm}} The Unix @command{rm} program's use of a single @samp{-} for this purpose -predates the development of the getopt standard syntax. +predates the development of the @code{getopt} standard syntax. @exitstatus @@ -7982,7 +9412,7 @@ floppies, the patterns are designed for best effect on hard drives. For more details, see the source code and Peter Gutmann's paper @uref{http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html, @cite{Secure Deletion of Data from Magnetic and Solid-State Memory}}, -from the proceedings of the Sixth @acronym{USENIX} Security Symposium (San Jose, +from the proceedings of the Sixth USENIX Security Symposium (San Jose, California, July 22--25, 1996). @strong{Please note} that @command{shred} relies on a very important assumption: @@ -7995,7 +9425,7 @@ assumption. Exceptions include: @item Log-structured or journaled file systems, such as those supplied with AIX and Solaris, and JFS, ReiserFS, XFS, Ext3 (in @code{data=journal} mode), -BFS, NTFS, etc.@: when they are configured to journal @emph{data}. +BFS, NTFS, etc., when they are configured to journal @emph{data}. @item File systems that write redundant data and carry on even if some writes @@ -8014,7 +9444,7 @@ Compressed file systems. In the particular case of ext3 file systems, the above disclaimer applies (and @command{shred} is thus of limited effectiveness) only in @code{data=journal} -mode, which journals file data in addition to just metadata. In both +mode, which journals file data in addition to just metadata. In both the @code{data=ordered} (default) and @code{data=writeback} modes, @command{shred} works as usual. Ext3 journaling modes can be changed by adding the @code{data=something} option to the mount options for a @@ -8060,16 +9490,15 @@ The program accepts the following options. Also see @ref{Common options}. @cindex force deletion Override file permissions if necessary to allow overwriting. -@item -@var{NUMBER} -@itemx -n @var{NUMBER} -@itemx --iterations=@var{NUMBER} -@opindex -n @var{NUMBER} -@opindex --iterations=@var{NUMBER} +@item -n @var{number} +@itemx --iterations=@var{number} +@opindex -n @var{number} +@opindex --iterations=@var{number} @cindex iterations, selecting the number of -By default, @command{shred} uses 25 passes of overwrite. This is enough -for all of the useful overwrite patterns to be used at least once. -You can reduce this to save time, or increase it if you have a lot of -time to waste. +By default, @command{shred} uses @value{SHRED_DEFAULT_PASSES} 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. @item --random-source=@var{file} @opindex --random-source @@ -8077,35 +9506,50 @@ time to waste. Use @var{file} as a source of random data used to overwrite and to choose pass ordering. @xref{Random sources}. -@item -s @var{BYTES} -@itemx --size=@var{BYTES} -@opindex -s @var{BYTES} -@opindex --size=@var{BYTES} +@item -s @var{bytes} +@itemx --size=@var{bytes} +@opindex -s @var{bytes} +@opindex --size=@var{bytes} @cindex size of file to shred -Shred the first @var{BYTES} bytes of the file. The default is to shred -the whole file. @var{BYTES} can be followed by a size specification like +Shred the first @var{bytes} bytes of the file. The default is to shred +the whole file. @var{bytes} can be followed by a size specification like @samp{K}, @samp{M}, or @samp{G} to specify a multiple. @xref{Block size}. @item -u -@itemx --remove +@itemx --remove[=@var{how}] @opindex -u @opindex --remove +@opindex --remove=unlink +@opindex --remove=wipe +@opindex --remove=wipesync @cindex removing files after shredding 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. +Often the file name is less sensitive than the file data, in which case +the optional @var{how} parameter, supported with the long form option, +gives control of how to more efficiently remove each directory entry. +The @samp{unlink} parameter will just use a standard unlink call, +@samp{wipe} will also first obfuscate bytes in the name, and +@samp{wipesync} will also sync each obfuscated byte in the name to disk. +Note @samp{wipesync} is the default method, but can be expensive, +requiring a sync for every character in every file. This can become +significant with many files, or is redundant if your file system provides +synchronous metadata updates. @item -v @itemx --verbose @opindex -v @opindex --verbose -Display status updates as sterilization proceeds. +Display to standard error all status updates as sterilization proceeds. @item -x @itemx --exact @opindex -x @opindex --exact By default, @command{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. +multiple of the file system block size to fully erase the slack space in +the last block of the file. This space may contain portions of the current +system memory on some systems for example. Use @option{--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, @@ -8140,12 +9584,26 @@ your hard disk, you could give a command like this: shred --verbose /dev/sda5 @end example +On modern disks, a single pass should be adequate, +and it will take one third the time of the default three-pass approach. + +@example +# 1 pass, write pseudo-random data; 3x faster than the default +shred --verbose -n1 /dev/sda5 +@end example + +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 @samp{-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 @var{file} of @samp{-} denotes standard output. The intended use of this is to shred a removed temporary file. For example: @example -i=`tempfile -m 0600` +i=$(mktemp) exec 3<>"$i" rm -- "$i" echo "Hello, world" >&3 @@ -8190,7 +9648,7 @@ Besides directories, other special file types include named pipes * mkdir invocation:: Make directories. * mkfifo invocation:: Make FIFOs (named pipes). * mknod invocation:: Make block or character special files. -* readlink invocation:: Print the referent of a symbolic link. +* readlink invocation:: Print value of a symlink or canonical file name. * rmdir invocation:: Remove empty directories. * unlink invocation:: Remove files via the unlink syscall @end menu @@ -8221,12 +9679,17 @@ must specify a nonexistent entry in an existing directory. @command{link} simply calls @code{link (@var{filename}, @var{linkname})} to create the link. -On a @acronym{GNU} system, this command acts like @samp{ln --directory +On a GNU system, this command acts like @samp{ln --directory --no-target-directory @var{filename} @var{linkname}}. However, the @option{--directory} and @option{--no-target-directory} options are -not specified by @acronym{POSIX}, and the @command{link} command is +not specified by POSIX, and the @command{link} command is more portable in practice. +If @var{filename} is a symbolic link, it is unspecified whether +@var{linkname} will be a hard link to the symbolic link or to the +target of the symbolic link. Use @command{ln -P} or @command{ln -L} +to specify which behavior is desired. + @exitstatus @@ -8282,9 +9745,11 @@ A @dfn{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 @emph{is} the -file. On all existing implementations, you cannot make a hard link to -a directory, and hard links cannot cross file system boundaries. (These -restrictions are not mandated by @acronym{POSIX}, however.) +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.) @cindex dereferencing symbolic links @cindex symbolic link, defined @@ -8295,9 +9760,36 @@ 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 @dfn{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. @xref{Symbolic Links,,, +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. @xref{Symbolic Links,,, libc, The GNU C Library Reference Manual}. +Symbolic links can contain arbitrary strings; a @dfn{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 @ref{Common options}. @table @samp @@ -8329,6 +9821,14 @@ Remove existing destination files. @cindex prompting, and @command{ln} Prompt whether to remove existing destination files. +@item -L +@itemx --logical +@opindex -L +@opindex --logical +If @option{-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. + @item -n @itemx --no-dereference @opindex -n @@ -8350,6 +9850,49 @@ just like a directory. This option is weaker than the @option{--no-target-directory} (@option{-T}) option, so it has no effect if both options are given. +@item -P +@itemx --physical +@opindex -P +@opindex --physical +If @option{-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. + +@item -r +@itemx --relative +@opindex -r +@opindex --relative +Make symbolic links relative to the link location. + +Example: + +@smallexample +ln -srv /a/file /tmp +'/tmp/file' -> '../a/file' +@end smallexample + +Relative symbolic links are generated based on their canonicalized +containing directory, and canonicalized targets. I.e., all symbolic +links in these file names will be resolved. +@xref{realpath invocation}, which gives greater control +over relative file name generation, as demonstrated in the following example: + +@example +@verbatim +ln--relative() { + test "$1" = --no-symlinks && { nosym=$1; shift; } + target="$1"; + test -d "$2" && link="$2/." || link="$2" + rtarget="$(realpath $nosym -m "$target" \ + --relative-to "$(dirname "$link")")" + ln -s -v "$rtarget" "$link" +} +@end verbatim +@end example + @item -s @itemx --symbolic @opindex -s @@ -8371,6 +9914,15 @@ Print the name of each file after linking it successfully. @end table +@cindex hard links to symbolic links +@cindex symbolic links and @command{ln} +If @option{-L} and @option{-P} are both given, the last one takes +precedence. If @option{-s} is also given, @option{-L} and @option{-P} +are silently ignored. If neither option is given, then this +implementation defaults to @option{-P} if the system @code{link} supports +hard links to symbolic links (such as the GNU system), and @option{-L} +if @code{link} follows symbolic links (such as on BSD). + @exitstatus Examples: @@ -8434,7 +9986,7 @@ in @command{chmod} and uses @samp{a=rwx} (read, write and execute allowed for everyone) for the point of the departure. @xref{File permissions}. Normally the directory has the desired file mode bits at the moment it -is created. As a @acronym{GNU} extension, @var{mode} may also mention +is created. As a GNU extension, @var{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. @xref{Directory Setuid and Setgid}, for how the @@ -8467,6 +10019,9 @@ newly-created parent directories are inherited. @opindex --verbose Print a message for each created directory. This is most useful with @option{--parents}. + +@optContext + @end table @exitstatus @@ -8492,7 +10047,7 @@ 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 @ref{Common options}. +The program accepts the following options. Also see @ref{Common options}. @table @samp @@ -8506,6 +10061,8 @@ Set the mode of created FIFOs to @var{mode}, which is symbolic as in for the point of departure. @var{mode} should specify only file permission bits. @xref{File permissions}. +@optContext + @end table @exitstatus @@ -8537,6 +10094,9 @@ 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 @dfn{block special} files and @dfn{character special} files. +@c mknod is a shell built-in at least with OpenBSD's /bin/sh +@mayConflictWithShellBuiltIn{mknod} + The arguments after @var{name} specify the type of file to make: @table @samp @@ -8550,7 +10110,7 @@ for a FIFO for a block special file @item c -@c Don't document the `u' option -- it's just a synonym for `c'. +@c Don't document the 'u' option -- it's just a synonym for 'c'. @c Do *any* versions of mknod still use it? @c @itemx u @opindex c @r{for character special file} @@ -8565,7 +10125,7 @@ If a major or minor device number begins with @samp{0x} or @samp{0X}, it is interpreted as hexadecimal; otherwise, if it begins with @samp{0}, as octal; otherwise, as decimal. -The program accepts the following option. Also see @ref{Common options}. +The program accepts the following options. Also see @ref{Common options}. @table @samp @@ -8578,16 +10138,21 @@ Set the mode of created files to @var{mode}, which is symbolic as in @var{mode} should specify only file permission bits. @xref{File permissions}. +@optContext + @end table @exitstatus @node readlink invocation -@section @command{readlink}: Print the referent of a symbolic link +@section @command{readlink}: Print value of a symlink or canonical file name @pindex readlink @cindex displaying value of a symbolic link +@cindex canonical file name +@cindex canonicalize a file name +@findex realpath @command{readlink} may work in one of two supported modes: @@ -8595,20 +10160,20 @@ Set the mode of created files to @var{mode}, which is symbolic as in @item Readlink mode -@command{readlink} outputs the value of the given symbolic link. +@command{readlink} outputs the value of the given symbolic links. If @command{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. @item Canonicalize mode -@command{readlink} outputs the absolute name of the given file which contains +@command{readlink} outputs the absolute name of the given files which contain no @file{.}, @file{..} components nor any repeated separators (@file{/}) or symbolic links. @end table @example -readlink [@var{option}] @var{file} +readlink [@var{option}]@dots{} @var{file}@dots{} @end example By default, @command{readlink} operates in readlink mode. @@ -8623,7 +10188,8 @@ The program accepts the following options. Also see @ref{Common options}. @opindex --canonicalize Activate canonicalize mode. If any component of the file name except the last one is missing or unavailable, -@command{readlink} produces no output and exits with a nonzero exit code. +@command{readlink} produces no output and exits with a nonzero exit +code. A trailing slash is ignored. @item -e @itemx --canonicalize-existing @@ -8631,7 +10197,8 @@ If any component of the file name except the last one is missing or unavailable, @opindex --canonicalize-existing Activate canonicalize mode. If any component is missing or unavailable, @command{readlink} produces -no output and exits with a nonzero exit code. +no output and exits with a nonzero exit code. A trailing slash +requires that the name resolve to a directory. @item -m @itemx --canonicalize-missing @@ -8645,7 +10212,8 @@ as a directory. @itemx --no-newline @opindex -n @opindex --no-newline -Do not output the trailing newline. +Do not print the output delimiter, when a single @var{file} is specified. +Print a warning if specified along with multiple @var{file}s. @item -s @itemx -q @@ -8663,10 +10231,15 @@ Suppress most error messages. @opindex --verbose Report error messages. +@optZero + @end table The @command{readlink} utility first appeared in OpenBSD 2.1. +The @command{realpath} command without options, operates like +@command{readlink} in canonicalize mode. + @exitstatus @@ -8686,7 +10259,7 @@ rmdir [@var{option}]@dots{} @var{directory}@dots{} If any @var{directory} argument does not refer to an existing empty directory, it is an error. -The program accepts the following option. Also see @ref{Common options}. +The program accepts the following options. Also see @ref{Common options}. @table @samp @@ -8768,9 +10341,9 @@ timestamps, and other information. Collectively, we call these a file's These commands change file attributes. @menu +* chown invocation:: Change file owners and groups. * chgrp invocation:: Change file groups. * chmod invocation:: Change access permissions. -* chown invocation:: Change file owners and groups. * touch invocation:: Change file timestamps. @end menu @@ -8789,7 +10362,8 @@ to @var{new-owner} or to the user and group of an existing reference file. Synopsis: @example -chown [@var{option}]@dots{} @{@var{new-owner} | --reference=@var{ref_file}@} @var{file}@dots{} +chown [@var{option}]@dots{} @{@var{new-owner} | --reference=@var{ref_file}@}@c + @var{file}@dots{} @end example If used, @var{new-owner} specifies the new owner and/or group as follows @@ -8833,14 +10407,21 @@ or group ID, then you may specify it with a leading @samp{+}. @xref{Disambiguating names and IDs}. Some older scripts may still use @samp{.} in place of the @samp{:} separator. -@acronym{POSIX} 1003.1-2001 (@pxref{Standards conformance}) does not -require support for that, but for backward compatibility @acronym{GNU} +POSIX 1003.1-2001 (@pxref{Standards conformance}) does not +require support for that, but for backward compatibility GNU @command{chown} supports @samp{.} so long as no ambiguity results. New scripts should avoid the use of @samp{.} because it is not portable, and because it has undesirable results if the entire @var{owner@samp{.}group} happens to identify a user whose name contains @samp{.}. +@macro chownGroupRestrictions +It is system dependent whether a user can change the group to an arbitrary one, +or the more portable behavior of being restricted to setting a group of +which the user is a member. +@end macro +@chownGroupRestrictions + The @command{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 @code{chown} system call, which may @@ -8874,7 +10455,7 @@ actually changes. Do not print error messages about files whose ownership cannot be changed. -@itemx @w{@kbd{--from}=@var{old-owner}} +@item --from=@var{old-owner} @opindex --from @cindex symbolic links, changing owner Change a @var{file}'s ownership only if it has current attributes specified @@ -8928,14 +10509,14 @@ is a symbolic link. By default, no diagnostic is issued for symbolic links encountered during a recursive traversal, but see @option{--verbose}. -@itemx --preserve-root +@item --preserve-root @opindex --preserve-root @cindex root directory, disallow recursive modification Fail upon any attempt to recursively change the root directory, @file{/}. Without @option{--recursive}, this option has no effect. @xref{Treating / specially}. -@itemx --no-preserve-root +@item --no-preserve-root @opindex --no-preserve-root @cindex root directory, allow recursive modification Cancel the effect of any preceding @option{--preserve-root} option. @@ -9001,16 +10582,20 @@ chown -hR root /u @command{chgrp} changes the group ownership of each given @var{file} to @var{group} (which can be either a group name or a numeric group ID) -or to the group of an existing reference file. Synopsis: +or to the group of an existing reference file. @xref{chown invocation}. +Synopsis: @example -chgrp [@var{option}]@dots{} @{@var{group} | --reference=@var{ref_file}@} @var{file}@dots{} +chgrp [@var{option}]@dots{} @{@var{group} | --reference=@var{ref_file}@}@c + @var{file}@dots{} @end example If @var{group} is intended to represent a numeric group ID, then you may specify it with a leading @samp{+}. @xref{Disambiguating names and IDs}. +@chownGroupRestrictions + The program accepts the following options. Also see @ref{Common options}. @table @samp @@ -9054,14 +10639,14 @@ is a symbolic link. By default, no diagnostic is issued for symbolic links encountered during a recursive traversal, but see @option{--verbose}. -@itemx --preserve-root +@item --preserve-root @opindex --preserve-root @cindex root directory, disallow recursive modification Fail upon any attempt to recursively change the root directory, @file{/}. Without @option{--recursive}, this option has no effect. @xref{Treating / specially}. -@itemx --no-preserve-root +@item --no-preserve-root @opindex --no-preserve-root @cindex root directory, allow recursive modification Cancel the effect of any preceding @option{--preserve-root} option. @@ -9125,7 +10710,8 @@ chgrp -hR staff /u @command{chmod} changes the access permissions of the named files. Synopsis: @example -chmod [@var{option}]@dots{} @{@var{mode} | --reference=@var{ref_file}@} @var{file}@dots{} +chmod [@var{option}]@dots{} @{@var{mode} | --reference=@var{ref_file}@}@c + @var{file}@dots{} @end example @cindex symbolic links, permissions of @@ -9175,14 +10761,14 @@ actually changes. Do not print error messages about files whose permissions cannot be changed. -@itemx --preserve-root +@item --preserve-root @opindex --preserve-root @cindex root directory, disallow recursive modification Fail upon any attempt to recursively change the root directory, @file{/}. Without @option{--recursive}, this option has no effect. @xref{Treating / specially}. -@itemx --no-preserve-root +@item --no-preserve-root @opindex --no-preserve-root @cindex root directory, allow recursive modification Cancel the effect of any preceding @option{--preserve-root} option. @@ -9229,21 +10815,52 @@ touch [@var{option}]@dots{} @var{file}@dots{} @end example @cindex empty files, creating -Any @var{file} that does not exist is created empty. - -A @var{file} of @samp{-} causes @command{touch} to change the -times of the file associated with standard output. +Any @var{file} argument that does not exist is created empty, unless +option @option{--no-create} (@option{-c}) or @option{--no-dereference} +(@option{-h}) was in effect. + +A @var{file} argument string of @samp{-} is handled specially and +causes @command{touch} to change the times of the file associated with +standard output. + +@cindex clock skew +By default, @command{touch} sets file timestamps to the current time. +Because @command{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 +@command{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''. + +@cindex file timestamp resolution +The @command{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 +@command{touch} uses to set a file's timestamp to an arbitrary value. @cindex permissions, for changing file timestamps -If changing both the access and modification times to the current -time, @command{touch} can change the timestamps for files that the user -running it does not own but has write permission for. Otherwise, the -user must own the files. +When setting file timestamps to the current time, @command{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 @command{touch} provides options for changing two of the times---the times of last access and modification---of a file, there is actually -a third one as well: the inode change time. This is often referred to -as a file's @code{ctime}. +a standard third one as well: the inode change time. This is often +referred to as a file's @code{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 @@ -9255,13 +10872,17 @@ 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. @vindex TZ Time stamps assume the time zone rules specified by the @env{TZ} environment variable, or by the system default rules if @env{TZ} is not set. @xref{TZ Variable,, Specifying the Time Zone with @env{TZ}, -libc, The GNU C Library}. You can avoid ambiguities during -daylight saving transitions by using @sc{utc} time stamps. +libc, The GNU C Library Reference Manual}. +You can avoid ambiguities during +daylight saving transitions by using UTC time stamps. The program accepts the following options. Also see @ref{Common options}. @@ -9282,9 +10903,9 @@ Change the access time only. @itemx --no-create @opindex -c @opindex --no-create -Do not create files that do not exist. +Do not warn about or create files that do not exist. -@item -d +@item -d @var{time} @itemx --date=@var{time} @opindex -d @opindex --date @@ -9294,7 +10915,7 @@ time zones, @samp{am} and @samp{pm}, @samp{yesterday}, etc. For example, @option{--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 @acronym{UTC}. @xref{Date input formats}. +minutes east of UTC@. @xref{Date input formats}. File systems that do not support high-resolution time stamps silently ignore any excess precision here. @@ -9303,6 +10924,24 @@ silently ignore any excess precision here. @cindex BSD @command{touch} compatibility Ignored; for compatibility with BSD versions of @command{touch}. +@item -h +@itemx --no-dereference +@opindex -h +@opindex --no-dereference +@cindex symbolic links, changing time +@findex lutimes +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 @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 @option{-r}, a +reference timestamp is taken from a symbolic link rather than the file +it refers to. + @item -m @itemx --time=mtime @itemx --time=modify @@ -9322,14 +10961,19 @@ If this option is combined with the @option{--date=@var{time}} the origin for any relative @var{time}s given, but is otherwise ignored. For example, @samp{-r foo -d '-5 seconds'} specifies a time stamp equal to five seconds before the corresponding time stamp for @file{foo}. +If @var{file} is a symbolic link, the reference timestamp is taken +from the target of the symlink, unless @option{-h} was also in effect. -@item -t [[@var{CC}]@var{YY}]@var{MMDDhhmm}[.@var{ss}] +@item -t [[@var{cc}]@var{yy}]@var{mmddhhmm}[.@var{ss}] +@cindex leap seconds 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 @var{CC} +If the year is specified with only two digits, then @var{cc} is 20 for years in the range 0 @dots{} 68, and 19 for years in 69 @dots{} 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, @var{ss} may be +@samp{60}. @end table @@ -9337,8 +10981,8 @@ the argument is interpreted as a date in the current year. On older systems, @command{touch} supports an obsolete syntax, as follows. If no timestamp is given with any of the @option{-d}, @option{-r}, or @option{-t} options, and if there are two or more @var{file}s and the -first @var{file} is of the form @samp{@var{MMDDhhmm}[@var{YY}]} and this -would be a valid argument to the @option{-t} option (if the @var{YY}, if +first @var{file} is of the form @samp{@var{mmddhhmm}[@var{yy}]} and this +would be a valid argument to the @option{-t} option (if the @var{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. @@ -9365,7 +11009,8 @@ file status information, and write buffers to disk. * df invocation:: Report file system disk space usage. * du invocation:: Estimate file space usage. * stat invocation:: Report file or file system status. -* sync invocation:: Synchronize memory and disk. +* sync invocation:: Synchronize cached writes to persistent storage. +* truncate invocation:: Shrink or extend the size of a file. @end menu @@ -9391,15 +11036,24 @@ Normally the disk space is printed in units of 1024 bytes, but this can be overridden (@pxref{Block size}). Non-integer quantities are rounded up to the next higher unit. +For bind mounts and without arguments, @command{df} only outputs the statistics +for that device with the shortest mount point name in the list of file systems +(@var{mtab}), i.e., it hides duplicate entries, unless the @option{-a} option is +specified. + +With the same logic, @command{df} elides a mount entry of a dummy pseudo 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 @samp{rootfs} is +not shown per default when already the real root device has been mounted. + @cindex disk device file @cindex device file, disk -If an argument @var{file} is a disk device file containing a mounted -file system, @command{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). @sc{gnu} @command{df} does not attempt to determine the disk usage +If an argument @var{file} resolves to a special file containing +a mounted file system, @command{df} shows the space available on that +file system rather than on the file system containing the device node. +GNU @command{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. +requires extremely nonportable intimate knowledge of file system structures. The program accepts the following options. Also see @ref{Common options}. @@ -9409,11 +11063,15 @@ The program accepts the following options. Also see @ref{Common options}. @itemx --all @opindex -a @opindex --all -@cindex automounter file systems @cindex ignore file systems -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. +Include in the listing dummy, duplicate, or inaccessible file systems, which +are omitted by default. Dummy file systems are typically special purpose +pseudo file systems such as @samp{/proc}, with no associated storage. +Duplicate file systems are local or remote file systems that are mounted +at separate locations in the local file hierarchy, or bind mounted locations. +Inaccessible file systems are those which are mounted but subsequently +over-mounted by another file system at that point, or otherwise inaccessible +due to permissions of the mount point etc. @item -B @var{size} @itemx --block-size=@var{size} @@ -9461,15 +11119,78 @@ This may make @command{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. +@item --output +@itemx --output[=@var{field_list}] +@opindex --output +Use the output format defined by @var{field_list}, or print all fields if +@var{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 @option{--output} together with each of the options @option{-i}, +@option{-P}, and @option{-T} is mutually exclusive. + +FIELD_LIST is a comma-separated list of columns to be included in @command{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 @var{field_list} are: +@table @samp +@item source +The source of the mount point, usually a device. +@item fstype +File system type. + +@item itotal +Total number of inodes. +@item iused +Number of used inodes. +@item iavail +Number of available inodes. +@item ipcent +Percentage of @var{iused} divided by @var{itotal}. + +@item size +Total number of blocks. +@item used +Number of used blocks. +@item avail +Number of available blocks. +@item pcent +Percentage of @var{used} divided by @var{size}. + +@item file +The file name if specified on the command line. +@item target +The mount point. +@end table + +The fields for block and inodes statistics are affected by the scaling +options like @option{-h} as usual. + +The definition of the @var{field_list} can even be split among several +@option{--output} uses. + +@example +#!/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 +@end example + + @item -P @itemx --portability @opindex -P @opindex --portability @cindex one-line output format -@cindex @acronym{POSIX} output format +@cindex POSIX output format @cindex portable output format @cindex output format, portable -Use the @acronym{POSIX} output format. This is like the default format except +Use the POSIX output format. This is like the default format except for the following: @enumerate @@ -9480,7 +11201,7 @@ that if the mount device name is more than 20 characters long (e.g., for some network mounts), the columns are misaligned. @item -The labels in the header output line are changed to conform to @acronym{POSIX}. +The labels in the header output line are changed to conform to POSIX. @item The default block size and output format are unaffected by the @@ -9500,6 +11221,21 @@ some systems (notably SunOS), doing this yields more up to date results, but in general this option makes @command{df} much slower, especially when there are many or very busy file systems. +@item --total +@opindex --total +@cindex grand total of disk size, usage and available space +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. If no arguments are specified +df will try harder to elide file systems insignificant to the total +available space, by suppressing duplicate remote file systems. + +For the grand total line, @command{df} prints @samp{"total"} into the +@var{source} column, and @samp{"-"} into the @var{target} column. +If there is no @var{source} column (see @option{--output}), then +@command{df} prints @samp{"total"} into the @var{target} column, +if present. + @item -t @var{fstype} @itemx --type=@var{fstype} @opindex -t @@ -9522,35 +11258,39 @@ the common names (this list is certainly not exhaustive): @table @samp @item nfs -@cindex @acronym{NFS} file system type -An @acronym{NFS} file system, i.e., one mounted over a network from another +@cindex NFS file system type +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. -@item 4.2@r{, }ufs@r{, }efs@dots{} +@item ext2@r{, }ext3@r{, }ext4@r{, }xfs@r{, }btrfs@dots{} @cindex Linux file system types @cindex local file system types -@opindex 4.2 @r{file system type} -@opindex ufs @r{file system type} -@opindex efs @r{file system type} +@opindex ext2 @r{file system type} +@opindex ext3 @r{file system type} +@opindex ext4 @r{file system type} +@opindex xfs @r{file system type} +@opindex btrfs @r{file system type} A file system on a locally-mounted hard disk. (The system might even support more than one type here; Linux does.) -@item hsfs@r{, }cdfs +@item iso9660@r{, }cdfs @cindex CD-ROM file system type -@cindex High Sierra file system -@opindex hsfs @r{file system type} +@cindex DVD file system type +@cindex ISO9660 file system type +@opindex iso9660 @r{file system type} @opindex cdfs @r{file system type} -A file system on a CD-ROM drive. HP-UX uses @samp{cdfs}, most other -systems use @samp{hsfs} (@samp{hs} for ``High Sierra''). +A file system on a CD or DVD drive. HP-UX uses @samp{cdfs}, most other +systems use @samp{iso9660}. -@item pcfs -@cindex PC file system +@item ntfs@r{,}fat +@cindex NTFS file system @cindex DOS file system @cindex MS-DOS file system -@cindex diskette file system -@opindex pcfs -An MS-DOS file system, usually on a diskette. +@cindex MS-Windows file system +@opindex ntfs @r{file system file} +@opindex fat @r{file system file} +File systems used by MS-Windows / MS-DOS. @end table @@ -9567,12 +11307,20 @@ Ignored; for compatibility with System V versions of @command{df}. @end table +@command{df} is installed only on systems that have usable mount tables, +so portable scripts should not rely on its existence. + @exitstatus Failure includes the case where no output is generated, so you can inspect the exit status of a command like @samp{df -t ext3 -t reiserfs @var{dir}} to test whether @var{dir} is on a file system of type @samp{ext3} or @samp{reiserfs}. +Since the list of file systems (@var{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 @option{-a}, @option{-l}, @option{-t} +or @option{-x} is used together with a file name argument. + @node du invocation @section @command{du}: Estimate file space usage @@ -9581,7 +11329,7 @@ inspect the exit status of a command like @samp{df -t ext3 -t reiserfs @cindex file space usage @cindex disk usage for files -@command{du} reports the amount of disk space used by the specified files +@command{du} reports the amount of disk space used by the set of specified files and for each subdirectory (of directory arguments). Synopsis: @example @@ -9593,17 +11341,24 @@ directory. Normally the disk space is printed in units of 1024 bytes, but this can be overridden (@pxref{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 @var{file} argument order affects which links +are counted, and changing the argument order may change the numbers +and entries that @command{du} outputs. + The program accepts the following options. Also see @ref{Common options}. @table @samp +@optNull + @item -a @itemx --all @opindex -a @opindex --all Show counts for all files, not just directories. -@itemx --apparent-size +@item --apparent-size @opindex --apparent-size Print apparent sizes, rather than disk usage. The apparent size of a file is the number of bytes reported by @code{wc -c} on regular files, @@ -9622,12 +11377,6 @@ 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. -@item -b -@itemx --bytes -@opindex -b -@opindex --bytes -Equivalent to @code{--apparent-size --block-size=1}. - @item -B @var{size} @itemx --block-size=@var{size} @opindex -B @@ -9636,6 +11385,12 @@ Equivalent to @code{--apparent-size --block-size=1}. Scale sizes by @var{size} before printing them (@pxref{Block size}). For example, @option{-BG} prints sizes in units of 1,073,741,824 bytes. +@item -b +@itemx --bytes +@opindex -b +@opindex --bytes +Equivalent to @code{--apparent-size --block-size=1}. + @item -c @itemx --total @opindex -c @@ -9654,29 +11409,35 @@ Does not affect other symbolic links. This is helpful for finding out the disk usage of directories, such as @file{/usr/tmp}, which are often symbolic links. -@itemx --files0-from=@var{FILE} -@opindex --files0-from=@var{FILE} -@cindex including files from @command{du} -Rather than processing files named on the command line, process those -named in file @var{FILE}; each name is terminated by a null byte. -This is useful with the @option{--total} (@option{-c}) option when -the list of file names is so long that it may exceed a command line -length limitation. -In such cases, running @command{du} via @command{xargs} is undesirable -because it splits the list into pieces and makes @command{du} print a -total for each sublist rather than for the entire list. -One way to produce a list of null-byte-terminated file names is with @sc{gnu} -@command{find}, using its @option{-print0} predicate. -Do not specify any @var{FILE} on the command line when using this option. +@item -d @var{depth} +@itemx --max-depth=@var{depth} +@opindex -d @var{depth} +@opindex --max-depth=@var{depth} +@cindex limiting output of @command{du} +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 @code{du --max-depth=0} is equivalent to @code{du -s}. -@optHumanReadable +@c --files0-from=FILE +@filesZeroFromOption{du,, with the @option{--total} (@option{-c}) option} @item -H @opindex -H -Currently, @option{-H} is the same as @option{--si}, -except that @option{-H} evokes a warning. -This option will be changed to be equivalent to -@option{--dereference-args} (@option{-D}). +Equivalent to @option{--dereference-args} (@option{-D}). + +@optHumanReadable + +@item --inodes +@opindex --inodes +@cindex inode usage, dereferencing in @command{du} +List inode usage information instead of block usage. +This option is useful for finding directories which contain many files, and +therefore eat up most of the inodes space of a file system (see @command{df}, +option @option{--inodes}). +It can well be combined with the options @option{-a}, @option{-c}, +@option{-h}, @option{-l}, @option{-s}, @option{-S}, @option{-t} and +@option{-x}; however, passing other options regarding the block size, for +example @option{-b}, @option{-m} and @option{--apparent-size}, is ignored. @item -k @opindex -k @@ -9685,14 +11446,6 @@ Print sizes in 1024-byte blocks, overriding the default block size (@pxref{Block size}). This option is equivalent to @option{--block-size=1K}. -@item -l -@itemx --count-links -@opindex -l -@opindex --count-links -@cindex hard links, counting in @command{du} -Count the size of all files, even if they have appeared already (as a -hard link). - @item -L @itemx --dereference @opindex -L @@ -9702,6 +11455,14 @@ 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). +@item -l +@itemx --count-links +@opindex -l +@opindex --count-links +@cindex hard links, counting in @command{du} +Count the size of all files, even if they have appeared already (as a +hard link). + @item -m @opindex -m @cindex mebibytes for file sizes @@ -9717,29 +11478,17 @@ This option is equivalent to @option{--block-size=1M}. For each symbolic links encountered by @command{du}, consider the disk space used by the symbolic link. -@item --max-depth=@var{DEPTH} -@opindex --max-depth=@var{DEPTH} -@cindex limiting output of @command{du} -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 @code{du --max-depth=0} is equivalent to @code{du -s}. - -@item -0 -@opindex -0 -@itemx --null -@opindex --null -@cindex output null-byte-terminated lines -Output a null byte at the end of each line, rather than a newline. -This option enables other programs to parse the output of @command{du} -even when that output would contain file names with embedded newlines. +@item -S +@itemx --separate-dirs +@opindex -S +@opindex --separate-dirs +Normally, in the output of @command{du} (when not using @option{--summarize}), +the size listed next to a directory name, @var{d}, represents the sum +of sizes of all entries beneath @var{d} as well as the size of @var{d} itself. +With @option{--separate-dirs}, the size reported for a directory name, +@var{d}, will exclude the size of any subdirectories. -@itemx --si -@opindex --si -@cindex SI output -Append an SI-style abbreviation to each size, such as @samp{MB} for -megabytes. Powers of 1000 are used, not 1024; @samp{MB} stands for -1,000,000 bytes. Use the @option{-h} or @option{--human-readable} option if -you prefer powers of 1024. +@optSi @item -s @itemx --summarize @@ -9747,20 +11496,61 @@ you prefer powers of 1024. @opindex --summarize Display only a total for each argument. -@item -S -@itemx --separate-dirs -@opindex -S -@opindex --separate-dirs -Report the size of each directory separately, not including the sizes -of subdirectories. +@item -t @var{size} +@itemx --threshold=@var{size} +@opindex -t +@opindex --threshold +Exclude entries based on a given @var{size}. The @var{size} refers to used +blocks in normal mode (@pxref{Block size}), or inodes count in conjunction +with the @option{--inodes} option. -@itemx --time +If @var{size} is positive, then @command{du} will only print entries with a size +greater than or equal to that. + +If @var{size} is negative, then @command{du} will only print entries with a size +smaller than or equal to that. + +Although GNU @command{find} can be used to find files of a certain size, +@command{du}'s @option{--threshold} option can be used to also filter +directories based on a given size. + +Please note that the @option{--threshold} option can be combined with the +@option{--apparent-size} option, and in this case would elide entries based on +its apparent size. + +Please note that the @option{--threshold} option can be combined with the +@option{--inodes} option, and in this case would elide entries based on +its inodes count. + +Here's how you would use @option{--threshold} to find directories with a size +greater than or equal to 200 megabytes: + +@example +du --threshold=200MB +@end example + +Here's how you would use @option{--threshold} to find directories and files - +note the @option{-a} - with an apparent size smaller than or equal to 500 bytes: + +@example +du -a -t -500 --apparent-size +@end example + +Here's how you would use @option{--threshold} to find directories on the root +file system with more than 20000 inodes used in the directory tree below: + +@example +du --inodes -x --threshold=20000 / +@end example + + +@item --time @opindex --time @cindex last modified dates, displaying in @command{du} Show time of the most recent modification of any file in the directory, or any of its subdirectories. -@itemx --time=ctime +@item --time=ctime @itemx --time=status @itemx --time=use @opindex --time @@ -9770,7 +11560,7 @@ or any of its subdirectories. Show the most recent status change time (the @samp{ctime} in the inode) of any file in the directory, instead of the modification time. -@itemx --time=atime +@item --time=atime @itemx --time=access @opindex --time @opindex atime@r{, show the most recent} @@ -9796,19 +11586,19 @@ with @command{date}, @var{format}'s interpretation is affected by the @env{LC_TIME} locale category. @item full-iso -List timestamps in full using @acronym{ISO} 8601 date, time, and time zone -format with nanosecond precision, e.g., @samp{2002-03-30 +List timestamps in full using ISO 8601 date, time, and time zone +components with nanosecond precision, e.g., @samp{2002-03-30 23:45:56.477817180 -0700}. This style is equivalent to @samp{+%Y-%m-%d %H:%M:%S.%N %z}. @item long-iso -List @acronym{ISO} 8601 date and time in minutes, e.g., +List ISO 8601 date and time components with minute precision, e.g., @samp{2002-03-30 23:45}. These timestamps are shorter than @samp{full-iso} timestamps, and are usually good enough for everyday work. This style is equivalent to @samp{+%Y-%m-%d %H:%M}. @item iso -List @acronym{ISO} 8601 dates for timestamps, e.g., @samp{2002-03-30}. +List ISO 8601 dates for timestamps, e.g., @samp{2002-03-30}. This style is equivalent to @samp{+%Y-%m-%d}. @end table @@ -9821,6 +11611,22 @@ the newline and any later characters are ignored; if @env{TIME_STYLE} begins with @samp{posix-} the @samp{posix-} is ignored; and if @env{TIME_STYLE} is @samp{locale} it is ignored. +@item -X @var{file} +@itemx --exclude-from=@var{file} +@opindex -X @var{file} +@opindex --exclude-from=@var{file} +@cindex excluding files from @command{du} +Like @option{--exclude}, except take the patterns to exclude from @var{file}, +one per line. If @var{file} is @samp{-}, take the patterns from standard +input. + +@item --exclude=@var{pattern} +@opindex --exclude=@var{pattern} +@cindex excluding files from @command{du} +When recursing, skip subdirectories or files matching @var{pattern}. +For example, @code{du --exclude='*.o'} excludes files whose names +end in @samp{.o}. + @item -x @itemx --one-file-system @opindex -x @@ -9829,22 +11635,6 @@ begins with @samp{posix-} the @samp{posix-} is ignored; and if Skip directories that are on different file systems from the one that the argument being processed is on. -@item --exclude=@var{PATTERN} -@opindex --exclude=@var{PATTERN} -@cindex excluding files from @command{du} -When recursing, skip subdirectories or files matching @var{PATTERN}. -For example, @code{du --exclude='*.o'} excludes files whose names -end in @samp{.o}. - -@item -X @var{FILE} -@itemx --exclude-from=@var{FILE} -@opindex -X @var{FILE} -@opindex --exclude-from=@var{FILE} -@cindex excluding files from @command{du} -Like @option{--exclude}, except take the patterns to exclude from @var{FILE}, -one per line. If @var{FILE} is @samp{-}, take the patterns from standard -input. - @end table @cindex NFS mounts from BSD to HP-UX @@ -9875,6 +11665,7 @@ 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, @command{stat} can also give information about the files the links point to. +@mayConflictWithShellBuiltIn{stat} @table @samp @@ -9895,6 +11686,7 @@ Without it, @command{stat} acts on any symbolic link argument directly. @cindex file systems Report information about the file systems where the given files are located instead of information about the files themselves. +This option implies the @option{-L} option. @item -c @itemx --format=@var{format} @@ -9911,7 +11703,7 @@ $ stat --format=%d:%i / /usr 2057:2 @end example -@itemx --printf=@var{format} +@item --printf=@var{format} @opindex --printf=@var{format} @cindex output format Use @var{format} rather than the default format. @@ -9933,13 +11725,31 @@ $ stat --printf='%d:%i\n' / /usr @cindex terse output Print the information in terse form, suitable for parsing by other programs. -The valid format sequences for files are: +The output of the following commands are identical and the @option{--format} +also identifies the items printed (in fuller form) in the default format. +Note the format string would include another @samp{%C} at the end with an +active SELinux security context. +@example +$ stat --format="%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o" ... +$ stat --terse ... +@end example + +The same illustrating terse output in @option{--file-system} mode: +@example +$ stat -f --format="%n %i %l %t %s %S %b %f %a %c %d" ... +$ stat -f --terse ... +@end example +@end table + +The valid @var{format} directives for files with @option{--format} and +@option{--printf} are: @itemize @bullet -@item %a - Access rights in octal +@item %a - Access rights in octal (note @samp{#} and @samp{0} printf flags) @item %A - Access rights in human readable form @item %b - Number of blocks allocated (see @samp{%B}) @item %B - The size in bytes of each block reported by @samp{%b} +@item %C - The SELinux security context of a file, if available @item %d - Device number in decimal @item %D - Device number in hex @item %f - Raw mode in hex @@ -9948,23 +11758,78 @@ The valid format sequences for files are: @item %G - Group name of owner @item %h - Number of hard links @item %i - Inode number +@item %m - Mount point (See note below) @item %n - File name @item %N - Quoted file name with dereference if symbolic link -@item %o - I/O block size +@item %o - Optimal I/O transfer size hint @item %s - Total size, in bytes -@item %t - Major device type in hex -@item %T - Minor device type in hex +@item %t - Major device type in hex (see below) +@item %T - Minor device type in hex (see below) @item %u - User ID of owner @item %U - User name of owner +@item %w - Time of file birth, or @samp{-} if unknown +@item %W - Time of file birth as seconds since Epoch, or @samp{0} @item %x - Time of last access @item %X - Time of last access as seconds since Epoch -@item %y - Time of last modification -@item %Y - Time of last modification as seconds since Epoch -@item %z - Time of last change -@item %Z - Time of last change as seconds since Epoch +@item %y - Time of last data modification +@item %Y - Time of last data modification as seconds since Epoch +@item %z - Time of last status change +@item %Z - Time of last status change as seconds since Epoch @end itemize -The valid format sequences for file systems are: +The @samp{%a} format prints the octal mode, and so it is useful +to control the zero padding of the output with the @samp{#} and @samp{0} +printf flags. For example to pad to at least 3 wide while making larger +numbers unambiguously octal, you can use @samp{%#03a}. + +The @samp{%t} and @samp{%T} formats operate on the st_rdev member of +the stat(2) structure, and are only defined for character and block +special files. On some systems or file types, st_rdev may be used to +represent other quantities. + +The @samp{%W}, @samp{%X}, @samp{%Y}, and @samp{%Z} formats accept a +precision preceded by a period to specify the number of digits to +print after the decimal point. For example, @samp{%.3X} outputs the +last access time to millisecond precision. If a period is given but no +precision, @command{stat} uses 9 digits, so @samp{%.X} is equivalent to +@samp{%.9X}@. When discarding excess precision, time stamps are truncated +toward minus infinity. + +@example +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] +@end example + +The mount point printed by @samp{%m} is similar to that output +by @command{df}, except that: +@itemize @bullet +@item +stat does not dereference symlinks by default +(unless @option{-L} is specified) +@item +stat does not search for specified device nodes in the +file system list, instead operating on them directly +@item +@cindex bind mount +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 +@end itemize + +When listing file system information (@option{--file-system} (@option{-f})), +you must use a different set of @var{format} directives: @itemize @bullet @item %a - Free blocks available to non-super-user @@ -9985,35 +11850,134 @@ The valid format sequences for file systems are: Time stamps are listed according to the time zone rules specified by the @env{TZ} environment variable, or by the system default rules if @env{TZ} is not set. @xref{TZ Variable,, Specifying the Time Zone -with @env{TZ}, libc, The GNU C Library}. -@end table +with @env{TZ}, libc, The GNU C Library Reference Manual}. @exitstatus @node sync invocation -@section @command{sync}: Synchronize data on disk with memory +@section @command{sync}: Synchronize cached writes to persistent storage @pindex sync @cindex synchronize disk and memory +@cindex Synchronize cached writes to persistent storage + +@command{sync} synchronizes in memory files or file systems to persistent +storage. Synopsis: + +@example +sync [@var{option}] [@var{file}]@dots{} +@end example @cindex superblock, writing @cindex inodes, written buffered @command{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 @command{sync} program does nothing but exercise the @code{sync} system -call. +The @command{sync} program does nothing but exercise the @code{sync}, +@code{syncfs}, @code{fsync}, and @code{fdatasync} system calls. @cindex crashes and corruption 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 @command{sync} command ensures everything in memory -is written to disk. +result. The @command{sync} command instructs the kernel to write +data in memory to persistent storage. + +If any argument is specified then only those files will be +synchronized using the fsync(2) syscall by default. + +If at least one file is specified, it is possible to change the +synchronization method with the following options. Also see +@ref{Common options}. + +@table @samp +@item -d +@itemx --data +@opindex --data +Use fdatasync(2) to sync only the data for the file, +and any metadata required to maintain file system consistency. + +@item -f +@itemx --file-system +@opindex --file-system +Synchronize all the I/O waiting for the file systems that contain the file, +using the syscall syncfs(2). Note you would usually @emph{not} specify +this option if passing a device node like @samp{/dev/sda} for example, +as that would sync the containing file system rather than the referenced one. +Note also that depending on the system, passing individual device nodes or files +may have different sync characteristics than using no arguments. +I.e., arguments passed to fsync(2) may provide greater guarantees through +write barriers, than a global sync(2) used when no arguments are provided. +@end table + +@exitstatus + + +@node truncate invocation +@section @command{truncate}: Shrink or extend the size of a file + +@pindex truncate +@cindex truncating, file sizes + +@command{truncate} shrinks or extends the size of each @var{file} to the +specified size. Synopsis: + +@example +truncate @var{option}@dots{} @var{file}@dots{} +@end example + +@cindex files, creating +Any @var{file} that does not exist is created. -Any arguments are ignored, except for a lone @option{--help} or -@option{--version} (@pxref{Common options}). +@cindex sparse files, creating +@cindex holes, creating files with +If a @var{file} is larger than the specified size, the extra data is lost. +If a @var{file} is shorter, it is extended and the extended part (or hole) +reads as zero bytes. + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item -c +@itemx --no-create +@opindex -c +@opindex --no-create +Do not create files that do not exist. + +@item -o +@itemx --io-blocks +@opindex -o +@opindex --io-blocks +Treat @var{size} as number of I/O blocks of the @var{file} rather than bytes. + +@item -r @var{rfile} +@itemx --reference=@var{rfile} +@opindex -r +@opindex --reference +Base the size of each @var{file} on the size of @var{rfile}. + +@item -s @var{size} +@itemx --size=@var{size} +@opindex -s +@opindex --size +Set or adjust the size of each @var{file} according to @var{size}. +@var{size} is in bytes unless @option{--io-blocks} is specified. +@multiplierSuffixesNoBlocks{size} + +@var{size} may also be prefixed by one of the following to adjust +the size of each @var{file} based on its current size: +@example +@samp{+} => extend by +@samp{-} => reduce by +@samp{<} => at most +@samp{>} => at least +@samp{/} => round down to multiple of +@samp{%} => round up to multiple of +@end example + +@end table @exitstatus @@ -10049,6 +12013,8 @@ space between each and a newline after the last one. Synopsis: echo [@var{option}]@dots{} [@var{string}]@dots{} @end example +@mayConflictWithShellBuiltIn{echo} + The program accepts the following options. Also see @ref{Common options}. Options must precede operands, and the normally-special argument @samp{--} has no special meaning and is treated like any other @@ -10071,11 +12037,13 @@ alert (bell) @item \b backspace @item \c -suppress trailing newline +produce no further output +@item \e +escape @item \f form feed @item \n -new line +newline @item \r carriage return @item \t @@ -10086,10 +12054,12 @@ vertical tab backslash @item \0@var{nnn} the eight-bit value that is the octal number @var{nnn} -(zero to three octal digits) +(zero to three octal digits), if @var{nnn} is +a nine-bit value, the ninth bit is ignored @item \@var{nnn} the eight-bit value that is the octal number @var{nnn} -(one to three octal digits) +(one to three octal digits), if @var{nnn} is +a nine-bit value, the ninth bit is ignored @item \x@var{hh} the eight-bit value that is the hexadecimal number @var{hh} (one or two hexadecimal digits) @@ -10111,7 +12081,7 @@ option-like arguments instead of treating them as options. For example, @code{echo -ne hello} outputs @samp{-ne hello} instead of plain @samp{hello}. -@acronym{POSIX} does not require support for any options, and says +POSIX does not require support for any options, and says that the behavior of @command{echo} is implementation-defined if any @var{string} contains a backslash or if the first argument is @option{-n}. Portable programs can use the @command{printf} command @@ -10133,8 +12103,12 @@ printf @var{format} [@var{argument}]@dots{} @command{printf} prints the @var{format} string, interpreting @samp{%} directives and @samp{\} escapes to format numeric and string arguments -in a way that is mostly similar to the C @samp{printf} function. The -differences are as follows: +in a way that is mostly similar to the C @samp{printf} function. +@xref{Output Conversion Syntax,, @command{printf} format directives, +libc, The GNU C Library Reference Manual}, for details. +The differences are listed below. + +@mayConflictWithShellBuiltIn{printf} @itemize @bullet @@ -10163,14 +12137,23 @@ one. @item @kindex %b -@command{printf} has an additional directive, @samp{%b}, which prints its +An additional directive @samp{%b}, prints its argument string with @samp{\} escapes interpreted in the same way as in the @var{format} string, except that octal escapes are of the form -@samp{\0@var{ooo}} where @var{ooo} is 0 to 3 octal digits. +@samp{\0@var{ooo}} where @var{ooo} is 0 to 3 octal digits. If +@samp{\@var{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. @item +@kindex %q +An additional directive @samp{%q}, prints its argument string +in a format that can be reused as input by most shells. +Non-printable characters are escaped with the POSIX proposed @samp{$''} syntax, +and shell metacharacters are quoted appropriately. +This is an equivalent format to @command{ls --quoting=shell-escape} output. + +@item Numeric arguments must be single C constants, possibly with leading @samp{+} or @samp{-}. For example, @samp{printf %.4d -3} outputs @samp{-0003}. @@ -10182,8 +12165,8 @@ then its value is the numeric value of the immediately following character. Any remaining characters are silently ignored if the @env{POSIXLY_CORRECT} environment variable is set; otherwise, a warning is printed. For example, @samp{printf "%d" "'a"} outputs -@samp{97} on hosts that use the @acronym{ASCII} character set, since -@samp{a} has the numeric value 97 in @acronym{ASCII}. +@samp{97} on hosts that use the ASCII character set, since +@samp{a} has the numeric value 97 in ASCII. @end itemize @@ -10193,13 +12176,17 @@ digits, but is printed according to the @env{LC_NUMERIC} category of the current locale. For example, in a locale whose radix character is a comma, the command @samp{printf %g 3.14} outputs @samp{3,14} whereas the command @samp{printf %g 3,14} is an error. +@xref{Floating point}. @kindex \@var{ooo} @kindex \x@var{hh} @command{printf} interprets @samp{\@var{ooo}} in @var{format} as an octal number -(if @var{ooo} is 1 to 3 octal digits) specifying a character to print, +(if @var{ooo} is 1 to 3 octal digits) specifying a byte to print, and @samp{\x@var{hh}} as a hexadecimal number (if @var{hh} is 1 to 2 hex digits) specifying a character to print. +Note however that when @samp{\@var{ooo}} specifies a number larger than 255, +@command{printf} ignores the ninth bit. +For example, @samp{printf '\400'} is equivalent to @samp{printf '\0'}. @kindex \uhhhh @kindex \Uhhhhhhhh @@ -10207,13 +12194,15 @@ digits) specifying a character to print. @cindex ISO/IEC 10646 @vindex LC_CTYPE @command{printf} interprets two character syntaxes introduced in -@acronym{ISO} C 99: -@samp{\u} for 16-bit Unicode (@acronym{ISO}/@acronym{IEC} 10646) +ISO C 99: +@samp{\u} for 16-bit Unicode (ISO/IEC 10646) characters, specified as four hexadecimal digits @var{hhhh}, and @samp{\U} for 32-bit Unicode characters, specified as eight hexadecimal digits @var{hhhhhhhh}. @command{printf} outputs the Unicode characters -according to the @env{LC_CTYPE} locale. +according to the @env{LC_CTYPE} locale. Unicode characters in the ranges +U+0000@dots{}U+009F, U+D800@dots{}U+DFFF cannot be specified by this syntax, +except for U+0024 ($), U+0040 (@@), and U+0060 (@`). The processing of @samp{\u} and @samp{\U} requires a full-featured @code{iconv} facility. It is activated on systems with glibc 2.2 (or newer), @@ -10228,26 +12217,26 @@ The Unicode character syntaxes are useful for writing strings in a locale independent way. For example, a string containing the Euro currency symbol @example -$ /usr/local/bin/printf '\u20AC 14.95' +$ env printf '\u20AC 14.95' @end example @noindent will be output correctly in all locales supporting the Euro symbol -(@acronym{ISO}-8859-15, UTF-8, and others). Similarly, a Chinese string +(ISO-8859-15, UTF-8, and others). Similarly, a Chinese string @example -$ /usr/local/bin/printf '\u4e2d\u6587' +$ env printf '\u4e2d\u6587' @end example @noindent will be output correctly in all Chinese locales (GB2312, BIG5, UTF-8, etc). -Note that in these examples, the full name of @command{printf} has been -given, to distinguish it from the GNU @code{bash} built-in function -@command{printf}. +Note that in these examples, the @command{printf} command has been +invoked via @command{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. @acronym{ASCII} characters mixed with \u +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 @@ -10329,7 +12318,7 @@ exits unsuccessfully, even when invoked with Portable programs should not assume that the exit status of @command{false} is 1, as it is greater than 1 on some -non-@acronym{GNU} hosts. +non-GNU hosts. @node true invocation @@ -10401,15 +12390,12 @@ test [ @var{option} @end example -@cindex conflicts with shell built-ins -@cindex built-in shell commands, conflicts with -Because most shells have a built-in @command{test} command, using an -unadorned @command{test} in a script or interactively may get you -different functionality than that described here. +@mayConflictWithShellBuiltIn{test} If @var{expression} is omitted, @command{test} returns false. If @var{expression} is a single argument, -@command{test} returns false if the argument is null and true otherwise. The argument +@command{test} returns false if the argument is null and true +otherwise. The argument can be any string, including strings like @samp{-d}, @samp{-1}, @samp{--}, @samp{--help}, and @samp{--version} that most other programs would treat as options. To get help and version information, @@ -10429,7 +12415,7 @@ Exit status: * File type tests:: -[bcdfhLpSt] * Access permission tests:: -[gkruwxOG] * File characteristic tests:: -e -s -nt -ot -ef -* String tests:: -z -n = != +* String tests:: -z -n = == != * Numeric tests:: -eq -ne -lt -le -gt -ge * Connectives for test:: ! -a -o @end menu @@ -10620,6 +12606,11 @@ True if the length of @var{string} is nonzero. @cindex equal string check True if the strings are equal. +@item @var{string1} == @var{string2} +@opindex == +@cindex equal string check +True if the strings are equal (synonym for =). + @item @var{string1} != @var{string2} @opindex != @cindex not-equal string check @@ -10634,9 +12625,9 @@ True if the strings are not equal. @cindex numeric tests @cindex arithmetic tests -Numeric relationals. The arguments must be entirely numeric (possibly -negative), or the special expression @w{@code{-l @var{string}}}, which -evaluates to the length of @var{string}. +Numeric relational operators. The arguments must be entirely numeric +(possibly negative), or the special expression @w{@code{-l @var{string}}}, +which evaluates to the length of @var{string}. @table @samp @@ -10676,25 +12667,55 @@ test 0x100 -eq 1 @cindex logical connectives @cindex connectives, logical -The usual logical connectives. +Note it's preferred to use shell logical primitives +rather than these logical connectives internal to @command{test}, +because an expression may become ambiguous +depending on the expansion of its parameters. + +For example, this becomes ambiguous when @samp{$1} +is set to @samp{'!'} and @samp{$2} to the empty string @samp{''}: + +@example +test "$1" -a "$2" +@end example + +and should be written as: + +@example +test "$1" && test "$2" +@end example + +Note the shell logical primitives also benefit from +short circuit operation, which can be significant +for file attribute tests. @table @samp @item ! @var{expr} @opindex ! True if @var{expr} is false. +@samp{!} has lower precedence than all parts of @var{expr}. +Note @samp{!} needs to be specified to the left +of a binary expression, I.e., @samp{'!' 1 -gt 2} +rather than @samp{1 '!' -gt 2}. +Also @samp{!} is often a shell special character +and is best used quoted. + @item @var{expr1} -a @var{expr2} @opindex -a @cindex logical and operator @cindex and operator True if both @var{expr1} and @var{expr2} are true. +@samp{-a} is left associative, +and has a higher precedence than @samp{-o}. @item @var{expr1} -o @var{expr2} @opindex -o @cindex logical or operator @cindex or operator True if either @var{expr1} or @var{expr2} is true. +@samp{-o} is left associative. @end table @@ -10721,7 +12742,7 @@ e.g., spaces. However, regardless of whether it is quoted, a string operand should not be a parenthesis or any of @command{expr}'s operators like @code{+}, so you cannot safely pass an arbitrary string @code{$str} to expr merely by quoting it to the shell. One way to -work around this is to use the @sc{gnu} extension @code{+}, +work around this is to use the GNU extension @code{+}, (e.g., @code{+ "$str" = foo}); a more portable way is to use @code{@w{" $str"}} and to adjust the rest of the expression to take the leading space into account (e.g., @code{@w{" $str" = " foo"}}). @@ -10739,6 +12760,10 @@ 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, @command{expr} uses +arbitrary-precision arithmetic; otherwise, it uses native arithmetic +types and may fail due to arithmetic overflow. + The only options are @option{--help} and @option{--version}. @xref{Common options}. Options must precede operands. @@ -10767,7 +12792,7 @@ Exit status: @cindex expressions, string @command{expr} supports pattern matching and other string operators. These -have lower precedence than both the numeric and relational operators (in +have higher precedence than both the numeric and relational operators (in the next sections). @table @samp @@ -10799,7 +12824,7 @@ expression operators. In the regular expression, @code{\+}, @code{\?}, and @code{\|} are operators which respectively match one or more, zero or one, or separate alternatives. SunOS and other @command{expr}'s treat these as regular -characters. (@acronym{POSIX} allows either behavior.) +characters. (POSIX allows either behavior.) @xref{Top, , Regular Expression Library, regex, Regex}, for details of regular expression syntax. Some examples are in @ref{Examples of expr}. @@ -10831,7 +12856,7 @@ or an operator like @code{/}. This makes it possible to test @code{expr length + "$x"} or @code{expr + "$x" : '.*/\(.\)'} and have it do the right thing even if the value of @var{$x} happens to be (for example) @code{/} or @code{index}. -This operator is a @acronym{GNU} extension. Portable shell scripts should use +This operator is a GNU extension. Portable shell scripts should use @code{@w{" $token"} : @w{' \(.*\)'}} instead of @code{+ "$token"}. @end table @@ -10847,8 +12872,9 @@ To make @command{expr} interpret keywords as strings, you must use the @cindex expressions, numeric @command{expr} supports the usual numeric operators, in order of increasing -precedence. The string operators (previous section) have lower precedence, -the connectives (next section) have higher. +precedence. These numeric operators have lower precedence than the +string operators described in the previous section, and higher precedence +than the connectives (next section). @table @samp @@ -10881,7 +12907,7 @@ integers; an error occurs if this cannot be done. @cindex relations, numeric or string @command{expr} supports the usual logical connectives and relations. These -are higher precedence than either the string or numeric operators +have lower precedence than the string and numeric operators (previous sections). Here is the list, lowest-precedence operator first. @table @samp @@ -10930,7 +12956,7 @@ Here are a few examples, including quoting for shell metacharacters. To add 1 to the shell variable @code{foo}, in Bourne-compatible shells: @example -foo=`expr $foo + 1` +foo=$(expr $foo + 1) @end example To print the non-directory part of the file name stored in @@ -10954,7 +12980,7 @@ expr index abcdef cz @result{} 3 expr index index a @error{} expr: syntax error -expr index quote index a +expr index + index a @result{} 0 @end example @@ -10971,12 +12997,12 @@ useful redirection is performed by a separate command, not by the shell; it's described here. @menu -* tee invocation:: Redirect output to multiple files. +* tee invocation:: Redirect output to multiple files or processes. @end menu @node tee invocation -@section @command{tee}: Redirect output to multiple files +@section @command{tee}: Redirect output to multiple files or processes @pindex tee @cindex pipe fitting @@ -10995,9 +13021,11 @@ 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 @option{-a} option is used. -A @var{file} of @samp{-} causes @command{tee} to send another copy of -input to standard output, but this is typically not that useful as the -copies are interleaved. +In previous versions of GNU coreutils (v5.3.0 - v8.23), a @var{file} of @samp{-} +caused @command{tee} to send another copy of input to standard output. +However, as the interleaved output was not very useful, @command{tee} now +conforms to POSIX which explicitly mandates it to treat @samp{-} as a file +with such name. The program accepts the following options. Also see @ref{Common options}. @@ -11015,8 +13043,158 @@ them. @opindex --ignore-interrupts Ignore interrupt signals. +@item -p +@itemx --output-error[=@var{mode}] +@opindex -p +@opindex --output-error +Adjust the behavior with errors on the outputs, +with the long form option supporting selection +between the following @var{mode}s: + +@table @samp +@item warn +Warn on error opening or writing any output, including pipes. +Writing is continued to still open files/pipes. +Exit status indicates failure if any output has an error. + +@item warn-nopipe +This is the default @var{mode} when not specified, +or when the short form @option{-p} is used. +Warn on error opening or writing any output, except pipes. +Writing is continued to still open files/pipes. +Exit status indicates failure if any non pipe output had an error. + +@item exit +Exit on error opening or writing any output, including pipes. + +@item exit-nopipe +Exit on error opening or writing any output, except pipes. +@end table + @end table +The @command{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: + +@example +wget http://example.com/some.iso && sha1sum some.iso +@end example + +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: + +@example +# slightly contrived, to demonstrate process substitution +wget -O - http://example.com/dvd.iso \ + | tee >(sha1sum > dvd.sha1) > dvd.iso +@end example + +That makes @command{tee} write not just to the expected output file, +but also to a pipe running @command{sha1sum} and saving the final +checksum in a file named @file{dvd.sha1}. + +Note, however, that this example relies on a feature of modern shells +called @dfn{process substitution} +(the @samp{>(command)} syntax, above; +@xref{Process Substitution,,Process Substitution, bash, +The Bash Reference Manual}.), +so it works with @command{zsh}, @command{bash}, and @command{ksh}, +but not with @command{/bin/sh}. So if you write code like this +in a shell script, be sure to start the script with @samp{#!/bin/bash}. + +Note also that if any of the process substitutions (or piped stdout) +might exit early without consuming all the data, the @option{-p} option +is needed to allow @command{tee} to continue to process the input +to any remaining outputs. + +Since the above example writes to one file and one process, +a more conventional and portable use of @command{tee} is even better: + +@example +wget -O - http://example.com/dvd.iso \ + | tee dvd.iso | sha1sum > dvd.sha1 +@end example + +You can extend this example to make @command{tee} write to two processes, +computing MD5 and SHA1 checksums in parallel. In this case, +process substitution is required: + +@example +wget -O - http://example.com/dvd.iso \ + | tee >(sha1sum > dvd.sha1) \ + >(md5sum > dvd.md5) \ + > dvd.iso +@end example + +This technique is also useful when you want to make a @emph{compressed} +copy of the contents of a pipe. +Consider a tool to graphically summarize disk usage data from @samp{du -ak}. +For a large hierarchy, @samp{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 @command{du} output: + +@example +du -ak | gzip -9 > /tmp/du.gz +gzip -d /tmp/du.gz | xdiskusage -a +@end example + +With @command{tee} and process substitution, you start the GUI +right away and eliminate the decompression completely: + +@example +du -ak | tee >(gzip -9 > /tmp/du.gz) | xdiskusage -a +@end example + +Finally, if you regularly create more than one type of +compressed tarball at once, for example when @code{make dist} creates +both @command{gzip}-compressed and @command{bzip2}-compressed tarballs, +there may be a better way. +Typical @command{automake}-generated @file{Makefile} rules create +the two compressed tar archives with commands in sequence, like this +(slightly simplified): + +@example +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 +@end example + +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: + +@example +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 +@end example + +If you want to further process the output from process substitutions, +and those processes write atomically (i.e., write less than the system's +PIPE_BUF size at a time), that's possible with a construct like: + +@example +tardir=your-pkg-M.N +tar chof - "$tardir" \ + | tee >(md5sum --tag) > >(sha256sum --tag) \ + | sort | gpg --clearsign > your-pkg-M.N.tar.sig +@end example + @exitstatus @@ -11031,8 +13209,10 @@ This section describes commands that manipulate file names. @menu * basename invocation:: Strip directory and suffix from a file name. -* dirname invocation:: Strip non-directory suffix from a file name. -* pathchk invocation:: Check file name portability. +* dirname invocation:: Strip last file name component. +* pathchk invocation:: Check file name validity and portability. +* mktemp invocation:: Create temporary file or directory. +* realpath invocation:: Print resolved file names. @end menu @@ -11051,6 +13231,7 @@ This section describes commands that manipulate file names. @example basename @var{name} [@var{suffix}] +basename @var{option}@dots{} @var{name}@dots{} @end example If @var{suffix} is specified and is identical to the end of @var{name}, @@ -11068,14 +13249,35 @@ for everything except file names containing a trailing newline. @end macro @basenameAndDirname -@acronym{POSIX} allows the implementation to define the results if -@var{name} is empty or @samp{//}. In the former case, @acronym{GNU} +POSIX allows the implementation to define the results if +@var{name} is empty or @samp{//}. In the former case, GNU @command{basename} returns the empty string. In the latter case, the result is @samp{//} on platforms where @var{//} is distinct from @var{/}, and @samp{/} on platforms where there is no difference. -The only options are @option{--help} and @option{--version}. @xref{Common -options}. Options must precede operands. +The program accepts the following options. Also see @ref{Common options}. +Options must precede operands. + +@table @samp + +@item -a +@itemx --multiple +@opindex -a +@opindex --multiple +Support more than one argument. Treat every argument as a @var{name}. +With this, an optional @var{suffix} must be specified using the +@option{-s} option. + +@item -s @var{suffix} +@itemx --suffix=@var{suffix} +@opindex -s +@opindex --suffix +Remove a trailing @var{suffix}. +This option implies the @option{-a} option. + +@optZero + +@end table @exitstatus @@ -11087,36 +13289,50 @@ 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 @end smallexample @node dirname invocation -@section @command{dirname}: Strip non-directory suffix from a file name +@section @command{dirname}: Strip last file name component @pindex dirname @cindex directory components, printing @cindex stripping non-directory suffix @cindex non-directory suffix, stripping -@command{dirname} prints all but the final slash-delimited component of -a string (presumably a file name). Synopsis: +@command{dirname} prints all but the final slash-delimited component +of each @var{name}. Slashes on either side of the final component are +also removed. If the string contains no slash, @command{dirname} +prints @samp{.} (meaning the current directory). Synopsis: @example -dirname @var{name} +dirname [@var{option}] @var{name}@dots{} @end example -If @var{name} is a single component, @command{dirname} prints @samp{.} -(meaning the current directory). +@var{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. @basenameAndDirname -@acronym{POSIX} allows the implementation to define the results if -@var{name} is @samp{//}. With @acronym{GNU} @command{dirname}, the +POSIX allows the implementation to define the results if +@var{name} is @samp{//}. With GNU @command{dirname}, the result is @samp{//} on platforms where @var{//} is distinct from @var{/}, and @samp{/} on platforms where there is no difference. -The only options are @option{--help} and @option{--version}. @xref{Common -options}. +The program accepts the following option. Also see @ref{Common options}. + +@table @samp + +@optZero + +@end table @exitstatus @@ -11125,6 +13341,10 @@ Examples: @smallexample # Output "/usr/bin". dirname /usr/bin/sort +dirname /usr/bin//.// + +# Output "dir1" followed by "dir2" +dirname dir1/str dir2/str # Output ".". dirname stdio.h @@ -11132,20 +13352,20 @@ dirname stdio.h @node pathchk invocation -@section @command{pathchk}: Check file name portability +@section @command{pathchk}: Check file name validity and portability @pindex pathchk @cindex file names, checking validity and portability @cindex valid file names, checking for @cindex portable file names, checking for -@command{pathchk} checks portability of file names. Synopsis: +@command{pathchk} checks validity and portability of file names. Synopsis: @example pathchk [@var{option}]@dots{} @var{name}@dots{} @end example -For each @var{name}, @command{pathchk} prints a message if any of +For each @var{name}, @command{pathchk} prints an error message if any of these conditions is true: @enumerate @@ -11171,30 +13391,30 @@ Options must precede operands. @item -p @opindex -p Instead of performing checks based on the underlying file system, -print a message if any of these conditions is true: +print an error message if any of these conditions is true: @enumerate @item A file name is empty. @item -The length of a file name or one of its components exceeds the -@acronym{POSIX} minimum limits for portability. +A file name contains a character outside the POSIX portable file +name character set, namely, the ASCII letters and digits, @samp{.}, +@samp{_}, @samp{-}, and @samp{/}. @item -A file name contains a character outside the portable file name -character set, namely, the ASCII letters and digits, @samp{-}, -@samp{.}, @samp{/}, and @samp{_}. +The length of a file name or one of its components exceeds the +POSIX minimum limits for portability. @end enumerate @item -P @opindex -P -Print a message if a file name is empty, or if it contains a component +Print an error message if a file name is empty, or if it contains a component that begins with @samp{-}. @item --portability @opindex --portability -Print a message if a file name is not portable to all @acronym{POSIX} +Print an error message if a file name is not portable to all POSIX hosts. This option is equivalent to @samp{-p -P}. @end table @@ -11207,6 +13427,293 @@ Exit status: 1 otherwise. @end display +@node mktemp invocation +@section @command{mktemp}: Create temporary file or directory + +@pindex mktemp +@cindex file names, creating temporary +@cindex directory, creating temporary +@cindex temporary files and directories + +@command{mktemp} manages the creation of temporary files and +directories. Synopsis: + +@example +mktemp [@var{option}]@dots{} [@var{template}] +@end example + +Safely create a temporary file or directory based on @var{template}, +and print its name. If given, @var{template} must include at least +three consecutive @samp{X}s in the last component. If omitted, the template +@samp{tmp.XXXXXXXXXX} is used, and option @option{--tmpdir} is +implied. The final run of @samp{X}s in the @var{template} will be replaced +by alpha-numeric characters; thus, on a case-sensitive file system, +and with a @var{template} including a run of @var{n} instances of @samp{X}, +there are @samp{62**@var{n}} potential file names. + +Older scripts used to create temporary files by simply joining the +name of the program with the process id (@samp{$$}) 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 @command{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 @command{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): + +@itemize @bullet + +@item +Create a temporary file in the current directory. +@example +$ mktemp file.XXXX +file.H47c +@end example + +@item +Create a temporary file with a known suffix. +@example +$ mktemp --suffix=.txt file-XXXX +file-H08W.txt +$ mktemp file-XXXX-XXXX.txt +file-XXXX-eI9L.txt +@end example + +@item +Create a secure fifo relative to the user's choice of @env{TMPDIR}, +but falling back to the current directory rather than @file{/tmp}. +Note that @command{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. +@example +$ dir=$(mktemp -p "$@{TMPDIR:-.@}" -d dir-XXXX) || exit 1 +$ fifo=$dir/fifo +$ mkfifo "$fifo" || @{ rmdir "$dir"; exit 1; @} +@end example + +@item +Create and use a temporary file if possible, but ignore failure. The +file will reside in the directory named by @env{TMPDIR}, if specified, +or else in @file{/tmp}. +@example +$ 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" +> @} +@end example + +@item +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. +@example +$ mktemp -u XXX +Gb9 +$ mktemp -u XXX +nzC +@end example + +@end itemize + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item -d +@itemx --directory +@opindex -d +@opindex --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. + +@item -q +@itemx --quiet +@opindex -q +@opindex --quiet +Suppress diagnostics about failure to create a file or directory. The +exit status will still reflect whether a file was created. + +@item -u +@itemx --dry-run +@opindex -u +@opindex --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. + +@item -p @var{dir} +@itemx --tmpdir[=@var{dir}] +@opindex -p +@opindex --tmpdir +Treat @var{template} relative to the directory @var{dir}. If +@var{dir} is not specified (only possible with the long option +@option{--tmpdir}) or is the empty string, use the value of +@env{TMPDIR} if available, otherwise use @samp{/tmp}. If this is +specified, @var{template} must not be absolute. However, +@var{template} can still contain slashes, although intermediate +directories must already exist. + +@item --suffix=@var{suffix} +@opindex --suffix +Append @var{suffix} to the @var{template}. @var{suffix} must not +contain slash. If @option{--suffix} is specified, @var{template} must +end in @samp{X}; if it is not specified, then an appropriate +@option{--suffix} is inferred by finding the last @samp{X} in +@var{template}. This option exists for use with the default +@var{template} and for the creation of a @var{suffix} that starts with +@samp{X}. + +@item -t +@opindex -t +Treat @var{template} as a single file relative to the value of +@env{TMPDIR} if available, or to the directory specified by +@option{-p}, otherwise to @samp{/tmp}. @var{template} must not +contain slashes. This option is deprecated; the use of @option{-p} +without @option{-t} offers better defaults (by favoring the command +line over @env{TMPDIR}) and more flexibility (by allowing intermediate +directories). + +@end table + +@cindex exit status of @command{mktemp} +Exit status: + +@display +0 if the file was created, +1 otherwise. +@end display + + +@node realpath invocation +@section @command{realpath}: Print the resolved file name. + +@pindex realpath +@cindex file names, canonicalization +@cindex symlinks, resolution +@cindex canonical file name +@cindex canonicalize a file name +@pindex realpath +@findex realpath + +@command{realpath} expands all symbolic links and resolves references to +@samp{/./}, @samp{/../} and extra @samp{/} characters. By default, +all but the last component of the specified files must exist. Synopsis: + +@example +realpath [@var{option}]@dots{} @var{file}@dots{} +@end example + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item -e +@itemx --canonicalize-existing +@opindex -e +@opindex --canonicalize-existing +Ensure that all components of the specified file names exist. +If any component is missing or unavailable, @command{realpath} will output +a diagnostic unless the @option{-q} option is specified, and exit with a +nonzero exit code. A trailing slash requires that the name resolve to a +directory. + +@item -m +@itemx --canonicalize-missing +@opindex -m +@opindex --canonicalize-missing +If any component of a specified file name is missing or unavailable, +treat it as a directory. + +@item -L +@itemx --logical +@opindex -L +@opindex --logical +Symbolic links are resolved in the specified file names, +but they are resolved after any subsequent @samp{..} components are processed. + +@item -P +@itemx --physical +@opindex -P +@opindex --physical +Symbolic links are resolved in the specified file names, +and they are resolved before any subsequent @samp{..} components are processed. +This is the default mode of operation. + +@item -q +@itemx --quiet +@opindex -q +@opindex --quiet +Suppress diagnostic messages for specified file names. + +@item --relative-to=@var{file} +@opindex --relative-to +@cindex relpath +Print the resolved file names relative to the specified file. +Note this option honors the @option{-m} and @option{-e} options +pertaining to file existence. + +@item --relative-base=@var{base} +@opindex --relative-base +This option is valid when used with @option{--relative-to}, and will restrict +the output of @option{--relative-to} so that relative names are output, +only when @var{file}s are descendants of @var{base}. Otherwise output the +absolute file name. If @option{--relative-to} was not specified, then +the descendants of @var{base} are printed relative to @var{base}. If +@option{--relative-to} is specified, then that directory must be a +descendant of @var{base} for this option to have an effect. +Note: this option honors the @option{-m} and @option{-e} +options pertaining to file existence. For example: + +@example +realpath --relative-to=/usr /tmp /usr/bin +@result{} ../tmp +@result{} bin +realpath --relative-base=/usr /tmp /usr/bin +@result{} /tmp +@result{} bin +@end example + +@item -s +@itemx --strip +@itemx --no-symlinks +@opindex -s +@opindex --strip +@opindex --no-symlinks +Do not resolve symbolic links. Only resolve references to +@samp{/./}, @samp{/../} and remove extra @samp{/} characters. +When combined with the @option{-m} option, realpath operates +only on the file name, and does not touch any actual file. + +@optZero + +@end table + +@cindex exit status of @command{realpath} +Exit status: + +@display +0 if all file names were printed without issue. +1 otherwise. +@end display + @node Working context @chapter Working context @@ -11234,19 +13741,41 @@ so forth. See also the user-related commands in the next section. @cindex current working directory, printing @cindex working directory, printing -@cindex symbolic links and @command{pwd} -@command{pwd} prints the fully resolved name of the current directory. -That is, all components of the printed name will be actual directory -names---none will be symbolic links. -@cindex conflicts with shell built-ins -@cindex built-in shell commands, conflicts with -Because most shells have a built-in @command{pwd} command, using an -unadorned @command{pwd} in a script or interactively may get you -different functionality than that described here. +@command{pwd} prints the name of the current directory. Synopsis: -The only options are a lone @option{--help} or -@option{--version}. @xref{Common options}. +@example +pwd [@var{option}]@dots{} +@end example + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp +@item -L +@itemx --logical +@opindex -L +@opindex --logical +If the contents of the environment variable @env{PWD} provide an +absolute name of the current directory with no @samp{.} or @samp{..} +components, but possibly with symbolic links, then output those +contents. Otherwise, fall back to default @option{-P} handling. + +@item -P +@itemx --physical +@opindex -P +@opindex --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. +@end table + +@cindex symbolic links and @command{pwd} +If @option{-L} and @option{-P} are both given, the last one takes +precedence. If neither option is given, then this implementation uses +@option{-P} as the default unless the @env{POSIXLY_CORRECT} +environment variable is set. + +@mayConflictWithShellBuiltIn{pwd} @exitstatus @@ -11293,8 +13822,9 @@ be used in combination with any line settings. @opindex --file Set the line opened by the file name specified in @var{device} instead of the tty line connected to standard input. This option is necessary -because opening a @acronym{POSIX} tty requires use of the @code{O_NONDELAY} flag to -prevent a @acronym{POSIX} tty from blocking until the carrier detect line is high if +because opening a POSIX tty requires use of the +@code{O_NONDELAY} flag to prevent a POSIX tty from blocking +until the carrier detect line is high if the @code{clocal} flag is not set. Hence, it is not always possible to allow the shell to open the device in the traditional manner. @@ -11315,12 +13845,17 @@ description. The descriptions themselves refer to the positive case, that is, when @emph{not} negated (unless stated otherwise, of course). -Some settings are not available on all @acronym{POSIX} systems, since they use -extensions. Such arguments are marked below with ``Non-@acronym{POSIX}'' in their -description. On non-@acronym{POSIX} systems, those or other settings also may not +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. +@command{stty} is installed only on platforms with the POSIX terminal +interface, so portable scripts should not rely on its existence on +non-POSIX platforms. + @exitstatus @menu @@ -11353,6 +13888,16 @@ May be negated. @cindex even parity Set odd parity (even if negated). May be negated. +@item cmspar +@opindex cmspar +@cindex constant parity +@cindex stick parity +@cindex mark parity +@cindex space parity +Use "stick" (mark/space) parity. If parodd is set, the parity bit is +always 1; if parodd is not set, the parity bit is always zero. +Non-POSIX@. May be negated. + @item cs5 @itemx cs6 @itemx cs7 @@ -11387,7 +13932,14 @@ Disable modem control signals. May be negated. @cindex hardware flow control @cindex flow control, hardware @cindex RTS/CTS flow control -Enable RTS/CTS flow control. Non-@acronym{POSIX}. May be negated. +Enable RTS/CTS flow control. Non-POSIX@. May be negated. + +@item cdtrdsr +@opindex cdtrdsr +@cindex hardware flow control +@cindex flow control, hardware +@cindex DTR/DSR flow control +Enable DTR/DSR flow control. Non-POSIX@. May be negated. @end table @@ -11395,6 +13947,7 @@ Enable RTS/CTS flow control. Non-@acronym{POSIX}. May be negated. @subsection Input settings @cindex input settings +These settings control operations on data received from the terminal. @table @samp @item ignbrk @@ -11450,7 +14003,7 @@ Assume input characters are UTF-8 encoded. May be negated. @opindex ixon @kindex C-s/C-q flow control @cindex XON/XOFF flow control -Enable XON/XOFF flow control (that is, @kbd{CTRL-S}/@kbd{CTRL-Q}). May +Enable XON/XOFF flow control (that is, @kbd{Ctrl-S}/@kbd{Ctrl-Q}). May be negated. @item ixoff @@ -11466,19 +14019,20 @@ empty again. May be negated. @item iuclc @opindex iuclc @cindex uppercase, translating to lowercase -Translate uppercase characters to lowercase. Non-@acronym{POSIX}. May be -negated. +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. @item ixany @opindex ixany Allow any character to restart output (only the start character -if negated). Non-@acronym{POSIX}. May be negated. +if negated). Non-POSIX@. May be negated. @item imaxbel @opindex imaxbel @cindex beeping at input buffer full Enable beeping and not flushing input buffer if a character arrives -when the input buffer is full. Non-@acronym{POSIX}. May be negated. +when the input buffer is full. Non-POSIX@. May be negated. @end table @@ -11486,7 +14040,7 @@ when the input buffer is full. Non-@acronym{POSIX}. May be negated. @subsection Output settings @cindex output settings -These arguments specify output-related operations. +These settings control operations on data sent to the terminal. @table @samp @item opost @@ -11496,74 +14050,76 @@ Postprocess output. May be negated. @item olcuc @opindex olcuc @cindex lowercase, translating to output -Translate lowercase characters to uppercase. Non-@acronym{POSIX}. May be -negated. +Translate lowercase characters to uppercase. Non-POSIX@. May be +negated. (Note ouclc is not currently implemented.) @item ocrnl @opindex ocrnl @cindex return, translating to newline -Translate carriage return to newline. Non-@acronym{POSIX}. May be negated. +Translate carriage return to newline. Non-POSIX@. May be negated. @item onlcr @opindex onlcr @cindex newline, translating to crlf -Translate newline to carriage return-newline. Non-@acronym{POSIX}. May be +Translate newline to carriage return-newline. Non-POSIX@. May be negated. @item onocr @opindex onocr -Do not print carriage returns in the first column. Non-@acronym{POSIX}. +Do not print carriage returns in the first column. Non-POSIX@. May be negated. @item onlret @opindex onlret -Newline performs a carriage return. Non-@acronym{POSIX}. May be negated. +Newline performs a carriage return. Non-POSIX@. May be negated. @item ofill @opindex ofill @cindex pad instead of timing for delaying -Use fill (padding) characters instead of timing for delays. Non-@acronym{POSIX}. +Use fill (padding) characters instead of timing for delays. +Non-POSIX@. May be negated. @item ofdel @opindex ofdel @cindex pad character -Use delete characters for fill instead of null characters. Non-@acronym{POSIX}. +Use ASCII DEL characters for fill instead of +ASCII NUL characters. Non-POSIX@. May be negated. @item nl1 @itemx nl0 @opindex nl@var{n} -Newline delay style. Non-@acronym{POSIX}. +Newline delay style. Non-POSIX. @item cr3 @itemx cr2 @itemx cr1 @itemx cr0 @opindex cr@var{n} -Carriage return delay style. Non-@acronym{POSIX}. +Carriage return delay style. Non-POSIX. @item tab3 @itemx tab2 @itemx tab1 @itemx tab0 @opindex tab@var{n} -Horizontal tab delay style. Non-@acronym{POSIX}. +Horizontal tab delay style. Non-POSIX. @item bs1 @itemx bs0 @opindex bs@var{n} -Backspace delay style. Non-@acronym{POSIX}. +Backspace delay style. Non-POSIX. @item vt1 @itemx vt0 @opindex vt@var{n} -Vertical tab delay style. Non-@acronym{POSIX}. +Vertical tab delay style. Non-POSIX. @item ff1 @itemx ff0 @opindex ff@var{n} -Form feed delay style. Non-@acronym{POSIX}. +Form feed delay style. Non-POSIX. @end table @@ -11585,7 +14141,7 @@ special characters. May be negated. @item iexten @opindex iexten -Enable non-@acronym{POSIX} special characters. May be negated. +Enable non-POSIX special characters. May be negated. @item echo @opindex echo @@ -11619,12 +14175,12 @@ characters. May be negated. @cindex case translation Enable input and output of uppercase characters by preceding their lowercase equivalents with @samp{\}, when @code{icanon} is set. -Non-@acronym{POSIX}. May be negated. +Non-POSIX@. May be negated. @item tostop @opindex tostop @cindex background jobs, stopping at terminal write -Stop background jobs that try to write to the terminal. Non-@acronym{POSIX}. +Stop background jobs that try to write to the terminal. Non-POSIX@. May be negated. @item echoprt @@ -11632,7 +14188,7 @@ May be negated. @opindex echoprt @opindex prterase Echo erased characters backward, between @samp{\} and @samp{/}. -Non-@acronym{POSIX}. May be negated. +Non-POSIX@. May be negated. @item echoctl @itemx ctlecho @@ -11641,7 +14197,7 @@ Non-@acronym{POSIX}. May be negated. @cindex control characters, using @samp{^@var{c}} @cindex hat notation for control characters Echo control characters in hat notation (@samp{^@var{c}}) instead -of literally. Non-@acronym{POSIX}. May be negated. +of literally. Non-POSIX@. May be negated. @item echoke @itemx crtkill @@ -11649,7 +14205,23 @@ of literally. Non-@acronym{POSIX}. May be negated. @opindex crtkill Echo the @code{kill} special character by erasing each character on the line as indicated by the @code{echoprt} and @code{echoe} settings, -instead of by the @code{echoctl} and @code{echok} settings. Non-@acronym{POSIX}. +instead of by the @code{echoctl} and @code{echok} settings. +Non-POSIX@. +May be negated. + +@item extproc +@opindex extproc +Enable @samp{LINEMODE}, which is used to avoid echoing +each character over high latency links. See also +@uref{ftp://ftp.rfc-editor.org/in-notes/rfc1116.txt, Internet RFC 1116}. +Non-POSIX@. +May be negated. + +@item flusho +@opindex flusho +Discard output. +Note this setting is currently ignored on GNU/Linux systems. +Non-POSIX@. May be negated. @end table @@ -11689,11 +14261,11 @@ Same as: @c This is too long to write inline. @example -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 +cread -ignbrk brkint -inlcr -igncr icrnl +icanon iexten echo echoe echok -echonl -noflsh +-ixoff -iutf8 -iuclc -ixany imaxbel -xcase -olcuc -ocrnl +opost -ofill onlcr -onocr -onlret nl0 cr0 tab0 bs0 vt0 ff0 +isig -tostop -ofdel -echoprt echoctl echoke -extproc @end example @noindent @@ -11712,8 +14284,8 @@ Same as: @example -ignbrk -brkint -ignpar -parmrk -inpck -istrip --inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany --imaxbel -opost -isig -icanon -xcase min 1 time 0 +-inlcr -igncr -icrnl -ixon -ixoff -icanon -opost +-isig -iuclc -ixany -imaxbel -xcase min 1 time 0 @end example @noindent @@ -11737,18 +14309,19 @@ If negated, same as @code{parenb istrip opost cs7}. @item decctlq @opindex decctlq -Same as @option{-ixany}. Non-@acronym{POSIX}. May be negated. +Same as @option{-ixany}. Non-POSIX@. May be negated. @item tabs @opindex tabs -Same as @code{tab0}. Non-@acronym{POSIX}. May be negated. If negated, same +Same as @code{tab0}. Non-POSIX@. May be negated. If negated, same as @code{tab3}. @item lcase @itemx LCASE @opindex lcase @opindex LCASE -Same as @code{xcase iuclc olcuc}. Non-@acronym{POSIX}. May be negated. +Same as @code{xcase iuclc olcuc}. Non-POSIX@. May be negated. +(Used for terminals with uppercase characters only.) @item crt @opindex crt @@ -11809,11 +14382,20 @@ End the line. @item eol2 @opindex eol2 -Alternate character to end the line. Non-@acronym{POSIX}. +Alternate character to end the line. Non-POSIX. + +@item discard +@opindex discard +@opindex flush +Alternate character to toggle discarding of output. Non-POSIX. @item swtch @opindex swtch -Switch to a different shell layer. Non-@acronym{POSIX}. +Switch to a different shell layer. Non-POSIX. + +@item status +@opindex status +Send an info signal. Not currently supported on Linux. Non-POSIX. @item start @opindex start @@ -11829,20 +14411,20 @@ Send a terminal stop signal. @item dsusp @opindex dsusp -Send a terminal stop signal after flushing the input. Non-@acronym{POSIX}. +Send a terminal stop signal after flushing the input. Non-POSIX. @item rprnt @opindex rprnt -Redraw the current line. Non-@acronym{POSIX}. +Redraw the current line. Non-POSIX. @item werase @opindex werase -Erase the last word typed. Non-@acronym{POSIX}. +Erase the last word typed. Non-POSIX. @item lnext @opindex lnext Enter the next character typed literally, even if it is a special -character. Non-@acronym{POSIX}. +character. Non-POSIX. @end table @@ -11872,13 +14454,27 @@ Set the output speed to @var{n}. @item rows @var{n} @opindex rows -Tell the tty kernel driver that the terminal has @var{n} rows. Non-@acronym{POSIX}. +Tell the tty kernel driver that the terminal has @var{n} rows. +Non-POSIX. @item cols @var{n} @itemx columns @var{n} @opindex cols @opindex columns -Tell the kernel that the terminal has @var{n} columns. Non-@acronym{POSIX}. +Tell the kernel that the terminal has @var{n} columns. Non-POSIX. + +@item drain +@opindex drain +@cindex nonblocking @command{stty} setting +Apply settings after first waiting for pending output to be transmitted. +This is enabled by default for GNU @command{stty}. +It is useful to disable this option +in cases where the system may be in a state where serial transmission +is not possible. +For example, if the system has received the @samp{DC3} character +with @code{ixon} (software flow control) enabled, then @command{stty} would +block without @code{-drain} being specified. +May be negated. Non-POSIX. @item size @opindex size @@ -11888,11 +14484,11 @@ 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 @env{LINES} and @env{COLUMNS} instead; however, GNU @command{stty} does not know anything about them.) -Non-@acronym{POSIX}. +Non-POSIX. @item line @var{n} @opindex line -Use line discipline @var{n}. Non-@acronym{POSIX}. +Use line discipline @var{n}. Non-POSIX. @item speed @opindex speed @@ -11900,13 +14496,29 @@ Print the terminal speed. @item @var{n} @cindex baud rate, setting -@c FIXME: Is this still true that the baud rate can't be set -@c higher than 38400? -Set the input and output speeds to @var{n}. @var{n} can be one -of: 0 50 75 110 134 134.5 150 200 300 600 1200 1800 2400 4800 9600 -19200 38400 @code{exta} @code{extb}. @code{exta} is the same as -19200; @code{extb} is the same as 38400. 0 hangs up the line if -@option{-clocal} is set. +Set the input and output speeds to @var{n}. @var{n} can be one of: 0 +50 75 110 134 134.5 150 200 300 600 1200 1800 2400 4800 9600 19200 +38400 @code{exta} @code{extb}. @code{exta} is the same as 19200; +@code{extb} is the same as 38400. Many systems, including GNU/Linux, +support higher speeds. The @command{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 @option{-clocal} is set. @end table @@ -11927,8 +14539,13 @@ If no @var{variable}s are specified, @command{printenv} prints the value of every environment variable. Otherwise, it prints the value of each @var{variable} that is set, and nothing for those that are not set. -The only options are a lone @option{--help} or @option{--version}. -@xref{Common options}. +The program accepts the following option. Also see @ref{Common options}. + +@table @samp + +@optNull + +@end table @cindex exit status of @command{printenv} Exit status: @@ -12011,12 +14628,20 @@ logins, groups, and so forth. running it if no user is specified. Synopsis: @example -id [@var{option}]@dots{} [@var{username}] +id [@var{option}]@dots{} [@var{user}] @end example +@var{user} can be either a user ID or a name, with name look-up +taking precedence unless the ID is specified with a leading @samp{+}. +@xref{Disambiguating names and IDs}. + +@vindex POSIXLY_CORRECT 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 @env{POSIXLY_CORRECT} environment variable is not set, +then print @samp{context=@var{c}}, where @var{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. @@ -12048,7 +14673,7 @@ Print the user or group name instead of the ID number. Requires @itemx --real @opindex -r @opindex --real -Print the real, instead of effective, user or group ID. Requires +Print the real, instead of effective, user or group ID@. Requires @option{-u}, @option{-g}, or @option{-G}. @item -u @@ -12057,10 +14682,43 @@ Print the real, instead of effective, user or group ID. Requires @opindex --user Print only the user ID. +@item -Z +@itemx --context +@opindex -Z +@opindex --context +@cindex SELinux +@cindex security context +Print only the security context of the process, which is generally +the user's security context inherited from the parent process. +If neither SELinux or SMACK is enabled then print a warning and +set the exit status to 1. + +@item -z +@itemx --zero +@opindex -z +@opindex --zero +Delimit output items with NUL characters. +This option is not permitted when using the default format. + +Example: +@example +$ id -Gn --zero +users <NUL> devs <NUL> +@end example + @end table -@exitstatus +@macro primaryAndSupplementaryGroups{cmd,arg} +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, @command{\cmd\} +will not reflect your changes within your existing login session. +Running @command{\cmd\} with a \arg\ causes the user and group +database to be consulted afresh, and so will give a different result. +@end macro +@primaryAndSupplementaryGroups{id,user argument} +@exitstatus @node logname invocation @section @command{logname}: Print current login name @@ -12091,7 +14749,7 @@ options}. @cindex printing the effective user ID @command{whoami} prints the user name associated with the current -effective user ID. It is equivalent to the command @samp{id -un}. +effective user ID@. It is equivalent to the command @samp{id -un}. The only options are @option{--help} and @option{--version}. @xref{Common options}. @@ -12110,7 +14768,8 @@ options}. groups for each given @var{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. Synopsis: +the list of that user's groups and the user name is separated from the +group list by a colon. Synopsis: @example groups [@var{username}]@dots{} @@ -12121,8 +14780,9 @@ The group lists are equivalent to the output of the command @samp{id -Gn}. The only options are @option{--help} and @option{--version}. @xref{Common options}. -@exitstatus +@primaryAndSupplementaryGroups{groups,list of users} +@exitstatus @node users invocation @section @command{users}: Print login names of users currently logged in @@ -12152,6 +14812,10 @@ that file instead. A common choice is @file{/var/log/wtmp}. The only options are @option{--help} and @option{--version}. @xref{Common options}. +The @command{users} command is installed only on platforms with the +POSIX @code{<utmpx.h>} include file or equivalent, so portable scripts +should not rely on its existence on non-POSIX platforms. + @exitstatus @@ -12195,7 +14859,7 @@ i}, as in @samp{who am i}. Time stamps are listed according to the time zone rules specified by the @env{TZ} environment variable, or by the system default rules if @env{TZ} is not set. @xref{TZ Variable,, Specifying the Time Zone -with @env{TZ}, libc, The GNU C Library}. +with @env{TZ}, libc, The GNU C Library Reference Manual}. The program accepts the following options. Also see @ref{Common options}. @@ -12223,12 +14887,31 @@ Print information corresponding to dead processes. @itemx --heading @opindex -H @opindex --heading -Print column headings. +Print a line of column headings. + +@item -l +@itemx --login +@opindex -l +@opindex --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 @samp{LOGIN}. + +@item --lookup +@opindex --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. @item -m @opindex -m Same as @samp{who am i}. +@item -p +@itemx --process +@opindex -p +@opindex --process +List active processes spawned by init. + @item -q @itemx --count @opindex -q @@ -12236,36 +14919,29 @@ Same as @samp{who am i}. Print only the login names and the number of users logged on. Overrides all other options. +@item -r +@itemx --runlevel +@opindex -r +@opindex --runlevel +Print the current (and maybe previous) run-level of the init process. + @item -s @opindex -s Ignored; for compatibility with other versions of @command{who}. -@itemx -u +@item -t +@itemx --time +@opindex -t +@opindex --time +Print last system clock change. + +@item -u @opindex -u @cindex idle time After the login time, print the number of hours and minutes that the user has been idle. @samp{.} means the user was active in the last minute. @samp{old} means the user has been idle for more than 24 hours. -@item -l -@itemx --login -@opindex -l -@opindex --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 @samp{LOGIN}. - -@itemx --lookup -@opindex --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. - -@item -H -@itemx --heading -@opindex -H -@opindex --heading -Print a line of column headings. - @item -w @itemx -T @itemx --mesg @@ -12288,6 +14964,10 @@ After each login name print a character indicating the user's message status: @end table +The @command{who} command is installed only on platforms with the +POSIX @code{<utmpx.h>} include file or equivalent, so portable scripts +should not rely on its existence on non-POSIX platforms. + @exitstatus @@ -12303,12 +14983,14 @@ information. @menu * date invocation:: Print or set system date and time. +* arch invocation:: Print machine hardware name. +* nproc invocation:: Print the number of processors. * uname invocation:: Print system information. * hostname invocation:: Print or set system name. * hostid invocation:: Print numeric host identifier. +* uptime invocation:: Print system uptime and load. @end menu - @node date invocation @section @command{date}: Print or set system date and time @@ -12334,7 +15016,7 @@ so the output looks like @samp{Thu Mar @ 3 13:47:51 PST 2005}. Normally, @command{date} uses the time zone rules indicated by the @env{TZ} environment variable, or the system default rules if @env{TZ} is not set. @xref{TZ Variable,, Specifying the Time Zone with -@env{TZ}, libc, The GNU C Library}. +@env{TZ}, libc, The GNU C Library Reference Manual}. @findex strftime @r{and @command{date}} @cindex time formats @@ -12356,6 +15038,9 @@ described below. * Padding and other flags:: Pad with zeros, spaces, etc. * Setting the time:: Changing the system clock. * Options for date:: Instead of the current time. +@detailmenu +* Date input formats:: Specifying date strings. +@end detailmenu * Examples of date:: Examples. @end menu @@ -12373,37 +15058,38 @@ hour (@samp{00}@dots{}@samp{23}) @item %I hour (@samp{01}@dots{}@samp{12}) @item %k -hour (@samp{ 0}@dots{}@samp{23}). -This is a @acronym{GNU} extension. +hour, space padded (@samp{ 0}@dots{}@samp{23}); equivalent to @samp{%_H}@. +This is a GNU extension. @item %l -hour (@samp{ 1}@dots{}@samp{12}). -This is a @acronym{GNU} extension. +hour, space padded (@samp{ 1}@dots{}@samp{12}); equivalent to @samp{%_I}@. +This is a GNU extension. @item %M minute (@samp{00}@dots{}@samp{59}) @item %N nanoseconds (@samp{000000000}@dots{}@samp{999999999}). -This is a @acronym{GNU} extension. +This is a GNU extension. @item %p locale's equivalent of either @samp{AM} or @samp{PM}; blank in many locales. Noon is treated as @samp{PM} and midnight as @samp{AM}. @item %P like @samp{%p}, except lower case. -This is a @acronym{GNU} extension. +This is a GNU extension. @item %r locale's 12-hour clock time (e.g., @samp{11:11:04 PM}) @item %R 24-hour hour and minute. Same as @samp{%H:%M}. -This is a @acronym{GNU} extension. @item %s @cindex epoch, seconds since @cindex seconds since the epoch @cindex beginning of time -seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC. +@cindex leap seconds +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. @xref{%s-examples}, for examples. -This is a @acronym{GNU} extension. +This is a GNU extension. @item %S +@cindex leap seconds second (@samp{00}@dots{}@samp{60}). This may be @samp{60} if leap seconds are supported. @item %T @@ -12411,29 +15097,28 @@ This may be @samp{60} if leap seconds are supported. @item %X locale's time representation (e.g., @samp{23:13:48}) @item %z -@w{@acronym{RFC} 2822/@acronym{ISO} 8601} style numeric time zone +@w{RFC 2822/ISO 8601} style numeric time zone (e.g., @samp{-0600} or @samp{+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 @env{TZ} environment variable. The time (and optionally, the time zone rules) can be overridden by the @option{--date} option. -This is a @acronym{GNU} extension. @item %:z -@w{@acronym{RFC} 3339/@acronym{ISO} 8601} style numeric time zone with +@w{RFC 3339/ISO 8601} style numeric time zone with @samp{:} (e.g., @samp{-06:00} or @samp{+05:30}), or nothing if no time zone is determinable. -This is a @acronym{GNU} extension. +This is a GNU extension. @item %::z Numeric time zone to the nearest second with @samp{:} (e.g., @samp{-06:00:00} or @samp{+05:30:00}), or nothing if no time zone is determinable. -This is a @acronym{GNU} extension. +This is a GNU extension. @item %:::z Numeric time zone with @samp{:} using the minimum necessary precision (e.g., @samp{-06}, @samp{+05:30}, or @samp{-04:56:02}), or nothing if no time zone is determinable. -This is a @acronym{GNU} extension. +This is a GNU extension. @item %Z alphabetic time zone abbreviation (e.g., @samp{EDT}), or nothing if no time zone is determinable. See @samp{%z} for how it is determined. @@ -12471,28 +15156,25 @@ date; same as @samp{%m/%d/%y} @item %e day of month, space padded; same as @samp{%_d} @item %F -full date in @acronym{ISO} 8601 format; same as @samp{%Y-%m-%d}. +full date in ISO 8601 format; same as @samp{%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@dots{}9999. -This is a @acronym{GNU} extension. @item %g -year corresponding to the @acronym{ISO} week number, but without the century +year corresponding to the ISO week number, but without the century (range @samp{00} through @samp{99}). This has the same format and value -as @samp{%y}, except that if the @acronym{ISO} week number (see +as @samp{%y}, except that if the ISO week number (see @samp{%V}) belongs to the previous or next year, that year is used instead. -This is a @acronym{GNU} extension. @item %G -year corresponding to the @acronym{ISO} week number. This has the -same format and value as @samp{%Y}, except that if the @acronym{ISO} +year corresponding to the ISO week number. This has the +same format and value as @samp{%Y}, except that if the ISO week number (see @samp{%V}) belongs to the previous or next year, that year is used instead. It is normally useful only if @samp{%V} is also used; for example, the format @samp{%G-%m-%d} is probably a mistake, since it combines the ISO week number year with the conventional month and day. -This is a @acronym{GNU} extension. @item %h same as @samp{%b} @item %j @@ -12506,12 +15188,12 @@ week number of year, with Sunday as the first day of the week (@samp{00}@dots{}@samp{53}). Days in a new year preceding the first Sunday are in week zero. @item %V -@acronym{ISO} week number, that is, the +ISO week number, that is, the week number of year, with Monday as the first day of the week (@samp{01}@dots{}@samp{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 @acronym{ISO} 8601 +the previous year, and the next week is week 1. (See the ISO 8601 standard.) @item %w day of week (@samp{0}@dots{}@samp{6}) with 0 corresponding to Sunday @@ -12561,7 +15243,7 @@ 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 @acronym{GNU} extension, @command{date} recognizes any of the +As a GNU extension, @command{date} recognizes any of the following optional flags after the @samp{%}: @table @samp @@ -12593,9 +15275,9 @@ date +%_d/%_m -d "Feb 1" @result{} 1/ 2 @end example -As a @acronym{GNU} extension, you can specify the field width +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 is of the field has less than the specified number of characters, +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, @samp{%9B} prints the right adjusted month name in a field of width 9. @@ -12630,11 +15312,9 @@ is available, it is ignored. If given an argument that does not start with @samp{+}, @command{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. The @option{--date} and @option{--set} options may not be -used with such an argument. The @option{--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. +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: @@ -12656,7 +15336,10 @@ last two digits of year (optional) second (optional) @end table -The @option{--set} option also sets the system clock; see the next section. +Note, the @option{--date} and @option{--set} options may not be used with an +argument in the above format. The @option{--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. @node Options for date @@ -12686,7 +15369,12 @@ format. It can contain month names, time zones, @samp{am} and @samp{pm}, @samp{yesterday}, etc. For example, @option{--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 @acronym{UTC}. +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: +@example +date -d "$(LC_TIME=C date)" +@end example @xref{Date input formats}. @item -f @var{datefile} @@ -12699,6 +15387,40 @@ input. This is useful when you have many dates to process, because the system overhead of starting up the @command{date} executable many times can be considerable. +@item -I[@var{timespec}] +@itemx --iso-8601[=@var{timespec}] +@opindex -I[@var{timespec}] +@opindex --iso-8601[=@var{timespec}] +Display the date using the ISO 8601 format, @samp{%Y-%m-%d}. + +The argument @var{timespec} specifies the number of additional +terms of the time to include. It can be one of the following: +@table @samp +@item auto +Print just the date. This is the default if @var{timespec} is omitted. + +@item hours +Append the hour of the day to the date. + +@item minutes +Append the hours and minutes. + +@item seconds +Append the hours, minutes and seconds. + +@item ns +Append the hours, minutes, seconds and nanoseconds. +@end table + +If showing any time terms, then include the time zone using the format +@samp{%:z}. +@macro dateParseNote +This format is always suitable as input +for the @option{--date} (@option{-d}) and @option{--file} +(@option{-f}) options, regardless of the current locale. +@end macro +@dateParseNote + @item -r @var{file} @itemx --reference=@var{file} @opindex -r @@ -12722,7 +15444,7 @@ Fri, 09 Sep 2005 13:51:39 -0700 This format conforms to @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2822.txt, Internet -@acronym{RFCs} 2822} and +RFCs 2822} and @uref{ftp://ftp.rfc-editor.org/in-notes/rfc822.txt, 822}, the current and previous standards for Internet email. @@ -12730,12 +15452,10 @@ current and previous standards for Internet email. @opindex --rfc-3339=@var{timespec} Display the date using a format specified by @uref{ftp://ftp.rfc-editor.org/in-notes/rfc3339.txt, Internet -@acronym{RFC} 3339}. This is a subset of the @acronym{ISO} 8601 +RFC 3339}. This is a subset of the ISO 8601 format, except that it also permits applications to use a space rather -than a @samp{T} to separate dates from times. Unlike the other -standard formats, @acronym{RFC} 3339 format is always suitable as -input for the @option{--date} (@option{-d}) and @option{--file} -(@option{-f}) options, regardless of the current locale. +than a @samp{T} to separate dates from times. +@dateParseNote The argument @var{timespec} specifies how much of the time to include. It can be one of the following: @@ -12749,7 +15469,7 @@ This is equivalent to the format @samp{%Y-%m-%d}. Print the full-date and full-time separated by a space, e.g., @samp{2005-09-14 00:56:06+05:30}. The output ends with a numeric time-offset; here the @samp{+05:30} means that local time is five -hours and thirty minutes east of @acronym{UTC}. This is equivalent to +hours and thirty minutes east of UTC@. This is equivalent to the format @samp{%Y-%m-%d %H:%M:%S%:z}. @item ns @@ -12764,6 +15484,7 @@ This is equivalent to the format @samp{%Y-%m-%d %H:%M:%S.%N%:z}. @opindex -s @opindex --set Set the date and time to @var{datestr}. See @option{-d} above. +See also @ref{Setting the time}. @item -u @itemx --utc @@ -12775,12 +15496,15 @@ Set the date and time to @var{datestr}. See @option{-d} above. @cindex UTC @cindex Greenwich Mean Time @cindex GMT +@cindex leap seconds @vindex TZ -Use Coordinated Universal Time (@acronym{UTC}) by operating as if the +Use Coordinated Universal Time (UTC) by operating as if the @env{TZ} environment variable were set to the string @samp{UTC0}. Coordinated -Universal Time is often called ``Greenwich Mean Time'' (@sc{gmt}) for +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. @end table @@ -12828,7 +15552,7 @@ for example @samp{date -d 1may '+%B %d'} will print @samp{May 01}. @item To print a date without the leading zero for one-digit days -of the month, you can use the (@acronym{GNU} extension) +of the month, you can use the (GNU extension) @samp{-} flag to suppress the padding altogether: @@ -12838,7 +15562,7 @@ date -d 1may '+%B %-d @item To print the current date and time in the format required by many -non-@acronym{GNU} versions of @command{date} when setting the system clock: +non-GNU versions of @command{date} when setting the system clock: @example date +%m%d%H%M%Y.%S @@ -12852,7 +15576,7 @@ date --set='+2 minutes' @end example @item -To print the date in @acronym{RFC} 2822 format, +To print the date in RFC 2822 format, use @samp{date --rfc-2822}. Here is some example output: @example @@ -12931,9 +15655,99 @@ date -u -d '1970-01-01 946684800 seconds' +"%Y-%m-%d %T %z" 2000-01-01 00:00:00 +0000 @end smallexample +@item +@cindex leap seconds +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: + +@example +# 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 +@end example + +@example +# 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 +@end example + @end itemize +@node arch invocation +@section @command{arch}: Print machine hardware name + +@pindex arch +@cindex print machine hardware name +@cindex system information, printing + +@command{arch} prints the machine hardware name, +and is equivalent to @samp{uname -m}. +Synopsis: + +@example +arch [@var{option}] +@end example + +The program accepts the @ref{Common options} only. + +@command{arch} is not installed by default, so portable scripts should +not rely on its existence. + +@exitstatus + + +@node nproc invocation +@section @command{nproc}: Print the number of available processors + +@pindex nproc +@cindex Print the number of processors +@cindex system information, printing + +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 @env{OMP_NUM_THREADS} environment variable is +set, then it will determine the returned value. The result is guaranteed to be +greater than zero. Synopsis: + +@example +nproc [@var{option}] +@end example + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item --all +@opindex --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 @env{OMP_NUM_THREADS} environment variable is not honored in this case. + +@item --ignore=@var{number} +@opindex --ignore +If possible, exclude this @var{number} of processing units. + +@end table + +@exitstatus + + @node uname invocation @section @command{uname}: Print system information @@ -12963,7 +15777,8 @@ parsed reliably. In the following example, @var{release} is @smallexample uname -a -@result{} Linux dum 2.2.18 #4 SMP Tue Jun 5 11:24:08 PDT 2001 i686 unknown unknown GNU/Linux +@result{} Linux dumdum 2.2.18 #4 SMP Tue Jun 5 11:24:08 PDT 2001 i686@c + unknown unknown GNU/Linux @end smallexample @@ -12987,8 +15802,8 @@ and the hardware platform name if they are unknown. @cindex platform, hardware Print the hardware platform name (sometimes called the hardware implementation). -Print @samp{unknown} if the kernel does not make this information -easily available, as is the case with Linux kernels. +Print @samp{unknown} if this information is not available. +Note this is non-portable (even across GNU/Linux distributions). @item -m @itemx --machine @@ -13016,8 +15831,8 @@ Print the network node hostname. @cindex host processor type Print the processor type (sometimes called the instruction set architecture or ISA). -Print @samp{unknown} if the kernel does not make this information -easily available, as is the case with Linux kernels. +Print @samp{unknown} if this information is not available. +Note this is non-portable (even across GNU/Linux distributions). @item -o @itemx --operating-system @@ -13041,9 +15856,9 @@ Print the kernel release. @cindex kernel name @cindex name of kernel Print the kernel name. -@acronym{POSIX} 1003.1-2001 (@pxref{Standards conformance}) calls this +POSIX 1003.1-2001 (@pxref{Standards conformance}) calls this ``the implementation of the operating system'', because the -@acronym{POSIX} specification itself has no notion of ``kernel''. +POSIX specification itself has no notion of ``kernel''. The kernel name might be the same as the operating system name printed by the @option{-o} or @option{--operating-system} option, but it might differ. Some operating systems (e.g., FreeBSD, HP-UX) have the same @@ -13084,11 +15899,15 @@ hostname [@var{name}] The only options are @option{--help} and @option{--version}. @xref{Common options}. +@command{hostname} is not installed by default, and other packages +also supply a @command{hostname} command, so portable scripts should +not rely on its existence or on the exact behavior documented above. + @exitstatus @node hostid invocation -@section @command{hostid}: Print numeric host identifier. +@section @command{hostid}: Print numeric host identifier @pindex hostid @cindex printing the host identifier @@ -13109,8 +15928,240 @@ 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. +@command{hostid} is installed only on systems that have the +@code{gethostid} function, so portable scripts should not rely on its +existence. + +@exitstatus + +@node uptime invocation +@section @command{uptime}: Print system uptime and load + +@pindex uptime +@cindex printing the system uptime and load + +@command{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 (@command{uptime --help} indicates +the default setting). + +The only options are @option{--help} and @option{--version}. +@xref{Common options}. + +For example, here's what it prints right now on one system I use: + +@example +$ uptime + 14:07 up 3:35, 3 users, load average: 1.39, 1.15, 1.04 +@end example + +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. + +@command{uptime} is installed only on platforms with infrastructure +for obtaining the boot time, and other packages also supply an +@command{uptime} command, so portable scripts should not rely on its +existence or on the exact behavior documented above. + +@exitstatus + +@node SELinux context +@chapter SELinux context + +@cindex SELinux context +@cindex SELinux, context +@cindex commands for SELinux context + +This section describes commands for operations with SELinux +contexts. + +@menu +* chcon invocation:: Change SELinux context of file +* runcon invocation:: Run a command in specified SELinux context +@end menu + +@node chcon invocation +@section @command{chcon}: Change SELinux context of file + +@pindex chcon +@cindex changing security context +@cindex change SELinux context + +@command{chcon} changes the SELinux security context of the selected files. +Synopses: + +@smallexample +chcon [@var{option}]@dots{} @var{context} @var{file}@dots{} +chcon [@var{option}]@dots{} [-u @var{user}] [-r @var{role}] [-l @var{range}]@c + [-t @var{type}] @var{file}@dots{} +chcon [@var{option}]@dots{} --reference=@var{rfile} @var{file}@dots{} +@end smallexample + +Change the SELinux security context of each @var{file} to @var{context}. +With @option{--reference}, change the security context of each @var{file} +to that of @var{rfile}. + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item --dereference +@opindex --dereference +Do not affect symbolic links but what they refer to; this is the default. + +@item -h +@itemx --no-dereference +@opindex -h +@opindex --no-dereference +@cindex no dereference +Affect the symbolic links themselves instead of any referenced file. + +@item --reference=@var{rfile} +@opindex --reference +@cindex reference file +Use @var{rfile}'s security context rather than specifying a @var{context} value. + +@item -R +@itemx --recursive +@opindex -R +@opindex --recursive +Operate on files and directories recursively. + +@item --preserve-root +@opindex --preserve-root +Refuse to operate recursively on the root directory, @file{/}, +when used together with the @option{--recursive} option. +@xref{Treating / specially}. + +@item --no-preserve-root +@opindex --no-preserve-root +Do not treat the root directory, @file{/}, specially when operating +recursively; this is the default. +@xref{Treating / specially}. + +@choptH +@xref{Traversing symlinks}. + +@choptL +@xref{Traversing symlinks}. + +@choptP +@xref{Traversing symlinks}. + +@item -v +@itemx --verbose +@opindex -v +@opindex --verbose +@cindex diagnostic +Output a diagnostic for every file processed. + +@item -u @var{user} +@itemx --user=@var{user} +@opindex -u +@opindex --user +Set user @var{user} in the target security context. + +@item -r @var{role} +@itemx --role=@var{role} +@opindex -r +@opindex --role +Set role @var{role} in the target security context. + +@item -t @var{type} +@itemx --type=@var{type} +@opindex -t +@opindex --type +Set type @var{type} in the target security context. + +@item -l @var{range} +@itemx --range=@var{range} +@opindex -l +@opindex --range +Set range @var{range} in the target security context. + +@end table + @exitstatus +@node runcon invocation +@section @command{runcon}: Run a command in specified SELinux context + +@pindex runcon +@cindex run with security context + + +@command{runcon} runs file in specified SELinux security context. + +Synopses: +@smallexample +runcon @var{context} @var{command} [@var{args}] +runcon [ -c ] [-u @var{user}] [-r @var{role}] [-t @var{type}]@c + [-l @var{range}] @var{command} [@var{args}] +@end smallexample + +Run @var{command} with completely-specified @var{context}, or with +current or transitioned security context modified by one or more of @var{level}, +@var{role}, @var{type} and @var{user}. + +If none of @option{-c}, @option{-t}, @option{-u}, @option{-r}, or @option{-l} +is specified, the first argument is used as the complete context. +Any additional arguments after @var{command} +are interpreted as arguments to the command. + +With neither @var{context} nor @var{command}, print the current +security context. + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item -c +@itemx --compute +@opindex -c +@opindex --compute +Compute process transition context before modifying. + +@item -u @var{user} +@itemx --user=@var{user} +@opindex -u +@opindex --user +Set user @var{user} in the target security context. + +@item -r @var{role} +@itemx --role=@var{role} +@opindex -r +@opindex --role +Set role @var{role} in the target security context. + +@item -t @var{type} +@itemx --type=@var{type} +@opindex -t +@opindex --type +Set type @var{type} in the target security context. + +@item -l @var{range} +@itemx --range=@var{range} +@opindex -l +@opindex --range +Set range @var{range} in the target security context. + +@end table + +@cindex exit status of @command{runcon} +Exit status: + +@display +126 if @var{command} is found but cannot be invoked +127 if @command{runcon} itself fails or if @var{command} cannot be found +the exit status of @var{command} otherwise +@end display @node Modified command invocation @chapter Modified command invocation @@ -13128,7 +16179,8 @@ user, etc. * env invocation:: Modify environment variables. * nice invocation:: Modify niceness. * nohup invocation:: Immunize to hangups. -* su invocation:: Modify user and group ID. +* stdbuf invocation:: Modify buffering of standard streams. +* timeout invocation:: Run with time limit. @end menu @@ -13140,25 +16192,70 @@ user, etc. @cindex root directory, running a program in a specified @command{chroot} runs a command with a specified root directory. -On many systems, only the super-user can do this. +On many systems, only the super-user can do this.@footnote{However, +some systems (e.g., FreeBSD) can be configured to allow certain regular +users to use the @code{chroot} system call, and hence to run this program. +Also, on Cygwin, anyone can run the @command{chroot} command, because the +underlying function is non-privileged due to lack of support in MS-Windows. +Furthermore, the @command{chroot} command avoids the @code{chroot} system call +when @var{newroot} is identical to the old @file{/} directory for consistency +with systems where this is allowed for non-privileged users.}. Synopses: @example -chroot @var{newroot} [@var{command} [@var{args}]@dots{}] +chroot @var{option} @var{newroot} [@var{command} [@var{args}]@dots{}] chroot @var{option} @end example Ordinarily, file names are looked up starting at the root of the directory structure, i.e., @file{/}. @command{chroot} changes the root to -the directory @var{newroot} (which must exist) and then runs -@var{command} with optional @var{args}. If @var{command} is not -specified, the default is the value of the @env{SHELL} environment -variable or @command{/bin/sh} if not set, invoked with the @option{-i} option. +the directory @var{newroot} (which must exist), then changes the working +directory to @file{/}, and finally runs @var{command} with optional @var{args}. +If @var{command} is not specified, the default is the value of the @env{SHELL} +environment variable or @command{/bin/sh} if not set, invoked with the +@option{-i} option. @var{command} must not be a special built-in utility (@pxref{Special built-in utilities}). -The only options are @option{--help} and @option{--version}. @xref{Common -options}. Options must precede operands. +The program accepts the following options. Also see @ref{Common options}. +Options must precede operands. + +@table @samp + +@item --groups=@var{groups} +@opindex --groups +Use this option to override the supplementary @var{groups} to be +used by the new process. +The items in the list (names or numeric IDs) must be separated by commas. +Use @samp{--groups=''} to disable the supplementary group look-up +implicit in the @option{--userspec} option. + +@item --userspec=@var{user}[:@var{group}] +@opindex --userspec +By default, @var{command} is run with the same credentials +as the invoking process. +Use this option to run it as a different @var{user} and/or with a +different primary @var{group}. +If a @var{user} is specified then the supplementary groups +are set according to the system defined list for that user, +unless overridden with the @option{--groups} option. + +@item --skip-chdir +@opindex --skip-chdir +Use this option to not change the working directory to @file{/} after changing +the root directory to @var{newroot}, i.e., inside the chroot. +This option is only permitted when @var{newroot} is the old @file{/} directory, +and therefore is mostly useful together with the @option{--groups} and +@option{--userspec} options to retain the previous working directory. + +@end table + +The user and group name look-up performed by the @option{--userspec} +and @option{--groups} options, is done both outside and inside +the chroot, with successful look-ups inside the chroot taking precedence. +If the specified user or group items are intended to represent a numeric ID, +then a name to ID resolving step is avoided by specifying a leading @samp{+}. +@xref{Disambiguating names and IDs}. Here are a few tips to help avoid common problems in using chroot. To start with a simple example, make @var{command} refer to a statically @@ -13188,11 +16285,15 @@ 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. +@command{chroot} is installed only on systems that have the +@code{chroot} function, so portable scripts should not rely on its +existence. + @cindex exit status of @command{chroot} Exit status: @display -1 if @command{chroot} itself fails +125 if @command{chroot} itself fails 126 if @var{command} is found but cannot be invoked 127 if @var{command} cannot be found the exit status of @var{command} otherwise @@ -13223,9 +16324,9 @@ 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 @samp{=} and the null character (@acronym{ASCII} -@sc{nul}). However, it is wise to limit yourself to names that -consist solely of underscores, digits, and @acronym{ASCII} letters, +characters other than @samp{=} 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. @@ -13237,17 +16338,89 @@ remaining arguments are passed as arguments to that program. The program should not be a special built-in utility (@pxref{Special built-in utilities}). +Modifications to @env{PATH} take effect prior to searching for +@var{command}. Use caution when reducing @env{PATH}; behavior is +not portable when @env{PATH} is undefined or omits key directories +such as @file{/bin}. + +In the rare case that a utility contains a @samp{=} in the name, the +only way to disambiguate it from a variable assignment is to use an +intermediate command for @var{command}, and pass the problematic +program name via @var{args}. For example, if @file{./prog=} is an +executable in the current @env{PATH}: + +@example +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=' +@end example + @cindex environment, printing If no command name is specified following the environment specifications, the resulting environment is printed. This is like specifying the @command{printenv} program. +For some examples, suppose the environment passed to @command{env} +contains @samp{LOGNAME=rms}, @samp{EDITOR=emacs}, and +@samp{PATH=.:/gnubin:/hacks}: + +@itemize @bullet + +@item +Output the current environment. +@example +$ env | LC_ALL=C sort +EDITOR=emacs +LOGNAME=rms +PATH=.:/gnubin:/hacks +@end example + +@item +Run @command{foo} with a reduced environment, preserving only the +original @env{PATH} to avoid problems in locating @command{foo}. +@example +env - PATH="$PATH" foo +@end example + +@item +Run @command{foo} with the environment containing @samp{LOGNAME=rms}, +@samp{EDITOR=emacs}, and @samp{PATH=.:/gnubin:/hacks}, and guarantees +that @command{foo} was found in the file system rather than as a shell +built-in. +@example +env foo +@end example + +@item +Run @command{nemacs} with the environment containing @samp{LOGNAME=foo}, +@samp{EDITOR=emacs}, @samp{PATH=.:/gnubin:/hacks}, and +@samp{DISPLAY=gnu:0}. +@example +env DISPLAY=gnu:0 LOGNAME=foo nemacs +@end example + +@item +Attempt to run the program @command{/energy/--} (as that is the only +possible path search result); if the command exists, the environment +will contain @samp{LOGNAME=rms} and @samp{PATH=/energy}, and the +arguments will be @samp{e=mc2}, @samp{bar}, and @samp{baz}. +@example +env -u EDITOR PATH=/energy -- e=mc2 bar baz +@end example + +@end itemize + + The program accepts the following options. Also see @ref{Common options}. Options must precede operands. @table @samp +@optNull + @item -u @var{name} @itemx --unset=@var{name} @opindex -u @@ -13270,7 +16443,7 @@ Exit status: @display 0 if no @var{command} is specified and the environment is output -1 if @command{env} itself fails +125 if @command{env} itself fails 126 if @var{command} is found but cannot be invoked 127 if @var{command} cannot be found the exit status of @var{command} otherwise @@ -13285,8 +16458,9 @@ the exit status of @var{command} otherwise @cindex scheduling, affecting @cindex appropriate privileges -@command{nice} prints or modifies a process's @dfn{niceness}, -a parameter that affects whether the process is scheduled favorably. +@command{nice} prints a process's @dfn{niceness}, or runs +a command with modified niceness. @dfn{niceness} affects how +favorably the process is scheduled in the system. Synopsis: @example @@ -13297,9 +16471,11 @@ If no arguments are given, @command{nice} prints the current niceness. Otherwise, @command{nice} runs the given @var{command} with its niceness adjusted. By default, its niceness is incremented by 10. -Nicenesses range at least from @minus{}20 (resulting in the most -favorable scheduling) through 19 (the least favorable). Some systems -may have a wider range of nicenesses; conversely, other systems may +Niceness values range at least from @minus{}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. @@ -13308,20 +16484,19 @@ 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, @acronym{POSIX} defines the behavior of @command{nice} in -terms of a @dfn{nice value}, which is the nonnegative difference +terminology, POSIX defines the behavior of @command{nice} in +terms of a @dfn{nice value}, which is the non-negative difference between a niceness and the minimum niceness. Though @command{nice} -conforms to @acronym{POSIX}, its documentation and diagnostics use the +conforms to POSIX, its documentation and diagnostics use the term ``niceness'' for compatibility with historical practice. @var{command} must not be a special built-in utility (@pxref{Special built-in utilities}). -@cindex conflicts with shell built-ins -@cindex built-in shell commands, conflicts with -Because many shells have a built-in @command{nice} command, using an -unadorned @command{nice} in a script or interactively may get you -different functionality than that described here. +@mayConflictWithShellBuiltIn{nice} + +Note to change the @dfn{niceness} of an existing process, +one needs to use the @command{renice} command. The program accepts the following option. Also see @ref{Common options}. Options must precede operands. @@ -13342,12 +16517,16 @@ option syntax @option{-@var{adjustment}}. New scripts should use @end table +@command{nice} is installed only on systems that have the POSIX +@code{setpriority} function, so portable scripts should not rely on +its existence on non-POSIX platforms. + @cindex exit status of @command{nice} Exit status: @display 0 if no @var{command} is specified and the niceness is output -1 if @command{nice} itself fails +125 if @command{nice} itself fails 126 if @var{command} is found but cannot be invoked 127 if @var{command} cannot be found the exit status of @var{command} otherwise @@ -13419,12 +16598,13 @@ out. Synopsis: nohup @var{command} [@var{arg}]@dots{} @end example -If standard input is a terminal, it is redirected from -@file{/dev/null} so that terminal sessions do not mistakenly consider -the terminal to be used by the command. This is a @acronym{GNU} -extension; programs intended to be portable to non-@acronym{GNU} hosts -should use @samp{nohup @var{command} [@var{arg}]@dots{} </dev/null} -instead. +If standard input is a terminal, redirect it so that terminal sessions +do not mistakenly consider the terminal to be used by the command. +Make the substitute file descriptor unreadable, so that commands that +mistakenly attempt to read from standard input can report an error. +This redirection is a GNU extension; programs intended to be portable +to non-GNU hosts can use @samp{nohup @var{command} [@var{arg}]@dots{} +0>/dev/null} instead. @flindex nohup.out If standard output is a terminal, the command's standard output is appended @@ -13441,6 +16621,14 @@ However, if standard output is closed, standard error terminal output is instead appended to the file @file{nohup.out} or @file{$HOME/nohup.out} as above. +To capture the command's output to a file other than @file{nohup.out} +you can redirect it. For example, to capture the output of +@command{make}: + +@example +nohup make > make.log +@end example + @command{nohup} does not automatically put the command it runs in the background; you must do that explicitly, by ending the command line with an @samp{&}. Also, @command{nohup} does not alter the @@ -13457,167 +16645,198 @@ options}. Options must precede operands. Exit status: @display +125 if @command{nohup} itself fails, and @env{POSIXLY_CORRECT} is not set 126 if @var{command} is found but cannot be invoked -127 if @command{nohup} itself fails or if @var{command} cannot be found +127 if @var{command} cannot be found the exit status of @var{command} otherwise @end display +If @env{POSIXLY_CORRECT} is set, internal failures give status 127 +instead of 125. + -@node su invocation -@section @command{su}: Run a command with substitute user and group ID +@node stdbuf invocation +@section @command{stdbuf}: Run a command with modified I/O stream buffering -@pindex su -@cindex substitute user and group IDs -@cindex user ID, switching -@cindex super-user, becoming -@cindex root, becoming +@pindex stdbuf +@cindex standard streams, buffering +@cindex line buffered -@command{su} allows one user to temporarily become another user. It runs a -command (often an interactive shell) with the real and effective user -ID, group ID, and supplemental groups of a given @var{user}. Synopsis: +@command{stdbuf} allows one to modify the buffering operations of the +three standard I/O streams associated with a program. Synopsis: @example -su [@var{option}]@dots{} [@var{user} [@var{arg}]@dots{}] +stdbuf @var{option}@dots{} @var{command} @end example -@cindex passwd entry, and @command{su} shell -@flindex /bin/sh -@flindex /etc/passwd -If no @var{user} is given, the default is @code{root}, the super-user. -The shell to use is taken from @var{user}'s @code{passwd} entry, or -@file{/bin/sh} if none is specified there. If @var{user} has a -password, @command{su} prompts for the password unless run by a user with -effective user ID of zero (the super-user). +@var{command} must start with the name of a program that +@enumerate +@item +uses the ISO C @code{FILE} streams for input/output (note the +programs @command{dd} and @command{cat} don't do that), -@vindex HOME -@vindex SHELL -@vindex USER -@vindex LOGNAME -@cindex login shell -By default, @command{su} does not change the current directory. -It sets the environment variables @env{HOME} and @env{SHELL} -from the password entry for @var{user}, and if @var{user} is not -the super-user, sets @env{USER} and @env{LOGNAME} to @var{user}. -By default, the shell is not a login shell. +@item +does not adjust the buffering of its standard streams (note the +program @command{tee} is not in this category). +@end enumerate Any additional @var{arg}s are passed as additional arguments to the -shell. - -@cindex @option{-su} -GNU @command{su} does not treat @file{/bin/sh} or any other shells specially -(e.g., by setting @code{argv[0]} to @option{-su}, passing @option{-c} only -to certain shells, etc.). - -@findex syslog -@command{su} can optionally be compiled to use @code{syslog} to report -failed, and optionally successful, @command{su} attempts. (If the system -supports @code{syslog}.) However, GNU @command{su} does not check if the -user is a member of the @code{wheel} group; see below. +@var{command}. The program accepts the following options. Also see @ref{Common options}. @table @samp -@item -c @var{command} -@itemx --command=@var{command} -@opindex -c -@opindex --command -Pass @var{command}, a single command line to run, to the shell with -a @option{-c} option instead of starting an interactive shell. -@item -f -@itemx --fast -@opindex -f -@opindex --fast -@flindex .cshrc -@cindex file name pattern expansion, disabled -@cindex globbing, disabled -Pass the @option{-f} option to the shell. This probably only makes sense -if the shell run is @command{csh} or @command{tcsh}, for which the @option{-f} -option prevents reading the startup file (@file{.cshrc}). With -Bourne-like shells, the @option{-f} option disables file name pattern -expansion (globbing), which is not likely to be useful. +@item -i @var{mode} +@itemx --input=@var{mode} +@opindex -i +@opindex --input +Adjust the standard input stream buffering. -@item - -@itemx -l -@itemx --login -@opindex - -@opindex -l -@opindex --login -@c other variables already indexed above -@vindex TERM -@vindex PATH -@cindex login shell, creating -Make the shell a login shell. This means the following. Unset all -environment variables except @env{TERM}, @env{HOME}, and @env{SHELL} -(which are set as described above), and @env{USER} and @env{LOGNAME} -(which are set, even for the super-user, as described above), and set -@env{PATH} to a compiled-in default value. Change to @var{user}'s home -directory. Prepend @samp{-} to the shell's name, intended to make it -read its login startup file(s). +@item -o @var{mode} +@itemx --output=@var{mode} +@opindex -o +@opindex --output +Adjust the standard output stream buffering. -@item -m -@itemx -p -@itemx --preserve-environment -@opindex -m -@opindex -p -@opindex --preserve-environment -@cindex environment, preserving -@flindex /etc/shells -@cindex restricted shell -Do not change the environment variables @env{HOME}, @env{USER}, -@env{LOGNAME}, or @env{SHELL}. Run the shell given in the environment -variable @env{SHELL} instead of the shell from @var{user}'s passwd -entry, unless the user running @command{su} is not the super-user and -@var{user}'s shell is restricted. A @dfn{restricted shell} is one that -is not listed in the file @file{/etc/shells}, or in a compiled-in list -if that file does not exist. Parts of what this option does can be -overridden by @option{--login} and @option{--shell}. - -@item -s @var{shell} -@itemx --shell=@var{shell} -@opindex -s -@opindex --shell -Run @var{shell} instead of the shell from @var{user}'s passwd entry, -unless the user running @command{su} is not the super-user and @var{user}'s -shell is restricted (see @option{-m} just above). +@item -e @var{mode} +@itemx --error=@var{mode} +@opindex -e +@opindex --error +Adjust the standard error stream buffering. + +@end table + +The @var{mode} can be specified as follows: + +@table @samp + +@item 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. + +@item 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 @code{fread} will still block until @code{EOF} or error, +even if the underlying @code{read} returns less data than requested. + +@item @var{size} +Specify the size of the buffer to use in fully buffered mode. +@multiplierSuffixesNoBlocks{size} @end table -@cindex exit status of @command{su} +@command{stdbuf} is installed only on platforms that use the +Executable and Linkable Format (ELF) and support the +@code{constructor} attribute, so portable scripts should not rely on +its existence. + +@cindex exit status of @command{stdbuf} Exit status: @display -1 if @command{su} itself fails -126 if subshell is found but cannot be invoked -127 if subshell cannot be found -the exit status of the subshell otherwise +125 if @command{stdbuf} itself fails +126 if @var{command} is found but cannot be invoked +127 if @var{command} cannot be found +the exit status of @var{command} otherwise @end display -@cindex wheel group, not supported -@cindex group wheel, not supported -@cindex fascism -@subsection Why GNU @command{su} does not support the @samp{wheel} group -(This section is by Richard Stallman.) +@node timeout invocation +@section @command{timeout}: Run a command with a time limit -@cindex Twenex -@cindex MIT AI lab -Sometimes a few of the users try to hold total power over all the -rest. For example, in 1984, a few users at the MIT AI lab decided to -seize power by changing the operator password on the Twenex system and -keeping it secret from everyone else. (I was able to thwart this coup -and give power back to the users by patching the kernel, but I -wouldn't know how to do that in Unix.) +@pindex timeout +@cindex time limit +@cindex run commands with bounded time -However, occasionally the rulers do tell someone. Under the usual -@command{su} mechanism, once someone learns the root password who -sympathizes with the ordinary users, he or she can tell the rest. The -``wheel group'' feature would make this impossible, and thus cement the -power of the rulers. +@command{timeout} runs the given @var{command} and kills it if it is +still running after the specified time interval. Synopsis: -I'm on the side of the masses, not that of the rulers. If you are -used to supporting the bosses and sysadmins in whatever they do, you -might find this idea strange at first. +@example +timeout [@var{option}] @var{duration} @var{command} [@var{arg}]@dots{} +@end example + +@var{command} must not be a special built-in utility (@pxref{Special +built-in utilities}). + +The program accepts the following options. Also see @ref{Common options}. +Options must precede operands. + +@table @samp +@item --preserve-status +@opindex --preserve-status +Return the exit status of the managed @var{command} on timeout, rather than +a specific exit status indicating a timeout. This is useful if the +managed @var{command} supports running for an indeterminate amount of time. + +@item --foreground +@opindex --foreground +Don't create a separate background program group, so that +the managed @var{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. +@enumerate +@item +@var{command} is interactive and needs to read from the terminal for example +@item +the user wants to support sending signals directly to @var{command} +from the terminal (like Ctrl-C for example) +@end enumerate + +Note in this mode of operation, any children of @var{command} +will not be timed out. Also SIGCONT will not be sent to @var{command}, +as it's generally not needed with foreground processes, and can +cause intermittent signal delivery issues with programs that are monitors +themselves (like GDB for example). + +@item -k @var{duration} +@itemx --kill-after=@var{duration} +@opindex -k +@opindex --kill-after +Ensure the monitored @var{command} is killed by also sending a @samp{KILL} +signal, after the specified @var{duration}. Without this option, if the +selected signal proves not to be fatal, @command{timeout} does not kill +the @var{command}. + +@item -s @var{signal} +@itemx --signal=@var{signal} +@opindex -s +@opindex --signal +Send this @var{signal} to @var{command} on timeout, rather than the +default @samp{TERM} signal. @var{signal} may be a name like @samp{HUP} +or a number. @xref{Signal specifications}. +@end table + +@cindex time units +@var{duration} is a floating point number followed by an optional unit: +@display +@samp{s} for seconds (the default) +@samp{m} for minutes +@samp{h} for hours +@samp{d} for days +@end display +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. + +@cindex exit status of @command{timeout} +Exit status: + +@display +124 if @var{command} times out +125 if @command{timeout} itself fails +126 if @var{command} is found but cannot be invoked +127 if @var{command} cannot be found +137 if @var{command} is sent the KILL(9) signal (128+9) +the exit status of @var{command} otherwise +@end display @node Process control @@ -13646,9 +16865,11 @@ kill [-s @var{signal} | --signal @var{signal} | -@var{signal}] @var{pid}@dots{} kill [-l | --list | -t | --table] [@var{signal}]@dots{} @end example +@mayConflictWithShellBuiltIn{kill} + The first form of the @command{kill} command sends a signal to all @var{pid} arguments. The default signal to send if none is specified -is @samp{TERM}. The special signal number @samp{0} does not denote a +is @samp{TERM}@. The special signal number @samp{0} does not denote a valid signal, but can be used to test whether the @var{pid} arguments specify processes to which a signal could be sent. @@ -13664,9 +16885,9 @@ If @var{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 @var{PID} argument is desired as the first one, it +If a negative @var{pid} argument is desired as the first one, it should be preceded by @option{--}. However, as a common extension to -@acronym{POSIX}, @option{--} is not required with @samp{kill +POSIX, @option{--} is not required with @samp{kill -@var{signal} -@var{pid}}. The following commands are equivalent: @example @@ -13696,90 +16917,11 @@ The @command{kill} command also supports the @option{--help} and A @var{signal} may be a signal name like @samp{HUP}, or a signal number like @samp{1}, or an exit status of a process terminated by the signal. A signal name can be given in canonical form or prefixed by -@samp{SIG}. The case of the letters is ignored, except for the +@samp{SIG}@. The case of the letters is ignored, except for the @option{-@var{signal}} option which must use upper case to avoid -ambiguity with lower case option letters. The following signal names -and numbers are supported on all @acronym{POSIX} compliant systems: - -@table @samp -@item HUP -1. Hangup. -@item INT -2. Terminal interrupt. -@item QUIT -3. Terminal quit. -@item ABRT -6. Process abort. -@item KILL -9. Kill (cannot be caught or ignored). -@item ALRM -14. Alarm Clock. -@item TERM -15. Termination. -@end table - -@noindent -Other supported signal names have system-dependent corresponding -numbers. All systems conforming to @acronym{POSIX} 1003.1-2001 also -support the following signals: - -@table @samp -@item BUS -Access to an undefined portion of a memory object. -@item CHLD -Child process terminated, stopped, or continued. -@item CONT -Continue executing, if stopped. -@item FPE -Erroneous arithmetic operation. -@item ILL -Illegal Instruction. -@item PIPE -Write on a pipe with no one to read it. -@item SEGV -Invalid memory reference. -@item STOP -Stop executing (cannot be caught or ignored). -@item TSTP -Terminal stop. -@item TTIN -Background process attempting read. -@item TTOU -Background process attempting write. -@item URG -High bandwidth data is available at a socket. -@item USR1 -User-defined signal 1. -@item USR2 -User-defined signal 2. -@end table - -@noindent -@acronym{POSIX} 1003.1-2001 systems that support the @acronym{XSI} extension -also support the following signals: - -@table @samp -@item POLL -Pollable event. -@item PROF -Profiling timer expired. -@item SYS -Bad system call. -@item TRAP -Trace/breakpoint trap. -@item VTALRM -Virtual timer expired. -@item XCPU -CPU time limit exceeded. -@item XFSZ -File size limit exceeded. -@end table - -@noindent -@acronym{POSIX} 1003.1-2001 systems that support the @acronym{XRT} extension -also support at least eight real-time signals called @samp{RTMIN}, -@samp{RTMIN+1}, @dots{}, @samp{RTMAX-1}, @samp{RTMAX}. - +ambiguity with lower case option letters. +@xref{Signal specifications}, for a list of supported +signal names and numbers. @node Delaying @chapter Delaying @@ -13826,12 +16968,14 @@ days Historical implementations of @command{sleep} have required that @var{number} be an integer, and only accepted a single argument without a suffix. However, GNU @command{sleep} accepts -arbitrary floating point numbers (using a period before any fractional -digits). +arbitrary floating point numbers. @xref{Floating point}. The only options are @option{--help} and @option{--version}. @xref{Common options}. +@c sleep is a shell built-in at least with Solaris 11's /bin/sh +@mayConflictWithShellBuiltIn{sleep} + @exitstatus @@ -13843,6 +16987,7 @@ These programs do numerically-related operations. @menu * factor invocation:: Show factors of numbers. +* numfmt invocation:: Reformat numbers. * seq invocation:: Print sequences of numbers. @end menu @@ -13863,37 +17008,386 @@ factor @var{option} If no @var{number} is specified on the command line, @command{factor} reads numbers from standard input, delimited by newlines, tabs, or spaces. -The only options are @option{--help} and @option{--version}. @xref{Common -options}. +The @command{factor} command supports only a small number of options: -The algorithm it uses is not very sophisticated, so for some inputs -@command{factor} runs for a long time. The hardest numbers to factor are -the products of large primes. Factoring the product of the two largest 32-bit -prime numbers takes about 80 seconds of CPU time on a 1.6 GHz Athlon. +@table @samp +@item --help +Print a short help on standard output, then exit without further +processing. + +@item --version +Print the program version on standard output, then exit without further +processing. +@end table + +Factoring the product of the eighth and ninth Mersenne primes +takes about 30 milliseconds of CPU time on a 2.2 GHz Athlon. @example -$ p=`echo '4294967279 * 4294967291'|bc` -$ factor $p -18446743979220271189: 4294967279 4294967291 +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 @end example -Similarly, it takes about 80 seconds for GNU factor (from coreutils-5.1.2) -to ``factor'' the largest 64-bit prime: +Similarly, factoring the eighth Fermat number @math{2^{256}+1} takes +about 20 seconds on the same machine. + +Factoring large numbers is, in general, hard. The Pollard-Brent rho +algorithm used by @command{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 @command{factor} is built without using GNU MP, only +single-precision arithmetic is available, and so large numbers +(typically @math{2^{128}} and above) will not be supported. +The single-precision code uses an algorithm which is designed +for factoring smaller numbers. + +@exitstatus + + +@node numfmt invocation +@section @command{numfmt}: Reformat numbers + +@pindex numfmt + +@command{numfmt} reads numbers in various representations and reformats them +as requested. The most common usage is converting numbers to/from @emph{human} +representation (e.g. @samp{4G} @expansion{} @samp{4,000,000,000}). @example -$ factor 18446744073709551557 - 18446744073709551557: 18446744073709551557 +numfmt [@var{option}]@dots{} [@var{number}] @end example -In contrast, @command{factor} factors the largest 64-bit number in just -over a tenth of a second: +@command{numfmt} converts each @var{number} on the command-line according to the +specified options (see below). If no @var{number}s are given, it reads numbers +from standard input. @command{numfmt} can optionally extract numbers from +specific columns, maintaining proper line padding and alignment. + +@exitstatus + +See @option{--invalid} for additional information regarding exit status. + +@subsection General options + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp + +@item --debug +@opindex --debug +Print (to standard error) warning messages about possible erroneous usage. + +@item -d @var{d} +@itemx --delimiter=@var{d} +@opindex -d +@opindex --delimiter +Use the character @var{d} as input field separator (default: whitespace). +@emph{Note}: Using non-default delimiter turns off automatic padding. + +@item --field=@var{fields} +@opindex --field +Convert the number in input field @var{fields} (default: 1). +@var{fields} supports @command{cut} style field ranges: @example -$ factor `echo '2^64-1'|bc` -18446744073709551615: 3 5 17 257 641 65537 6700417 +N N'th field, counted from 1 +N- from N'th field, to end of line +N-M from N'th to M'th field (inclusive) +-M from first to M'th field (inclusive) +- all fields @end example -@exitstatus + +@item --format=@var{format} +@opindex --format +Use printf-style floating FORMAT string. The @var{format} string must contain +one @samp{%f} directive, optionally with @samp{'}, @samp{-}, @samp{0}, width +or precision modifiers. The @samp{'} modifier will enable @option{--grouping}, +the @samp{-} modifier will enable left-aligned @option{--padding} and the width +modifier will enable right-aligned @option{--padding}. The @samp{0} width +modifier (without the @samp{-} modifier) will generate leading zeros on the +number, up to the specified width. A precision specification like @samp{%.1f} +will override the precision determined from the input data or set due to +@option{--to} option auto scaling. + +@item --from=@var{unit} +@opindex --from +Auto-scales input numbers according to @var{unit}. See UNITS below. +The default is no scaling, meaning suffixes (e.g. @samp{M}, @samp{G}) will +trigger an error. + +@item --from-unit=@var{n} +@opindex --from-unit +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 @samp{10} +represents 10 units of 512 bytes, use @samp{--from-unit=512}). +Suffixes are handled as with @samp{--from=auto}. + +@item --grouping +@opindex --grouping +Group digits in output numbers according to the current locale's grouping rules +(e.g @emph{Thousands Separator} character, commonly @samp{.} (dot) or @samp{,} +comma). This option has no effect in @samp{POSIX/C} locale. + +@item --header[=@var{n}] +@opindex --header +@opindex --header=N +Print the first @var{n} (default: 1) lines without any conversion. + +@item --invalid=@var{mode} +@opindex --invalid +The default action on input errors is to exit immediately with status code 2. +@option{--invalid=@samp{abort}} explicitly specifies this default mode. +With a @var{mode} of @samp{fail}, print a warning for @emph{each} conversion +error, and exit with status 2. With a @var{mode} of @samp{warn}, exit with +status 0, even in the presence of conversion errors, and with a @var{mode} of +@samp{ignore} do not even print diagnostics. + +@item --padding=@var{n} +@opindex --padding +Pad the output numbers to @var{n} characters, by adding spaces. If @var{n} is +a positive number, numbers will be right-aligned. If @var{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). + +@item --round=@var{method} +@opindex --round +@opindex --round=up +@opindex --round=down +@opindex --round=from-zero +@opindex --round=towards-zero +@opindex --round=nearest +When converting number representations, round the number according to +@var{method}, which can be @samp{up}, @samp{down}, +@samp{from-zero} (the default), @samp{towards-zero}, @samp{nearest}. + +@item --suffix=@var{suffix} +@opindex --suffix +Add @samp{SUFFIX} to the output numbers, and accept optional @samp{SUFFIX} in +input numbers. + +@item --to=@var{unit} +@opindex --to +Auto-scales output numbers according to @var{unit}. See @emph{Units} below. +The default is no scaling, meaning all the digits of the number are printed. + +@item --to-unit=@var{n} +@opindex --to-unit +Specify the output unit size (instead of the default 1). Use this option when +the output numbers represent other units (e.g. to represent @samp{4,000,000} +bytes in blocks of 1KB, use @samp{--to=si --to-unit=1000}). +Suffixes are handled as with @samp{--from=auto}. + +@optZeroTerminated +@newlineFieldSeparator + +@end table + +@subsection Possible @var{unit}s: + +The following are the possible @var{unit} options with @option{--from=UNITS} and +@option{--to=UNITS}: + +@table @var + +@item 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. + +@item si +Auto-scale numbers according to the @emph{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: + +@example +@samp{K} => @math{1000^1 = 10^3} (Kilo) +@samp{M} => @math{1000^2 = 10^6} (Mega) +@samp{G} => @math{1000^3 = 10^9} (Giga) +@samp{T} => @math{1000^4 = 10^{12}} (Tera) +@samp{P} => @math{1000^5 = 10^{15}} (Peta) +@samp{E} => @math{1000^6 = 10^{18}} (Exa) +@samp{Z} => @math{1000^7 = 10^{21}} (Zetta) +@samp{Y} => @math{1000^8 = 10^{24}} (Yotta) +@end example + +@item iec +Auto-scale numbers according to the @emph{International Electrotechnical +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: + +@example +@samp{K} => @math{1024^1 = 2^{10}} (Kibi) +@samp{M} => @math{1024^2 = 2^{20}} (Mebi) +@samp{G} => @math{1024^3 = 2^{30}} (Gibi) +@samp{T} => @math{1024^4 = 2^{40}} (Tebi) +@samp{P} => @math{1024^5 = 2^{50}} (Pebi) +@samp{E} => @math{1024^6 = 2^{60}} (Exbi) +@samp{Z} => @math{1024^7 = 2^{70}} (Zebi) +@samp{Y} => @math{1024^8 = 2^{80}} (Yobi) +@end example + +The @option{iec} option uses a single letter suffix (e.g. @samp{G}), which is +not fully standard, as the @emph{iec} standard recommends a two-letter symbol +(e.g @samp{Gi}) - but in practice, this method common. Compare with +the @option{iec-i} option. + +@item iec-i +Auto-scale numbers according to the @emph{International Electrotechnical +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: + +@example +@samp{Ki} => @math{1024^1 = 2^{10}} (Kibi) +@samp{Mi} => @math{1024^2 = 2^{20}} (Mebi) +@samp{Gi} => @math{1024^3 = 2^{30}} (Gibi) +@samp{Ti} => @math{1024^4 = 2^{40}} (Tebi) +@samp{Pi} => @math{1024^5 = 2^{50}} (Pebi) +@samp{Ei} => @math{1024^6 = 2^{60}} (Exbi) +@samp{Zi} => @math{1024^7 = 2^{70}} (Zebi) +@samp{Yi} => @math{1024^8 = 2^{80}} (Yobi) +@end example + +The @option{iec-i} option uses a two-letter suffix symbol (e.g. @samp{Gi}), +as the @emph{iec} standard recommends, but this is not always common in +practice. Compare with the @option{iec} option. + +@item auto +@samp{auto} can only be used with @option{--from}. With this method, numbers +with @samp{K},@samp{M},@samp{G},@samp{T},@samp{P},@samp{E},@samp{Z},@samp{Y} +suffixes are interpreted as @emph{SI} values, and numbers with @samp{Ki}, +@samp{Mi},@samp{Gi},@samp{Ti},@samp{Pi},@samp{Ei},@samp{Zi},@samp{Yi} suffixes +are interpreted as @emph{IEC} values. + +@end table + +@subsection Examples of using @command{numfmt} + +Converting a single number from/to @emph{human} representation: +@example +$ numfmt --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 +@end example + +Converting from @samp{SI} to @samp{IEC} scales (e.g. when a harddisk capacity is +advertised as @samp{1TB}, while checking the drive's capacity gives lower +values): + +@example +$ numfmt --from=si --to=iec 1T +932G +@end example + + +Converting a single field from an input file / piped input (these contrived +examples are for demonstration purposes only, as both @command{ls} and +@command{df} support the @option{--human-readable} option to +output sizes in human-readable format): + +@example +# 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 +@end example + + +Output can be tweaked using @option{--padding} or @option{--format}: + +@example +# 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 +@end example + +With locales that support grouping digits, using @option{--grouping} or +@option{--format} enables grouping. In @samp{POSIX} locale, grouping is +silently ignored: + +@example +$ 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== +@end example @node seq invocation @@ -13917,8 +17411,10 @@ When @var{increment} is not specified, it defaults to @samp{1}, even when @var{first} is larger than @var{last}. @var{first} also defaults to @samp{1}. So @code{seq 1} prints @samp{1}, but @code{seq 0} and @code{seq 10 5} produce no output. -Floating-point numbers -may be specified (using a period before any fractional digits). +The sequence of numbers ends when the sum of the current number and +@var{increment} would become greater than @var{last}, +so @code{seq 1 10 10} only produces @samp{1}. +Floating-point numbers may be specified. @xref{Floating point}. The program accepts the following options. Also see @ref{Common options}. Options must precede operands. @@ -13926,13 +17422,13 @@ Options must precede operands. @table @samp @item -f @var{format} @itemx --format=@var{format} -@opindex -f @var{format} -@opindex --format=@var{format} +@opindex -f +@opindex --format @cindex formatting of numbers in @command{seq} Print all numbers using @var{format}. @var{format} must contain exactly one of the @samp{printf}-style floating point conversion specifications @samp{%a}, @samp{%e}, -@samp{%f}, @samp{%g}, @samp{%A}, @samp{%E}, @samp{%F}, @samp{%G}. +@samp{%f}, @samp{%g}, @samp{%A}, @samp{%E}, @samp{%F}, @samp{%G}@. The @samp{%} may be followed by zero or more flags taken from the set @samp{-+#0 '}, then an optional width containing one or more digits, then an optional precision consisting of a @samp{.} followed by zero @@ -13948,12 +17444,16 @@ the default format is @samp{%g}. @item -s @var{string} @itemx --separator=@var{string} +@opindex -s +@opindex --separator @cindex separator for numbers in @command{seq} Separate numbers with @var{string}; default is a newline. The output always terminates with a newline. @item -w @itemx --equal-width +@opindex -w +@opindex --equal-width Print all numbers with the same width, by padding with leading zeros. @var{first}, @var{step}, and @var{last} should all use a fixed point decimal representation. @@ -13974,7 +17474,7 @@ If you want hexadecimal integer output, you can use @command{printf} to perform the conversion: @example -$ printf '%x\n' `seq 1048575 1024 1050623` +$ printf '%x\n' $(seq 1048575 1024 1050623) fffff 1003ff 1007ff @@ -13994,46 +17494,33 @@ To generate octal output, use the printf @code{%o} format instead of @code{%x}. On most systems, seq can produce whole-number output for values up to -at least @code{2^53}. Larger integers are approximated. The details -differ depending on your floating-point implementation, but a common -case is that @command{seq} works with integers through @code{2^64}, +at least @math{2^{53}}. Larger integers are approximated. The details +differ depending on your floating-point implementation. +@xref{Floating point}. A common +case is that @command{seq} works with integers through @math{2^{64}}, and larger integers may not be numerically correct: @example -$ seq 18446744073709551616 1 18446744073709551618 -18446744073709551616 -18446744073709551616 -18446744073709551618 -@end example - -Be careful when using @command{seq} with a fractional @var{increment}; -otherwise you may see surprising results. Most people would expect to -see @code{0.000003} printed as the last number in this example: - -@example -$ seq -s ' ' 0 0.000001 0.000003 -0.000000 0.000001 0.000002 +$ seq 50000000000000000000 2 50000000000000000004 +50000000000000000000 +50000000000000000000 +50000000000000000004 @end example -But that doesn't happen on many systems because @command{seq} is -implemented using binary floating point arithmetic (via the C -@code{long double} type)---which means decimal fractions like @code{0.000001} -cannot be represented exactly. That in turn means some nonintuitive -conditions like @w{@code{0.000001 * 3 > 0.000003}} will end up being true. +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. -To work around that in the above example, use a slightly larger number as -the @var{last} value: +Be careful when using @command{seq} with outlandish values: otherwise +you may see surprising results, as @command{seq} uses floating point +internally. For example, on the x86 platform, where the internal +representation uses a 64-bit fraction, the command: @example -$ seq -s ' ' 0 0.000001 0.0000031 -0.000000 0.000001 0.000002 0.000003 +seq 1 0.0000000000000000001 1.0000000000000000009 @end example -In general, when using an @var{increment} with a fractional part, where -(@var{last} - @var{first}) / @var{increment} is (mathematically) a whole -number, specify a slightly larger (or smaller, if @var{increment} is negative) -value for @var{last} to ensure that @var{last} is the final value printed -by seq. +outputs 1.0000000000000000007 twice and skips 1.0000000000000000008. @exitstatus @@ -14042,7 +17529,7 @@ by seq. @chapter File permissions @include perm.texi -@include getdate.texi +@include parse-datetime.texi @c What's GNU? @c Arnold Robbins @@ -14051,7 +17538,7 @@ by seq. An earlier version of this chapter appeared in @uref{http://www.linuxjournal.com/article.php?sid=2762, the -@cite{What's GNU?} column of @cite{Linux Journal}, 2 (June, 1994)}. +@cite{What's GNU@?} column of the June 1994 @cite{Linux Journal}}. It was written by Arnold Robbins. @menu @@ -14069,7 +17556,8 @@ It was written by Arnold Robbins. @unnumberedsec 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 +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. @@ -14160,7 +17648,7 @@ 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 @acronym{ASCII} @sc{lf} (Line Feed) character, +lines delimited by the ASCII LF (Line Feed) character, conventionally called a ``newline'' in the Unix literature. (This is @code{'\n'} if you're a C programmer.) This is the format used by all the traditional filtering programs. (Many earlier operating systems @@ -14269,7 +17757,8 @@ by a count of the number of times that line occurred in the input. @unnumberedsec 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 +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. @@ -14311,7 +17800,8 @@ The @command{sort} command actually has a @option{-u} option that does what @command{uniq} does. However, @command{uniq} has other uses for which one cannot substitute @samp{sort -u}. -The administrator puts this pipeline into a shell script, and makes it available for +The administrator puts this pipeline into a shell script, and makes it +available for all the users on the system (@samp{#} is the system administrator, or @code{root}, prompt): @@ -14426,7 +17916,7 @@ $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | ... The second @command{tr} command operates on the complement of the listed characters, which are all the letters, the digits, the underscore, and the blank. The @samp{\n} represents the newline character; it has to -be left alone. (The @acronym{ASCII} tab character should also be included for +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. @@ -14440,8 +17930,8 @@ $ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \n' | @end smallexample This command turns blanks into newlines. The @option{-s} option squeezes -multiple newline characters in the output into just one. This helps us -avoid blank lines. (The @samp{>} is the shell's ``secondary prompt.'' +multiple newline characters in the output into just one, removing +blank lines. (The @samp{>} 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.) @@ -14503,7 +17993,7 @@ that your spelling is incorrect. So, we need a dictionary. The conventional location for a dictionary is @file{/usr/dict/words}. On my GNU/Linux system,@footnote{Redhat Linux 6.1, for the November 2000 revision of this article.} -this is a is a sorted, 45,402 word dictionary. +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: @@ -14576,10 +18066,10 @@ Know your toolbox! Use each program appropriately. If you don't have an appropriate tool, build one. @end enumerate -As of this writing, all the programs we've discussed are available via -anonymous @command{ftp} from: @* -@uref{ftp://gnudist.gnu.org/textutils/textutils-1.22.tar.gz}. (There may -be more recent versions available now.) +As of this writing, all the programs discussed are available from +@uref{http://ftp.gnu.org/old-gnu/textutils/textutils-1.22.tar.gz}, +with more recent versions available from +@uref{http://ftp.gnu.org/gnu/coreutils}. None of what I have presented in this column is new. The Software Tools philosophy was first introduced in the book @cite{Software Tools}, by @@ -14615,22 +18105,16 @@ 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. -@node Copying This Manual -@appendix Copying This Manual - -@menu -* GNU Free Documentation License:: License for copying this manual. -@end menu +@node GNU Free Documentation License +@appendix GNU Free Documentation License @include fdl.texi -@node Index +@node Concept index @unnumbered Index @printindex cp -@shortcontents -@contents @bye @c Local variables: diff --git a/doc/fdl.texi b/doc/fdl.texi index 9c6d9af..9c3bbe5 100644 --- a/doc/fdl.texi +++ b/doc/fdl.texi @@ -1,13 +1,12 @@ +@c The GNU Free Documentation License. +@center Version 1.3, 3 November 2008 -@node GNU Free Documentation License -@appendixsec GNU Free Documentation License - -@cindex FDL, GNU Free Documentation License -@center Version 1.2, November 2002 +@c This file is intended to be included within another document, +@c hence no sectioning command or @node. @display -Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. -51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. +@uref{http://fsf.org/} Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -93,16 +92,16 @@ 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 -@sc{ascii} without markup, Texinfo input format, La@TeX{} input -format, @acronym{SGML} or @acronym{XML} using a publicly available -@acronym{DTD}, and standard-conforming simple @acronym{HTML}, -PostScript or @acronym{PDF} designed for human modification. Examples -of transparent image formats include @acronym{PNG}, @acronym{XCF} and -@acronym{JPG}. Opaque formats include proprietary formats that can be -read and edited only by proprietary word processors, @acronym{SGML} or -@acronym{XML} for which the @acronym{DTD} and/or processing tools are -not generally available, and the machine-generated @acronym{HTML}, -PostScript or @acronym{PDF} produced by some word processors for +ASCII without markup, Texinfo input format, La@TeX{} 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, @@ -112,6 +111,9 @@ 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 @@ -380,13 +382,30 @@ title. @item TERMINATION -You may not copy, modify, sublicense, or distribute the Document except -as expressly provided for under this License. Any other attempt to -copy, modify, sublicense or distribute the Document is void, and will -automatically terminate your rights under this License. However, -parties who have received copies, or rights, from you under this -License will not have their licenses terminated so long as such -parties remain in full compliance. +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. @item FUTURE REVISIONS OF THIS LICENSE @@ -404,7 +423,42 @@ 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. +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. + +@item +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. + @end enumerate @page @@ -418,7 +472,7 @@ license notices just after the title page: @group Copyright (C) @var{year} @var{your name}. Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.2 + 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 @@ -427,7 +481,7 @@ license notices just after the title page: @end smallexample If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the ``with...Texts.'' line with this: +replace the ``with@dots{}Texts.''@: line with this: @smallexample @group @@ -449,4 +503,3 @@ to permit their use in free software. @c Local Variables: @c ispell-local-pdict: "ispell-dict" @c End: - diff --git a/doc/local.mk b/doc/local.mk new file mode 100644 index 0000000..5ba5818 --- /dev/null +++ b/doc/local.mk @@ -0,0 +1,127 @@ +# Make coreutils documentation. -*-Makefile-*- +# This is included by the top-level Makefile.am. + +# Copyright (C) 1995-2016 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +info_TEXINFOS = doc/coreutils.texi + +doc_coreutils_TEXINFOS = \ + doc/perm.texi \ + doc/parse-datetime.texi \ + doc/constants.texi \ + doc/fdl.texi + +# The following is necessary if the package name is 8 characters or longer. +# If the info documentation would be split into 10 or more separate files, +# then this is necessary even if the package name is 7 characters long. +# +# Tell makeinfo to put everything in a single info file: <package>.info. +# Otherwise, it would also generate files with names like <package>.info-[123], +# and those names all map to one 14-byte name (<package>.info-) on some crufty +# old systems. +AM_MAKEINFOFLAGS = --no-split + +doc/constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c + $(AM_V_GEN)LC_ALL=C; export LC_ALL; \ + $(MKDIR_P) doc && \ + { sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \ + $(top_srcdir)/src/tail.c && \ + sed -n -e \ + 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\ + $(top_srcdir)/src/shred.c; } > $@-t \ + && { cmp $@-t $@ >/dev/null 2>&1 || mv $@-t $@; rm -f $@-t; } + +MAINTAINERCLEANFILES += doc/constants.texi + +# Extended regular expressions to match word starts and ends. +_W = (^|[^A-Za-z0-9_]) +W_ = ([^A-Za-z0-9_]|$$) + +syntax_checks = \ + sc-avoid-builtin \ + sc-avoid-io \ + sc-avoid-non-zero \ + sc-avoid-path \ + sc-avoid-timezone \ + sc-avoid-zeroes \ + sc-exponent-grouping \ + sc-lower-case-var + +texi_files = $(srcdir)/doc/*.texi + +.PHONY: $(syntax_checks) check-texinfo + +# List words/regexps here that should not appear in the texinfo documentation. +check-texinfo: $(syntax_checks) + $(AM_V_GEN)fail=0; \ + grep '@url{' $(texi_files) && fail=1; \ + grep '\$$@"' $(texi_files) && fail=1; \ + grep -n '[^[:punct:]]@footnote' $(texi_files) && fail=1; \ + grep -n filename $(texi_files) \ + | $(EGREP) -v 'setfilename|[{]filename[}]' \ + && fail=1; \ + exit $$fail + +sc-avoid-builtin: + $(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(texi_files) \ + && exit 1 || : + +sc-avoid-path: + $(AM_V_GEN)fail=0; \ + $(EGREP) -i '$(_W)path(name)?s?$(W_)' $(texi_files) \ + | $(EGREP) -v \ + 'PATH=|path search|search path|@vindex PATH$$|@env[{]PATH[}]' \ + && fail=1; \ + exit $$fail + +# Use "time zone", not "timezone". +sc-avoid-timezone: + $(AM_V_GEN)$(EGREP) timezone $(texi_files) && exit 1 || : + +# Check for insufficient exponent grouping, e.g., +# @math{2^64} should be @math{2^{64}}. +sc-exponent-grouping: + $(AM_V_GEN)$(EGREP) '\{.*\^[0-9][0-9]' $(texi_files) && exit 1 || : + +# Say I/O, not IO. +sc-avoid-io: + $(AM_V_GEN)$(EGREP) '$(_W)IO$(W_)' $(texi_files) && exit 1 || : + +# I prefer nonzero over non-zero. +sc-avoid-non-zero: + $(AM_V_GEN)$(EGREP) non-zero $(texi_files) && exit 1 || : + +# Use "zeros", not "zeroes" (nothing wrong with "zeroes"; just be consistent). +sc-avoid-zeroes: + $(AM_V_GEN)$(EGREP) -i '$(_W)zeroes$(W_)' $(texi_files) \ + && exit 1 || : + +# The quantity inside @var{...} should not contain upper case letters. +# The leading backslash exemption is to permit in-macro uses like +# @var{\varName\} where the upper case letter is part of a parameter name. +find_upper_case_var = \ + '/\@var\{/ or next; \ + while (/\@var\{(.+?)}/g) \ + { \ + $$v = $$1; \ + $$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print "$$ARGV:$$.:$$_"), $$m = 1 \ + } \ + END {$$m and (warn "$@: do not use upper case in \@var{...}\n"), exit 1}' +sc-lower-case-var: + $(AM_V_GEN)$(PERL) -e 1 || { echo $@: skipping test; exit 0; }; \ + $(PERL) -lne $(find_upper_case_var) $(texi_files) + +check-local: check-texinfo diff --git a/doc/getdate.texi b/doc/parse-datetime.texi index eae4526..1bba244 100644 --- a/doc/getdate.texi +++ b/doc/parse-datetime.texi @@ -1,12 +1,11 @@ @c GNU date syntax documentation -@c Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -@c 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +@c Copyright (C) 1994-2006, 2009-2016 Free Software Foundation, Inc. @c Permission is granted to copy, distribute and/or modify this document -@c under the terms of the GNU Free Documentation License, Version 1.2 or +@c under the terms of the GNU Free Documentation License, Version 1.3 or @c any later version published by the Free Software Foundation; with no -@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +@c Invariant Sections, no Front-Cover Texts, and no Back-Cover @c Texts. A copy of the license is included in the ``GNU Free @c Documentation License'' file as part of this distribution. @@ -14,7 +13,7 @@ @chapter Date input formats @cindex date input formats -@findex get_date +@findex parse_datetime First, a quote: @@ -39,25 +38,26 @@ 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. @dots{} ---- Robert Grudin, @cite{Time and the Art of Living}. +---Robert Grudin, @cite{Time and the Art of Living}. @end quotation -This section describes the textual date representations that @sc{gnu} +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 -@code{get_date} function) is not described here. +@code{parse_datetime} function) is not described here. @menu * General date syntax:: Common rules. * Calendar date items:: 19 Dec 1994. * Time of day items:: 9:20pm. -* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}. +* Time zone items:: EST, PDT, UTC, @dots{} +* Combined date and time of day items:: 1972-09-24T20:02:00,000000-0500. * Day of week items:: Monday and others. * Relative items in date strings:: next tuesday, 2 years ago. * Pure numbers in date strings:: 19931219, 1440. * Seconds since the Epoch:: @@1078100502. * Specifying time zone rules:: TZ="America/New_York", TZ="UTC0". -* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al. +* Authors of parse_datetime:: Bellovin, Eggert, Salz, Berets, et al. @end menu @@ -77,6 +77,7 @@ many flavors of items: @item calendar date items @item time of day items @item time zone items +@item combined date and time of day items @item day of the week items @item relative items @item pure numbers. @@ -116,10 +117,10 @@ abbreviations like @samp{AM}, @samp{DST}, @samp{EST}, @samp{first}, The output of the @command{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 @samp{IST}. When using +standard meaning for time zone items like @samp{IST}@. When using @command{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 @samp{UTC} and @samp{Z}. Here are some +use time zone items other than @samp{UTC} and @samp{Z}@. Here are some ways to do this: @example @@ -127,8 +128,8 @@ $ 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 --iso-8601=ns | tr T ' ' # --iso-8601 is a GNU extension. -2004-02-29 16:21:42,692722128-0800 +$ 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. @@ -144,6 +145,7 @@ 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. +@cindex leap seconds Invalid dates like @samp{2005-02-29} or times like @samp{24:00} are rejected. In the typical case of a host that does not support leap seconds, a time like @samp{23:59:60} is rejected even if it @@ -160,7 +162,7 @@ specified differently, depending on whether the month is specified numerically or literally. All these strings specify the same calendar date: @example -1972-09-24 # @sc{iso} 8601. +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. @@ -183,9 +185,9 @@ sep 24 Here are the rules. -@cindex @sc{iso} 8601 date format -@cindex date format, @sc{iso} 8601 -For numeric months, the @sc{iso} 8601 format +@cindex ISO 8601 date format +@cindex date format, ISO 8601 +For numeric months, the ISO 8601 format @samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is any positive number, @var{month} is a number between 01 and 12, and @var{day} is a number between 01 and 31. A leading zero must be present @@ -233,9 +235,10 @@ day. Here are some examples, all of which represent the same time: 20:02:00.000000 20:02 8:02pm -20:02-0500 # In @sc{est} (U.S. Eastern Standard Time). +20:02-0500 # In EST (U.S. Eastern Standard Time). @end example +@cindex leap seconds More generally, the time of day may be given as @samp{@var{hour}:@var{minute}:@var{second}}, where @var{hour} is a number between 0 and 23, @var{minute} is a number between 0 and @@ -265,16 +268,19 @@ which uses @samp{12m} for noon and @samp{12pm} for midnight.) The time may alternatively be followed by a time zone correction, expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+} or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number -of zone minutes. You can also separate @var{hh} from @var{mm} with a colon. +of zone minutes. +The zone minutes term, @var{mm}, may be omitted, in which case +the one- or two-digit correction is interpreted as a number of hours. +You can also separate @var{hh} from @var{mm} with a colon. When a time zone correction is given this way, it forces interpretation of the time relative to -Coordinated Universal Time (@sc{utc}), overriding any previous +Coordinated Universal Time (UTC), overriding any previous specification for the time zone or the local time zone. For example, @samp{+0530} and @samp{+05:30} both stand for the time zone 5.5 hours -ahead of @sc{utc} (e.g., India). The @var{minute} -part of the time of day may not be elided when a time zone correction -is used. This is the best way to specify a time zone correction by -fractional parts of an hour. +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 @samp{am}/@samp{pm} or a time zone correction may be specified, but not both. @@ -309,6 +315,32 @@ time stamps are interpreted using the rules of the default time zone (@pxref{Specifying time zone rules}). +@node Combined date and time of day items +@section Combined date and time of day items + +@cindex combined date and time of day item +@cindex ISO 8601 date and time of day format +@cindex date and time of day format, ISO 8601 + +The ISO 8601 date and time of day extended format consists of an ISO +8601 date, a @samp{T} character separator, and an ISO 8601 time of +day. This format is also recognized if the @samp{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: + +@example +2012-09-24T20:02:00.052-05:00 +2012-12-31T23:59:59,999999999+11:00 +1970-01-01 00:00Z +@end example + @node Day of week items @section Day of week items @@ -453,28 +485,29 @@ 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. -@cindex beginning of time, for @acronym{POSIX} -@cindex epoch, for @acronym{POSIX} +@cindex beginning of time, for POSIX +@cindex epoch, for POSIX Internally, computer times are represented as a count of seconds since -an epoch---a well-defined point of time. On @acronym{GNU} and -@acronym{POSIX} systems, the epoch is 1970-01-01 00:00:00 @sc{utc}, so +an epoch---a well-defined point of time. On GNU and +POSIX systems, the epoch is 1970-01-01 00:00:00 UTC, so @samp{@@0} represents this time, @samp{@@1} represents 1970-01-01 -00:00:01 @sc{utc}, and so forth. @acronym{GNU} and most other -@acronym{POSIX}-compliant systems support such times as an extension -to @acronym{POSIX}, using negative counts, so that @samp{@@-1} -represents 1969-12-31 23:59:59 @sc{utc}. +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 @samp{@@-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 @sc{utc}. More modern systems use 64-bit counts +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. +@cindex leap seconds On most hosts, these counts ignore the presence of leap seconds. For example, on most hosts @samp{@@915148799} represents 1998-12-31 -23:59:59 @sc{utc}, @samp{@@915148800} represents 1999-01-01 00:00:00 -@sc{utc}, and there is no way to represent the intervening leap second -1998-12-31 23:59:60 @sc{utc}. +23:59:59 UTC, @samp{@@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. @node Specifying time zone rules @section Specifying time zone rules @@ -489,7 +522,7 @@ two quote characters (@samp{"}) must be present in the date, and any quotes or backslashes within @var{rule} must be escaped by a backslash. -For example, with the @acronym{GNU} @command{date} command you can +For example, with the GNU @command{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 @samp{TZ="Europe/Paris"} as shown in the following shell transcript: @@ -513,24 +546,26 @@ A @env{TZ} value is a rule that typically names a location in the @uref{http://www.twinsun.com/tz/tz-link.htm, @samp{tz} database}. A recent catalog of location names appears in the @uref{http://twiki.org/cgi-bin/xtra/tzdate, TWiki Date and Time -Gateway}. A few non-@acronym{GNU} hosts require a colon before a +Gateway}. A few non-GNU hosts require a colon before a location name in a @env{TZ} setting, e.g., @samp{TZ=":America/New_York"}. The @samp{tz} database includes a wide variety of locations ranging from @samp{Arctic/Longyearbyen} to @samp{Antarctica/South_Pole}, but if you are at sea and have your own private time zone, or if you are -using a non-@acronym{GNU} host that does not support the @samp{tz} -database, you may need to use a @acronym{POSIX} rule instead. Simple -@acronym{POSIX} rules like @samp{UTC0} specify a time zone without +using a non-GNU host that does not support the @samp{tz} +database, you may need to use a POSIX rule instead. Simple +POSIX rules like @samp{UTC0} specify a time zone without daylight saving time; other rules can specify simple daylight saving regimes. @xref{TZ Variable,, Specifying the Time Zone with @code{TZ}, libc, The GNU C Library}. -@node Authors of get_date -@section Authors of @code{get_date} +@node Authors of parse_datetime +@section Authors of @code{parse_datetime} +@c the anchor keeps the old node name, to try to avoid breaking links +@anchor{Authors of get_date} -@cindex authors of @code{get_date} +@cindex authors of @code{parse_datetime} @cindex Bellovin, Steven M. @cindex Salz, Rich @@ -538,16 +573,22 @@ libc, The GNU C Library}. @cindex MacKenzie, David @cindex Meyering, Jim @cindex Eggert, Paul -@code{get_date} was originally implemented by Steven M. Bellovin +@code{parse_datetime} started life as @code{getdate}, as originally +implemented by Steven M. Bellovin (@email{smb@@research.att.com}) 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 (@email{rsalz@@bbn.com}) and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various -revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering, -Paul Eggert and others. +revisions for the GNU system were made by David MacKenzie, Jim Meyering, +Paul Eggert and others, including renaming it to @code{get_date} to +avoid a conflict with the alternative Posix function @code{getdate}, +and a later rename to @code{parse_datetime}. The Posix function +@code{getdate} can parse more locale-specific dates using +@code{strptime}, but relies on an environment variable and external +file, and lacks the thread-safety of @code{parse_datetime}. @cindex Pinard, F. @cindex Berry, K. This chapter was originally produced by Fran@,{c}ois Pinard -(@email{pinard@@iro.umontreal.ca}) from the @file{getdate.y} source code, -and then edited by K.@: Berry (@email{kb@@cs.umb.edu}). +(@email{pinard@@iro.umontreal.ca}) from the @file{parse_datetime.y} source code, +and then edited by K. Berry (@email{kb@@cs.umb.edu}). diff --git a/doc/perm.texi b/doc/perm.texi index 78b5919..4a4d450 100644 --- a/doc/perm.texi +++ b/doc/perm.texi @@ -1,10 +1,9 @@ @c File mode bits -@c Copyright (C) 1994, 1996, 1999, 2000, 2001, 2003, 2004, 2005, 2006 -@c Free Software Foundation, Inc. +@c Copyright (C) 1994-2016 Free Software Foundation, Inc. @c Permission is granted to copy, distribute and/or modify this document -@c under the terms of the GNU Free Documentation License, Version 1.2 or +@c under the terms of the GNU Free Documentation License, Version 1.3 or @c any later version published by the Free Software Foundation; with no @c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover @c Texts. A copy of the license is included in the ``GNU Free @@ -18,6 +17,7 @@ symbolic form or as an octal number. * Mode Structure:: Structure of file mode bits. * Symbolic Modes:: Mnemonic representation of file mode bits. * Numeric Modes:: File mode bits as octal numbers. +* Operator Numeric Modes:: ANDing, ORing, and setting modes octally. * Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories. @end menu @@ -112,7 +112,7 @@ specific to the file system. For example: @table @asis @item ext2 -On @acronym{GNU} and @acronym{GNU}/Linux the file attributes specific to +On GNU and GNU/Linux the file attributes specific to the ext2 file system are set using @command{chattr}. @item FFS @@ -148,7 +148,7 @@ their previous values, and perhaps on the current @code{umask} as well The format of symbolic modes is: @example -@r{[}ugoa@dots{}@r{][}+-=@r{]}@var{perms}@dots{}@r{[},@dots{}@r{]} +@r{[}ugoa@dots{}@r{][}-+=@r{]}@var{perms}@dots{}@r{[},@dots{}@r{]} @end example @noindent @@ -345,7 +345,7 @@ the mode: +t @end example -The combination @samp{o+s} has no effect. On @acronym{GNU} systems +The combination @samp{o+s} has no effect. On GNU systems the combinations @samp{u+t} and @samp{g+t} have no effect, and @samp{o+t} acts like plain @samp{+t}. @@ -496,13 +496,16 @@ 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 @samp{0}, as you do in C. Mode @samp{0055} is the same as -mode @samp{55}. +mode @samp{55}. (However, modes of five digits or more, such as +@samp{00055}, are sometimes special. @xref{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. -(As discussed in the next section, the set-user-ID and set-group-ID -bits of directories are an exception to this general limitation.) +The set-user-ID and set-group-ID bits of directories are an exception +to this general limitation. @xref{Directory Setuid and Setgid}. +Also, operator numeric modes can take previous file mode bits into +account. @xref{Operator Numeric Modes}. The permissions granted to the user, to other users in the file's group, @@ -542,6 +545,26 @@ For example, numeric mode @samp{4755} corresponds to symbolic mode @samp{ug=rw,o=r}. Numeric mode @samp{0} corresponds to symbolic mode @samp{a=}. +@node Operator Numeric Modes +@section Operator Numeric Modes + +An operator numeric mode is a numeric mode that is prefixed by a +@samp{-}, @samp{+}, or @samp{=} operator, which has the same +interpretation as in symbolic modes. For example, @samp{+440} enables +read permission for the file's owner and group, @samp{-1} disables +execute permission for other users, and @samp{=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, @samp{=0,u+r} clears all +permissions except for enabling read permission for the file's owner. + +The commands @samp{chmod =755 @var{dir}} and @samp{chmod 755 +@var{dir}} differ in that the former clears the directory @var{dir}'s +setuid and setgid bits, whereas the latter preserves them. +@xref{Directory Setuid and Setgid}. + +Operator numeric modes are a GNU extension. + @node Directory Setuid and Setgid @section Directories and the Set-User-ID and Set-Group-ID Bits @@ -560,8 +583,10 @@ bits of directories. If commands like @command{chmod} and mechanisms would be less convenient and it would be harder to share files. Therefore, a command like @command{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 sets them in -a numeric mode. For example, on systems that support +specifically mentions them in a symbolic mode, or uses an operator +numeric mode such as @samp{=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: @example @@ -583,22 +608,32 @@ explicitly in the symbolic or numeric modes, e.g.: @example # These commands try to set the set-user-ID # and set-group-ID bits of the subdirectories. -mkdir G H +mkdir G chmod 6755 G -chmod u=rwx,go=rx,a+s H -mkdir -m 6755 I +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 @end example If you want to try to clear these bits, you must mention them -explicitly in a symbolic mode, e.g.: +explicitly in a symbolic mode, or use an operator numeric mode, or +specify a numeric mode with five or more octal digits, e.g.: @example -# This command tries to clear the set-user-ID +# 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 @end example -This behavior is a @acronym{GNU} extension. Portable scripts should +This behavior is a GNU extension. Portable scripts should not rely on requests to set or clear these bits on directories, as -@acronym{POSIX} allows implementations to ignore these requests. +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. diff --git a/doc/stamp-vti b/doc/stamp-vti index f556ae3..41509b3 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 22 March 2007 -@set UPDATED-MONTH March 2007 -@set EDITION 6.9 -@set VERSION 6.9 +@set UPDATED 13 January 2016 +@set UPDATED-MONTH January 2016 +@set EDITION 8.25 +@set VERSION 8.25 diff --git a/doc/version.texi b/doc/version.texi index f556ae3..41509b3 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 22 March 2007 -@set UPDATED-MONTH March 2007 -@set EDITION 6.9 -@set VERSION 6.9 +@set UPDATED 13 January 2016 +@set UPDATED-MONTH January 2016 +@set EDITION 8.25 +@set VERSION 8.25 |