Getting Around in the File System

If you are familiar with working in DOS, this should not be too difficult, after all, DOS was modeled after UNIX, and Linux was modeled after UNIX. There are some differences to be aware of, however. There is a document (listed in Appendix B, Resources) which specifically covers Linux basics for those experienced in DOS.

The cd command is available, and does the same thing as its DOS counterpart. One difference, however, is that the backslash (\)is not used in Linux to separate directories. In Linux, we use the forward slash (/) instead. Also, in DOS it is acceptable to type cd\dos to move from anywhere in the file system to the dos directory off of the root directory. Even if we replace the backslash with a forward slash, this will cause an error in Linux. When using the cd command, there must always be a space between the cd and the directory name. Thus, to move into, for example the /usr directory, we would type:

cd /usr

To move one directory above the current working directory, we would type:

cd ..

In order to see which files are in a directory, DOS users type the dir command. This command is available in most Linux distributions (Dachstein included), but is actually only a shortcut to the real Linux command, ls. Typing ls then [Enter] will display the contents of a directory in a fashion similar to the DOS command dir /w. The number of files on a line is dependent upon how long the longest file name in that directory is. To view detailed information about a file, type ls -l. This will display the file's name, owner, group, size, date, and permissions. In the directory entry example above, we see that this is a file (not a directory or link), called index.html. It is 5985 bytes, was created on August 20th at 6:24 p.m., and belongs to the sh-httpd user and the adm group.