Download Summary
Transcript
09 8776 CH06 3/17/00 2:35 PM Page 88 88 Hour 6 directory structure in which to store his project files. Joe started with a subdirectory called books. He also needed a subdirectory for each project; Joe’s current project is called Linux. Then he needed a place to store different elements of the project, so he has a chapters subdirectory. Finally, there is a file in the directory. All this results in the following filename: /home/Joe/books/Linux/chapters/Hour6 Long filenames are a pretty common occurrence in Linux, but they can make a mess out of typing things on the command line. Filenames can be as long as 256 characters and they can contain letters (both upper- and lowercase) and numbers. You can also use special characters like the dot (.), dash (-), and underscore (_) characters. Filenames cannot contain reserved metacharacters like the asterisk (*) or question mark (?). To make Linux a little easier to deal with, there are two versions of Linux filenames. The one explained previously would be tiring to type in again and again. It is called an absolute filename. Absolute filenames always begin with the slash (/) character, which indicates the root directory, and then slashes are used to specify the exact path through the directories to the file’s location. Absolute filenames work from anywhere in the filesystem. NEW TERM The second type of filename refers to a file’s location in respect to the working directory’s location. It is called a relative filename. Relative filenames refer to files that are in the subdirectories of the working directory (your present location). As an example, if Joe were working in the /home/Joe/books/Linux directory, he could get the file with the relative file specification (which just names the directories between his current working directory and the file) like this: chapters/Hour6 Since the filename does not begin with a slash, the system will begin searching for the file from the working directory (/home/Joe/books/Linux). This is a bit shorter at least. Relative filenames work only if you stay in the same working directory. If Joe’s working directory changed to /home/Joe/books, the relative path to the file would change to /Linux/chapters/Hour6.