%general-entities; ]> coreutils &coreutils-version;
&coreutils-url;
Coreutils-&coreutils-version; Coreutils <para>The Coreutils package contains utilities for showing and setting the basic system characteristics.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> <seg>&coreutils-ch6-sbu;</seg> <seg>&coreutils-ch6-du;</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Coreutils POSIX requires that programs from Coreutils recognize character boundaries correctly even in multibyte locales. The following patch fixes this non-compliance and other internationalization-related bugs. patch -Np1 -i ../&coreutils-i18n-patch; In the past, many bugs were found in this patch. When reporting new bugs to Coreutils maintainers, please check first if they are reproducible without this patch. Suppress a test which on some machines can loop forever: sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk Now prepare Coreutils for compilation: autoreconf -fiv FORCE_UNSAFE_CONFIGURE=1 ./configure \ --prefix=/usr \ --enable-no-install-program=kill,uptime The meaning of the configure options: autoreconf This command updates generated configuration files consistent with the latest version of automake. FORCE_UNSAFE_CONFIGURE=1 This environment variable allows the package to be built as the root user. --enable-no-install-program=kill,uptime The purpose of this switch is to prevent Coreutils from installing binaries that will be installed by other packages later. Compile the package: make Skip down to Install the package if not running the test suite. Now the test suite is ready to be run. First, run the tests that are meant to be run as user root: make NON_ROOT_USERNAME=nobody check-root We're going to run the remainder of the tests as the nobody user. Certain tests, however, require that the user be a member of more than one group. So that these tests are not skipped we'll add a temporary group and make the user nobody a part of it: echo "dummy:x:1000:nobody" >> /etc/group Fix some of the permissions so that the non-root user can compile and run the tests: chown -Rv nobody . Now run the tests. Make sure the PATH in the su environment includes /tools/bin. su nobody -s /bin/bash \ -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check" The test program test-getlogin is known to fail in a partially built system environment like the chroot environment here, but passes if run at the end of this chapter. The test program tty.sh is also known to fail. Remove the temporary group: sed -i '/dummy/d' /etc/group Install the package: make install Move programs to the locations specified by the FHS: mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin mv -v /usr/bin/chroot /usr/sbin mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8 Some of the scripts in the LFS-Bootscripts package depend on head, nice, sleep, and touch. As /usr may not be available during the early and late stages of booting, those binaries need to be on the root partition to maintain FHS compliance: mv -v /usr/bin/{head,nice,sleep,touch} /bin Contents of Coreutils Installed programs Installed library Installed directory [, b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, id, install, join, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, numfmt, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and yes libstdbuf.so (in /usr/libexec/coreutils) /usr/libexec/coreutils Short Descriptions base32 Encodes and decodes data according to the base32 specification (RFC 4648) base64 base64 Encodes and decodes data according to the base64 specification (RFC 4648) base64 b2sum Prints or checks BLAKE2 (512-bit) checksums b2sum basename Strips any path and a given suffix from a file name basename basenc Encodes or decodes data using various algorithms basenc cat Concatenates files to standard output cat chcon Changes security context for files and directories chcon chgrp Changes the group ownership of files and directories chgrp chmod Changes the permissions of each file to the given mode; the mode can be either a symbolic representation of the changes to make or an octal number representing the new permissions chmod chown Changes the user and/or group ownership of files and directories chown chroot Runs a command with the specified directory as the / directory chroot cksum Prints the Cyclic Redundancy Check (CRC) checksum and the byte counts of each specified file cksum comm Compares two sorted files, outputting in three columns the lines that are unique and the lines that are common comm cp Copies files cp csplit Splits a given file into several new files, separating them according to given patterns or line numbers and outputting the byte count of each new file csplit cut Prints sections of lines, selecting the parts according to given fields or positions cut date Displays the current time in the given format, or sets the system date date dd Copies a file using the given block size and count, while optionally performing conversions on it dd df Reports the amount of disk space available (and used) on all mounted file systems, or only on the file systems holding the selected files df dir Lists the contents of each given directory (the same as the ls command) dir dircolors Outputs commands to set the LS_COLOR environment variable to change the color scheme used by ls dircolors dirname Strips the non-directory suffix from a file name dirname du Reports the amount of disk space used by the current directory, by each of the given directories (including all subdirectories) or by each of the given files du echo Displays the given strings echo env Runs a command in a modified environment env expand Converts tabs to spaces expand expr Evaluates expressions expr factor Prints the prime factors of all specified integer numbers factor false Does nothing, unsuccessfully; it always exits with a status code indicating failure false fmt Reformats the paragraphs in the given files fmt fold Wraps the lines in the given files fold groups Reports a user's group memberships groups head Prints the first ten lines (or the given number of lines) of each given file head hostid Reports the numeric identifier (in hexadecimal) of the host hostid id Reports the effective user ID, group ID, and group memberships of the current user or specified user id install Copies files while setting their permission modes and, if possible, their owner and group install join Joins the lines that have identical join fields from two separate files join link Creates a hard link with the given name to a file link ln Makes hard links or soft (symbolic) links between files ln logname Reports the current user's login name logname ls Lists the contents of each given directory ls md5sum Reports or checks Message Digest 5 (MD5) checksums md5sum mkdir Creates directories with the given names mkdir mkfifo Creates First-In, First-Outs (FIFOs), a "named pipe" in UNIX parlance, with the given names mkfifo mknod Creates device nodes with the given names; a device node is a character special file, a block special file, or a FIFO mknod mktemp Creates temporary files in a secure manner; it is used in scripts mktemp mv Moves or renames files or directories mv nice Runs a program with modified scheduling priority nice nl Numbers the lines from the given files nl nohup Runs a command immune to hangups, with its output redirected to a log file nohup nproc Prints the number of processing units available to a process nproc numfmt Converts numbers to or from human-readable strings numfmt od Dumps files in octal and other formats od paste Merges the given files, joining sequentially corresponding lines side by side, separated by tab characters paste pathchk Checks if file names are valid or portable pathchk pinky Is a lightweight finger client; it reports some information about the given users pinky pr Paginates and columnates files for printing pr printenv Prints the environment printenv printf Prints the given arguments according to the given format, much like the C printf function printf ptx Produces a permuted index from the contents of the given files, with each keyword in its context ptx pwd Reports the name of the current working directory pwd readlink Reports the value of the given symbolic link readlink realpath Prints the resolved path realpath rm Removes files or directories rm rmdir Removes directories if they are empty rmdir runcon Runs a command with specified security context runcon seq Prints a sequence of numbers within a given range and with a given increment seq sha1sum Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1) checksums sha1sum sha224sum Prints or checks 224-bit Secure Hash Algorithm checksums sha224sum sha256sum Prints or checks 256-bit Secure Hash Algorithm checksums sha256sum sha384sum Prints or checks 384-bit Secure Hash Algorithm checksums sha384sum sha512sum Prints or checks 512-bit Secure Hash Algorithm checksums sha512sum shred Overwrites the given files repeatedly with complex patterns, making it difficult to recover the data shred shuf Shuffles lines of text shuf sleep Pauses for the given amount of time sleep sort Sorts the lines from the given files sort split Splits the given file into pieces, by size or by number of lines split stat Displays file or filesystem status stat stdbuf Runs commands with altered buffering operations for its standard streams stdbuf stty Sets or reports terminal line settings stty sum Prints checksum and block counts for each given file sum sync Flushes file system buffers; it forces changed blocks to disk and updates the super block sync tac Concatenates the given files in reverse tac tail Prints the last ten lines (or the given number of lines) of each given file tail tee Reads from standard input while writing both to standard output and to the given files tee test Compares values and checks file types test timeout Runs a command with a time limit timeout touch Changes file timestamps, setting the access and modification times of the given files to the current time; files that do not exist are created with zero length touch tr Translates, squeezes, and deletes the given characters from standard input tr true Does nothing, successfully; it always exits with a status code indicating success true truncate Shrinks or expands a file to the specified size truncate tsort Performs a topological sort; it writes a completely ordered list according to the partial ordering in a given file tsort tty Reports the file name of the terminal connected to standard input tty uname Reports system information uname unexpand Converts spaces to tabs unexpand uniq Discards all but one of successive identical lines uniq unlink Removes the given file unlink users Reports the names of the users currently logged on users vdir Is the same as ls -l vdir wc Reports the number of lines, words, and bytes for each given file, as well as a total line when more than one file is given wc who Reports who is logged on who whoami Reports the user name associated with the current effective user ID whoami yes Repeatedly outputs y or a given string until killed yes libstdbuf Library used by stdbuf libstdbuf