5.16. Installing Sh-utils-2.0

Estimated build time:           2 minutes
Estimated required disk space:  23 MB

5.16.1. Installation of Sh-utils

Before Sh-utils is installed, the sh-utils patch file may need to be applied. This patch is needed to avoid a conflict of variable names with certain Glibc verions (usually glibc-2.1.x) when compiling sh-utils statically. It is however safe to apply the patch even if you are running a different glibc version, so if you aren't sure, it's best to apply it.

Apply the patch by running the following command:

patch -Np1 -i ../sh-utils-2.0.patch

Install Sh-utils by running the following commands:

./configure --prefix=$LFS/usr --disable-nls &&
make LDFLAGS=-static &&
make install &&
cd $LFS/usr/bin &&
mv date echo false pwd stty $LFS/bin &&
mv su true uname hostname $LFS/bin

5.16.2. Contents

The Sh-utils package contains the basename, chroot, date, dirname, echo, env, expr, factor, false, groups, hostid, hostname, id, logname, nice, nohup, pathchk, pinky, printenv, printf, pwd, seq, sleep, stty, su, tee, test, true, tty, uname, uptime, users, who, whoami and yes programs.

5.16.3. Description

5.16.3.1. basename

basename strips directory and suffixes from filenames.

5.16.3.2. chroot

chroot runs a command or interactive shell with special root directory.

5.16.3.3. date

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

5.16.3.4. dirname

dirname strips non-directory suffixes from file name.

5.16.3.5. echo

echo displays a line of text.

5.16.3.6. env

env runs a program in a modified environment.

5.16.3.7. expr

expr evaluates expressions.

5.16.3.8. factor

factor prints the prime factors of all specified integer numbers.

5.16.3.9. false

false always exits with a status code indicating failure.

5.16.3.10. groups

groups prints the groups a user is in.

5.16.3.11. hostid

hostid prints the numeric identifier (in hexadecimal) for the current host.

5.16.3.12. hostname

hostname sets or prints the name of the current host system

5.16.3.13. id

id prints the real and effective UIDs and GIDs of a user or the current user.

5.16.3.14. logname

logname prints the current user's login name.

5.16.3.15. nice

nice runs a program with modified scheduling priority.

5.16.3.16. nohup

nohup runs a command immune to hangups, with output to a non-tty

5.16.3.17. pathchk

pathchk checks whether file names are valid or portable.

5.16.3.18. pinky

pinky is a lightweight finger utility which retrieves information about a certain user

5.16.3.19. printenv

printenv prints all or part of the environment.

5.16.3.20. printf

printf formats and prints data (the same as the printf C function).

5.16.3.21. pwd

pwd prints the name of the current/working directory

5.16.3.22. seq

seq prints numbers in a certain range with a certain increment.

5.16.3.23. sleep

sleep delays for a specified amount of time.

5.16.3.24. stty

stty changes and prints terminal line settings.

5.16.3.25. su

su runs a shell with substitute user and group IDs

5.16.3.26. tee

tee reads from standard input and writes to standard output and files.

5.16.3.27. test

test checks file types and compares values.

5.16.3.28. true

True always exits with a status code indicating success.

5.16.3.29. tty

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

5.16.3.30. uname

uname prints system information.

5.16.3.31. uptime

uptime tells how long the system has been running.

5.16.3.32. users

users prints the user names of users currently logged in to the current host.

5.16.3.33. who

who shows who is logged on.

5.16.3.34. whoami

whoami prints the user's effective userid.

5.16.3.35. yes

yes outputs a string repeatedly until killed.

5.16.4. Dependencies

Sh-utils-2.0 needs the following to be installed:


sh from the bash package

ar from the binutils package
as from the binutils package
ld from the binutils package

cmp from the diffutils package

chmod from the fileutils package
chown from the fileutils package
cp from the fileutils package
ln from the fileutils package
ls from the fileutils package
mv from the fileutils package
rm from the fileutils package

cc from the gcc package

egrep from the grep package
grep from the grep package

make from the make package

sed from the sed package

basename from the sh-utils package
expr from the sh-utils package
sleep from the sh-utils package
uname from the sh-utils package

cat from the textutils package
tr from the textutils package