22
|
Getting Help and Searching
The behaviour of many commands can be modified by using ‘switches’ or ‘arguments’. These are
described in the online manuals (man-pages), which can be ready using the ‘man ’ command.
Information is also available about programming libraries and other operating system features.
To advance through the text, use the Page Up & Page Down keys. Type ‘h’ to discover more
sophisticated commands, and type ‘q’ to quit the man page.
If you’re not sure what
manual page you want to see, you can use the –k option:
Sometimes -k will give you a surprisingly long list of results. So long that it will scroll off the screen.
You can scroll back up the screen by using Shift + Page Up & Shift + Page Down. Another method
of reading all the results is to pipe(|) the results into ‘less ’. Try the following commands:
With the ‘ | less ‘ pipe invoked, the output from the ‘man –k directory ’ part of the command gets
piped into less, which then displays it on the screen. You will notice that at the end of the list, there
is a blank line with ‘:’ displayed. You can now use the return or spacebar key to move down through
the list. Type ‘q’ at any time to return to the command prompt.
ls -l
man ls
Get a list of files and folders in
long format - now you need to know
how to interpret it...
Opens the man (User Manual)
page for
the ‘ls’ command. Read this to find
out how to interpret the output.
man -k
man
Replace with your search
term. Once you have found your
desired man page you can go ahead and
open it like before...
Replace with the desired
result from your previous search.
This will open the man page.
clear
man -k directory
man -k directory | less
This will clear the visible terminal
of all previous output. You can still
return to the previous screen by
using Shift + Page Up / Page Down to
scroll back through the terminal.
This will search for a keyword that
displays lots of results.
By piping this output to another
command, we can filter these results.
Use the | character to try piping hte
output into less - see what happens.