5. 7. 2010

gnu's man basics

man is manual page for *nix systems.
Syntax is man [command].

example:
man touch displays manual pages for "touch" command

Exiting
This is most tricky for *nix (or cygwin) newcomers. The very first thought which comes to my mind is to press ESC, but that leads to nowhere :)

to exit press x

Navigation
space - move to the next page
PageDown/PageUp - move to the next/previous page
home/end - the first/last page

Searching
When you are working with man in *nix/cygwin, sometimes you are in need to search some particular option/keyword.

1) man [command]
2) type /text_you_search_for (notice the slash on the begin)
3) found occurences are highlighted
4) type n for "find-next" idiom

Advanced searching
When searching inside man is not appropriate, you can redirect output to grep for example.
This is cool when you want to use regexp pattern to search.

This prints out line where "prune" word has been found + 2 lines Before and 2 lines After
man find | grep prune -A 2 -B 2

Do you know some more tricks?