Exiting a manual

I'm sure it's really easy, but I have searched on Google and on the forums and haven't found anything.

For instance, if I open the grep manual (man grep), I can't close it.
I've tried ctrl+c, ctrl+x, scrolling to the bottom of the manual.
How can I exit the manual without closing the shell?

edit: Thank you Tytalus.

you can quit the man pages at any time by pressing q

try h to see the full help.

the man pages are basically shunted through "more" so same syntax/command set as there.

HTH

FWIW -- I like to pump my man pages into vi before reading them because oftentimes
they contain code snippets and structs and what-not that I want to immediately use.
vi lets me grab specific lines and store them very nicely.

so my 'man' is actually 'mon' ( kinda Jamaican )

mon:

man $* | col -b > /tmp/man.$LOGNAME
vi /tmp/man.$LOGNAME
/bin/rm /tmp/man.$LOGNAME

or something like that...
Actually, there's a lot more to it... but that's essentially it.

Why do you need to read it in vi to do that? Simply copy and paste from the output of man.

you're right. you don't. it's just that I use vi 90% of my day...
it's just easy to search.... scroll backwards, forwards....
use the same hot-keys in "man" as I do everywhere else.
rather than switching to "more" mode.

Plus - - - on my machine - - - man uses formatting characters,
underlines, and overstrikes, ( ie. ^Hi^Hi^Hi^Hi ) where I've had problems cutting and pasting because you get all those control characters also.

Using col -b and vi eliminates that concern.

set your 'PAGER' to 'less' - this is more convenient.
<depending on your shell>

export PAGER=less

I've never know cutting (highlighting with the mouse) to capture control characters.

Got me there. Good one.

Like I said, it's mainly for navigation purposes, familiarity... etc...

( The control characters stay if you do something like:
man localtime > a
And then want to grab stuff that just happened to be highlighted. )

My 'mon' command also removes the page-headers and page-trailers,
so if the text you'd like to highlight happens to span on 2 pages,
you don't have to worry about that anymore.

Like in the localtime page part here:

     Declarations of all the functions and externals, and the  tm
     structure, are in the <time.h> header. The members of the tm
     structure are:

     int   tm_sec;    /* seconds after the minute - [0, 60] */
                      /* for leap seconds */
     int   tm_min;    /* minutes after the hour - [0, 59] */
     int   tm_hour;   /* hour since midnight - [0, 23] */
     int   tm_mday;   /* day of the month - [1, 31] */
     int   tm_mon;    /* months since January - [0, 11] */
     int   tm_year;   /* years since 1900 */
     int   tm_wday;   /* days since Sunday - [0, 6] */



SunOS 5.10          Last change: 27 May 2005                    2






Standard C Library Functions                            ctime(3C)



     int   tm_yday;   /* days since January 1 - [0, 365] */
     int   tm_isdst;  /* flag for alternate daylight savings time */


FYI, if you need your 'man' pages converted to Postscript (on Solaris):

#!/bin/ksh
# prepare a "man" page to be printed on the Postscript printer
# $1 - is "nroff"-ed "man" page - usually located on your MANPATH -
# [/usr/man/man1 man2 etc.....].
#
# The result of running this wrapper is a Postscript file placed under
# "/tmp" dirrectory with extention os ".ps". You can print this .ps
# on any Postscript printer from UNIX [if lp has been fonfigured]
# and/or transfer it to your NT print it from there.

TARGET_DIR="/tmp"
TARGET_PATH="${TARGET_DIR}/`basename ${1}`.ps"

troff -man ${1} | /usr/lib/lp/postscript/dpost > ${TARGET_PATH}

echo "\tYour converted postscript file is at ${TARGET_PATH}"