How to Exit the MAN Command and Quit Man Pages Properly
The “man” command is short for manual, and with it you can summon detailed manual page and information on nearly any other command or command line utility that is available, including using an extensive man document search to find related manual pages. While man pages are frequently used and referenced, many users don’t know how to properly exit our quit out of the man command. That may sound a little silly or newbie-ish, but even longtime unix users may not know how to quit out of man (let alone quitting VIM for that matter – both are more common than you’d think).
We get this question often, and not to worry; exiting the man command is extremely easy and it’s universal, meaning you can quit man the same on any unix OS that includes the feature, whether that is Mac OS, Mac OS X, linux, BSD, or otherwise.
The Trick to Exiting man Command: q
Just press “q” key to quit out of a man page. Yes it is that easy, simply pressing “q” will exit out of the man command properly.
This should be easy for Mac users to remember because the Command + Q keyboard shortcut quits an application, so it’s already fairly similar – just drop the Command key and press “Q” alone and you will quit out of any open man page.
If you want to try this out yourself, go ahead and launch the Terminal application and then open any man page by typing “man (command)” for example “man ipconfig” (you can quick launch man pages through the Terminal Help menu by the way, or right-click on a command and launch one from there).
Of course what not to do is the button mash: a common theme is for many command line users to mash Control+C, Control+Z or Control+X to try and suspend or exit MAN, I have seen this many times (and ages ago when first exploring the command line did the same thing myself) but all that will do is suspend man which then must be terminated separately. That’s not the right approach, and it’s actually harder than just pressing “q” anyway – so if you have that habit, try to remember to just press ‘q’ instead, it’s a lot easier.
Do you know of any other tricks or easy ways to remember exiting manual pages or to better work with man command? Let us know in the comments.
Thank youuu!!
Very nice and well-defined post for exiting the Man command.
Wow 2 paragraphs just to say enter ‘q’. Why not add the history of operating systems first.
You could also do this (generates a PDF and opens in Preview.app):
man -t | open -f -a Preview
So view the manpage for “vi”, you would do:
man -t vi | open -f -a Preview
I have a function in my .bash_profile to do this:
# Open ManPages in Preview
function manp {
man -t $1 | open -f -a Preview
}
So I can just do: manp vi
I’d like to know how to ‘suspend’ man to bring up the command prompt so I can type whatever I’ve learned, then go back to the man page to keep reading, etc.
Normally I do this by opening a second terminal window ā 1 for man, 2 for the command prompt ā but if there is something more elegant I’d certainly like to learn it!
Great question. I like having multiple terminal windows for myself for exactly the reason you describe, side by side windows so you can learn/read and then utilize the command in the other window.
You can suspend with Control-Z however, then resume with fg %1, or by using the screen command like “screen man command” then resume with screen -r
Got one for vi?
Yes indeed, there are a bunch of ways to quit out of VI / VIM – that one confuses nearly everyone who isn’t a regular vim user!
https://osxdaily.com/2014/06/12/how-to-quit-vim/
It would be nice to know how to get the manual in the first place so I could delete it when I’m through!
man [insert command name]
In Terminal of course.