Datasheet
6
Phase 1
Working on the Command Line
whatis. Unfortunately, the whatis file is too long to fit on a standard 80×25 screen, although
it might fit on an extra-large screen or resized xterm.
more This command is a simple pager—it displays text a page (that is, a screenful) at a time.
When you’re done reading a page, press the spacebar and more displays the next page.
less Unix (and hence Linux) programmers aren’t afraid to display their (sometimes quirky)
senses of humor. The more program is limited—for instance, it doesn’t let you page backward in
a file. Thus, when it came time to improve more, the authors of the improved program called it
less as a joke. You can use the keyboard’s arrow keys and various other options to move back and
forth in the file. When you’re done, press the Q key to exit from the program. Type man less to
learn more about less. (The man command is described in more detail shortly, in “Getting Help.”)
All of these commands are intended to work on text files. When fed non-text
files, such as binary program files, cat is likely to cause a lot of annoying
beeping and may leave your screen displaying gibberish when you type new
commands. Typing reset should restore the screen to usability. Both more
and less cope a bit better with binary files, but you’re not likely to be able to
learn much from them. Recent versions of less are often smart enough to rec-
ognize certain common binary file types and pass them through a translator
so you can see their contents in text form.
Working with Directories
Whenever you’re running a shell, you’re working in a specific directory. When you refer to a
file without providing a complete path to the file, the shell works on the file in the current
working directory. (Similar rules apply to many programs.) The cd command changes the cur-
rent working directory. For instance, typing cd /home/sally changes the current directory
to /home/sally. The tilde (
~
) character is a useful shortcut; it stands for your home directory,
so cd ~ will have the same effect as cd /home/sally if your home directory is /home/sally.
Many Linux systems display the current working directory in their prompts. In Figure 1.1,
the current working directory is the home directory (~); that character appears in the com-
mand prompt and will be replaced by other directory names if you use cd to change directo-
ries. If your prompt doesn’t include this information and you want to know what directory
you’re working in, type pwd. This command’s name stands for print working directory; it dis-
plays the current working directory’s name.
Unlike DOS and Windows, Linux doesn’t use drive identifier letters, such as
C:. All directories reside in a single unified directory tree. Removable disks
and multiple disk partitions are mounted within that tree, as described in
Phase 5, “Managing Partitions and Filesystems.” Another important differ-
ence between Linux and Windows is that Linux uses a forward slash (/) to
separate directories, whereas Windows uses a backslash (\) for this purpose.
83484.book Page 6 Monday, September 18, 2006 8:58 AM










