A.8. Coreutils

For installation instructions see Section 6.16.

A.8.1. Official Download Location

Coreutils (5.0):
ftp://ftp.gnu.org/gnu/coreutils/

Coreutils Hostname Patch:
http://www.linuxfromscratch.org/patches/lfs/5.0/coreutils-5.0-hostname-2.patch

Coreutils Uname Patch:
http://www.linuxfromscratch.org/patches/lfs/5.0/coreutils-5.0-uname.patch

A.8.2. Contents of Coreutils

The Coreutils package contains a whole series of basic shell utilities.

Installed programs: basename, cat, 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, hostname, id, install, join, kill, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mv, nice, nl, nohup, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, rm, rmdir, seq, sha1sum, shred, sleep, sort, split, stat, stty, su, sum, sync, tac, tail, tee, test, touch, tr, true, tsort, tty, uname, unexpand, uniq, unlink, uptime, users, vdir, wc, who, whoami and yes

A.8.3.

A.8.4. Short descriptions

basename strips any path and a given suffix from the given file name.

cat concatenates files to standard output.

chgrp changes the group ownership of each given file to the given group. The group can be either given a a name or a numeric ID.

chmod changes the permissions of each given 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.

chown changes the user and/or group ownership of each given file to the given user:group pair.

chroot runs a given command with the specified directory as the / directory. The given command can be an interactive shell. On most systems only root can do this.

cksum prints the CRC checksum and the byte counts of each specified file.

comm compares two sorted files, outputting in three columns the lines that are unique, and the lines that are common.

cp copies files.

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.

cut prints parts of lines, selecting the parts according to given fields or positions.

date displays the current time in the given format, or sets the system date.

dd copies a file using the given blocksize and count, while optionally performing conversions on it.

df reports the amount of disk space available (and used) on all mounted filesystems, or only on the filesystems holding the given files.

dir is the same as ls.

dircolors outputs commands to set the LS_COLOR environment variable, to change the color scheme used by ls.

dirname strips the non-directory suffix from a given file name.

du reports the amount of disk space used by the current directory, or by each of the given directories including all their subdirectories, or by each of the given files.

echo displays the given strings.

env runs a command in a modified environment.

expand converts tabs to spaces.

expr evaluates expressions.

factor prints the prime factors of all specified integer numbers.

false does nothing, unsuccessfully. It always exits with a status code indicating failure.

fmt reformats the paragraphs in the given files.

fold wraps the lines in the given files.

groups reports a user's group memberships.

head prints the first ten lines (or the given number of lines) of each given file.

hostid reports the numeric identifier (in hexadecimal) of the host.

hostname reports or sets the name of the host.

id reports the effective user ID, group ID, and group memberships of the current user, or of a given user.

install copies files while setting their permission modes and, if possible, their owner and group.

join joins from two files the lines that have identical join fields.

kill terminates the given process.

link creates a hard link with the given name to the given file.

ln makes hard links or soft links between files.

logname reports the current user's login name.

ls lists the contents of each given directory. By default it orders the files and subdirectories alphabetically.

md5sum reports or checks MD5 checksums.

mkdir creates directories with the given names.

mkfifo creates FIFOs with the given names.

mknod creates device nodes with the given names. A device node is a character special file, or a block special file, or a FIFO.

mv moves or renames files or directories.

nice runs a program with modified scheduling priority.

nl numbers the lines from the given files.

nohup runs a command immune to hangups, with output redirected to a log file.

od dumps files in octal and other formats.

paste merges the given files, joining sequentially corresponding lines side by side, separated by TABs.

pathchk checks whether file names are valid or portable.

pinky is a lightweight finger. It reports some information about the given users.

pr paginates and columnates files for printing.

printenv prints the environment.

printf prints the given arguments according to the given format -- much like the C printf function.

ptx produces from the contents of the given files a permuted index, with each keyword in its context.

pwd reports the name of the current directory.

readlink reports the value of the given symbolic link.

rm removes files or directories.

rmdir removes directories, if they are empty.

seq prints a sequence of numbers, within a given range and with a given increment.

sha1sum prints or checks 160-bit SHA1 checksums.

shred overwrites the given files repeatedly with strange patterns, to make it real hard to recover the data.

sleep pauses for the given amount of time.

sort sorts the lines from the given files.

split splits the given file into pieces, by size or by number of lines.

stty sets or reports terminal line settings.

su runs a shell with substitute user and group IDs.

sum prints checksum and block counts for each given file.

sync flushes filesystem buffers. It forces changed blocks to disk and updates the super block.

tac concatenates the given files in reverse.

tail prints the last ten lines (or the given number of lines) of each given file.

tee reads from standard input while writing both to standard output and to the given files.

test compares values and checks file types.

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.

tr translates, squeezes, and deletes the given characters from standard input.

true does nothing, successfully. It always exits with a status code indicating success.

tsort performs a topological sort. It writes a totally ordered list according to the partial ordering in a given file.

tty reports the file name of the terminal connected to standard input.

uname reports system information.

unexpand converts spaces to tabs.

uniq discards all but one of successive identical lines.

unlink removes the given file.

uptime reports how long the system has been running, how many users are logged on, and the system load averages.

users reports the names of the users currently logged on.

vdir is the same as ls -l.

wc reports the number of lines, words, and bytes for each given file, and a total line when more than one file is given.

who reports who is logged on.

whoami reports the user name associated with the current effective user ID.

yes outputs 'y' or a given string repeatedly, until killed.

A.8.5.

A.8.6. Coreutils Installation Dependencies

Coreutils depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, Sed.