Prev | Current Page 214 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

For example, ~chris would be
expanded to the chris home directory (probably /home/chris).
Other special ways of identifying directories in the shell include the following:
 .??”A single dot (.) refers to the current directory.
 ..??”Two dots (..) refer to a directory directly above the current directory.
 $PWD??”This environment variable refers to the current working directory.
 $OLDPWD??”This environment variable refers to the previous working directory before you
changed to the current one.
NOTE
69
Running Commands from the Shell 2
Using File-Matching Metacharacters
To save you some keystrokes and to be able to refer easily to a group of files, the bash shell lets you
use metacharacters. Anytime you need to refer to a file or directory, such as to list it, open it, or
remove it, you can use metacharacters to match the files you want. Here are some useful metacharacters
for matching filenames:
 *??”Matches any number of characters.
 ???”Matches any one character.
 [...]??” Matches any one of the characters between the brackets, which can include a
dash-separated range of letters or numbers.
Try out some of these file-matching metacharacters by first going to an empty directory (such as
the test directory described in the previous section) and creating some empty files:
$ touch apple banana grape grapefruit watermelon
The touch command creates empty files.


Pages:
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226