How to Exit from Linux Man Pages

Unix and Linux operating systems generally come with short manual (man) pages which help all the users to learn about different commands and its syntax.

Even it is one of the most frequently used documentation many users get confused with exiting the man pages one they read the manual.

In this tutorial, we learn how to properly exit from man pages.

Different Ways to Exit Man Page

You can also try pressing the following keys to exit from a man page.

1. :q

2. Q

3. :Q

4. ZZ

Steps to Exit Man Page

-> Open a terminal and type man ftp (this will open manual pages for ftp application)

type man command

-> Now, press up and down arrow keys and read the whole document.

press up and down arrow keys on man page

-> Once you are done press q on the keyboard and you will come out by reading the manual.

Another thing about man pages in some of the distributions of Linux is that once you quit from it, its contents are cleared off. These contents never stay once you quit from the man pages. This happens means that the default pager of viewing man is less command. Wiping out such contents is not of personal choice. Some people many like this but sometimes you really want that the contents should be visible once you are done with viewing it. You will want the information to be present in front of you. The thing here is you can definitely change this behavior. This can be done by changing the default pager for the command to more. To do this you have to add the below mentioned line in your .bashrc file of the home directory.

export PAGER=/bin/more

You can also change this behavior permanently on the system then edit the file /etc/man.config (Red Hat) or /etc/manpath.config (Debian) and change the line for PAGER here. An alternate method to do this is by running command update-alternatives –config pager (Debian) and alternatives –config pager (Red Hat). This will globally change the behavior for all the available applications.

--Note the line PAGER here which is highlighted. (File: /etc/man.config)

line PAGER

--Changes have been made to the line PAGER.

Changes line PAGER

Now, when we quit the man pages with q, it does not clear the screen.

quit the man pages

Each man page comes with the following information:

- Name of the command with its short description
- A SYNOPSIS of that command and its usage
- A description of the command
- List of different options associated with that command
- List of different configuration files associated with the command

If you specify any section then man pages only look for that section our manual. Now, the question occurs here is how we generally exit from man page when we have finished viewing the same. For most of the people who are known to Linux, the answer is well known. Before discussing it more let us have a look at some basic functionality of this manual command. These manual pages are easily accessed with any terminal in Linux by simply typing man program-name. Once the page is opened you can easily navigate these pages by making use of up and down arrow keys and even in certain cases you can also use enter key to get more help. Once you are done with the viewing of manual pages, you can simply exit or close this manual by pressing “q” key. This will take you back to the command prompt in an open terminal.

Leave a Comment