Linux / Unix: Read a Man Page From Local Directory

I have a man page stored in my home directory called ~/foo.1. How do I read a $HOME/foo.1 man page file? How can I read the file called ~/foo.1 as a manpage with man command?

troff is a document processing system developed by AT&T for the Unix operating system. The troff typesetting system includes sets of commands called macros that are run before starting to process the document.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements man/nroff
Est. reading time N/A
These macros include setting up page headers and footers, defining new commands, and generally influencing how the output will be formatted. Under Linux all new manual pages should be marked up using the groff an.tmac package. The groff (GNU troff) software is a typesetting package which reads plain text mixed with formatting commands and produces formatted output.

Option #1: Use man command

The syntax is:

man ./file-name
man $HOME/foo.1
man ~/foo.1
man /path/to/foo.1
man /path/to/your-man-page-here

Option #2: Use nroff command

The nroff script emulates the nroff command using groff and the syntax is:

nroff -man  foo.1
nroff -man  $HOME/foo.1
nroff -man  /path/to/foo.1
nroff -man  /path/to/your-man-page-here

Option #3: Set MANPATH shell variable

The man command searches the environment variable MANPATH. It is a colon-seperated list of directories like the PATH variable for man pages. To see current man page path, run:
$ manpath
Sample outputs:


man command uses a sophisticated method of finding manual page files, based on the invocation options and environment variables, the /etc/man.config configuration file, and some built in conventions and heuristics. If MANPATH is set, man uses it as the path to search for manual page files. It overrides the configuration file and the automatic search path, but is overridden by the -M invocation option.


Type the following command
$ export MANPATH="$(manpath):/path/to/your/man1/"
$ man 1 foo

See also

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Chris F.A. Johnson Mar 11, 2013 @ 1:53
      man ~/foo.1

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum