Classic Shell Scripting - Arnold Robbins [251]
Moving or renaming files and directories within the same filesystem is fast, since only their containing directory entries are updated; the file data blocks themselves are not accessed.
Hard and soft links allow multiple names for the same physical file. Hard links are restricted to a single physical filesystem, but soft links may point anywhere in the logical filesystem.
The inode table size is fixed when the filesystem is created, so the filesystem can be full even when plenty of storage is available for file data.
Appendix C. Important Unix Commands
Modern Unix systems come with hundreds and hundreds of commands. Many of them are specialized, but many are also generally useful, both in everyday interactive use and in shell scripts. It's impossible to cover every program on every system in existence, nor would that be useful. (Although books like Unix in a Nutshell make a valiant effort to describe a large cross section of what's out there.)
It is possible, however, to identify certain valuable commands, the ones that a Unix user or programmer should come to understand first, before moving on to the rest of the programs out there. Not surprisingly, many of these are the older commands that have been around since the early days of Unix. This appendix is our recommended list of commands that you should go out and study in order to improve your skills as a Unix developer. For brevity, we have resorted to simple, sorted, tabular lists of commands.
Shells and Built-in Commands
First and foremost, it pays to understand the Bourne shell language, particularly as codified by POSIX. Both bash and ksh93 are POSIX-compliant, and several other shells are compatible syntactically with the Bourne shell:
bash
The GNU Project's Bourne-Again Shell.
ksh
The Korn shell, either an original or clone, depending upon the operating system.
pdksh
The Public Domain Korn shell.
sh
The original Bourne shell, particularly on commercial Unix systems.
zsh
The Z-shell.
Along similar lines, you should understand the way the shell's built-in commands work:
.
Read and execute a given file, in the current shell.
break
Break out of a for, select, until, or while loop.
cd
Change the current directory.
command
Bypass the search for functions to run a regular built-in command.
continue
Start the next iteration of a for, select, until, or while loop.
eval
Evaluate given text as a shell command.
exec
With no arguments, change the shell's open files. With arguments, replace the shell with another program.
exit
Exit a shell script, optionally with a specific exit code.
export
Export a variable into the environment of subsequent programs.
false
Do nothing, unsuccessfully. For use in shell loops.
getopts
Process command-line options.
read
Read lines of input into one or more shell variables.
readonly
Mark a variable as read-only; i.e., unchangeable.
return
Return a value from a shell function.
set
Print shell variables and values; set shell options; set the command-line parameters ($1, $2, ...).
shift
Move the command-line parameters down by one or more.
test
Evaluate expressions, which may be string-, numeric-, or file-attribute-related.
trap
Manage operating system signals.
true
Do nothing, successfully. For use in shell loops.
type
Indicate the nature of a command (keyword, built-in, external, etc.).
typeset
Declare variables and manage their type and attributes.
ulimit
Set or display various per-process system-imposed limits.
unset
Remove shell variables and functions.
The following commands are useful in day-to-day shell scripting:
basename
Print the last component of a pathname, optionally removing a suffix. Mainly used in command substitution.
dirname
Print all but the last component of a pathname. Mainly used in command substitution.
env
Manipulate the environment