The Bash Shell
◾
45
•
COPYRIGHT
• The copyright is listed.
• SEE ALSO
• The full documentation for ls is maintained as a Texinfo manual.
If the info and ls programs are properly installed at your site, the command
info ls
should give you access to the complete manual.
After each screen, the man page pauses with the “:” prompt. At this prompt,
man awaits
your keystroke to command how man should continue. You have the following options:
• Forward one screen—‘f,’ ‘z,’ space bar
• Forward half a screen—‘d’
• Forward one line—‘e,’ ‘j,’ enter key, down arrow
• Back one screen—‘b,’ ‘w’
• Back one half screen—‘u’
• Back one line—‘b,’ up arrow
• Return to top of man page—‘1G’
• Go to bottom of man page—‘G’
• Go to line #—#G (# is a number like 10G for line 10)
• Obtain help—‘h,’ ‘H’
• To move forward # lines—# (# is a number)
• To search forward for a string—/string
<
enter
>
• To search backward for a string—?string
<
enter
>
• Exit man page—‘q,’ ‘Q’
Nearly all Linux commands have options available. As we explore other Linux com-
mands, we will go over the most useful of the options. To
learn more about any command,
access its man page.
Another form of help is an instruction called
apropos
. This instruction is most useful if
you are not sure of the name of a command but have an idea of what the instruction should
do. For instance, if you want to identify the instruction that will respond with a summary
of virtual memory usage, you might issue the command
apropos virtual memory
or
apropos
“virtual
memory
.
”
Note that these two instructions
result in different
46
◾
Linux with Operating System Concepts
listings. The former provides a list of over 100 instructions while the latter matches three as
shown below.
mremap
(2)
- re-map a virtual memory address
vfork
(3p) - create a new process; share virtual memory
vmstat
(8)
- Report
virtual memory statistics
In this case, vmstat would be the instruction sought. The number within parentheses
indicates the section within the Linux man pages that contains the given instruction’s
entry.
Following apropos with a string results in a listing of all instructions which contained
that string as part of its description (as found in the man page). If your string contains
multiple words, apropos will respond differently depending on whether you enclose the
string in single or double quote marks or not. Without the quote marks,
apropos finds all
instructions whose descriptions contain any of the words found in the string. With double
quote marks, apropos matches the string exactly. Remember apropos when you cannot
remember the instruction’s name!
We will continue to explore Linux commands in nearly every chapter of this text. For
now, we move forward with more features of the Bash shell.
2.4 BASH FEATURES
2.4.1 Recalling Commands through History
Every time you enter a command, that command is stored in a history list.
To recall the
history list, type
history
. This will provide you a list of every command that has been
entered. The number of entries may be limited, but you should see dozens, perhaps hun-
dreds of commands. As an example, see Figure 2.3 which provides a short history list.
Each entry in the history list is preceded by a number. You can re-execute any com-
mand in the history list by typing
!
Do'stlaringiz bilan baham: