Shell Utilities
The shell utilities implement a number of shell commands you can use interactively or in shell scripts. Each utility program performs a specific task. The idea is that you can combine these commands in shell scripts to perform more complicated tasks. man progname, where progname is the name of the utility, to learn more about the command-line options. Then try the utility with appropriate options.
Cross Ref | You encounter some of these shell utilities again in Chapter 24 in the section covering shell programming. |
Program | Description |
---|---|
[ | Evaluates an expression and returns zero if the result is true (same as test) |
basename | Removes the path prefix from a given pathname |
chroot | Changes the root directory |
date | Prints or sets the system date and time |
dirname | Removes the last level or filename from a given pathname |
echo | Prints a line of text |
env | Prints environment variables or runs a command with modified environment variables |
expr | Evaluates expressions |
factor | Prints prime factors of a number |
false | Returns an unsuccessful exit status |
groups | Prints the names of the groups to which a user belongs |
hostid | Prints the numeric identifier for the host |
id | Prints the real and effective user and group IDs |
logname | Prints the current login name |
nice | Runs a program with specified scheduling priority |
nohup | Allows a command to continue running after the user logs out |
pathchk | Checks whether filenames are valid and portable |
pinky | Prints information about users. (This is similar to the finger program; in fact, the name pinky refers to a lightweight finger.) |
printenv | Prints environment variables |
printf | Formats and prints data |
pwd | Prints the working (current) directory |
seq | Prints numeric sequences |
sleep | Suspends execution for a specified time |
stty | Prints or changes terminal settings |
su | Enables the user to adopt the ID of another user, or the super user (root) |
tee | Sends output to multiple files |
test | Evaluates an expression and returns zero if the result is true |
true | Returns a successful exit status |
tty | Prints the terminal name |
uname | Prints system information |
users | Prints current user names |
who | Prints a list of all users currently logged in |
whoami | Prints the user name for the current effective user ID |
yes | Prints a string repeatedly until the process is killed |