{"id":6581,"date":"2018-09-07T11:54:26","date_gmt":"2018-09-07T07:54:26","guid":{"rendered":"https:\/\/www.howtoforge.com\/linux-manpath-command\/"},"modified":"2018-09-07T11:54:26","modified_gmt":"2018-09-07T07:54:26","slug":"linux-manpath-command-tutorial-for-beginners-5-examples","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/linux-manpath-command-tutorial-for-beginners-5-examples\/","title":{"rendered":"Linux manpath Command Tutorial for Beginners (5 Examples)"},"content":{"rendered":"<p>Man pages in Linux is the go to spot for first-level support when it comes to command line utilities. As most of you would know, you just write &#8216;man [command-name]&#8217; and the corresponding man page pops up. But do you know the path where these man pages are searched for?<\/p>\n<p>In this tutorial, we will discuss <strong>manpath<\/strong>, a utility that shows you this information. But before we start with the explanation, it&#8217;s worth mentioning that all examples here have been tested on an Ubuntu 18.04 LTS machine.<\/p>\n<h2 id=\"linux-manpath-tutorial\">Linux manpath tutorial<\/h2>\n<p>The manpath command in Linux helps you determine search path for manual pages. Following is its syntax:<\/p>\n<p class=\"command\">manpath [-qgdc?V] [-m system[,&#8230;]] [-C file]<\/p>\n<p>And here&#8217;s how the tool&#8217;s man page describes it:<\/p>\n<pre readability=\"6\"> If\u00a0 $MANPATH is set, manpath will simply display its contents and issue<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 a warning.\u00a0 If not, manpath will determine a suitable manual page hier?<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 archy search path and display the results.<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 colon-delimited\u00a0 path\u00a0 is determined using information gained from<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the man-db configuration file - (\/etc\/manpath.config)\u00a0 and\u00a0 the\u00a0 user's<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 environment.<\/p><\/pre>\n<p>Following are some Q&amp;A-styled examples that should give you a good idea on how the manpath command works.<\/p>\n<h2 id=\"q-how-the-manpath-command-works\">Q1. How the manpath command works?<\/h2>\n<p>Basic usage is pretty straight forward &#8211; just execute &#8216;manpath&#8217; sans any option.<\/p>\n<p class=\"command\">manpath<\/p>\n<p>For example, here&#8217;s what the above command produced in output on my system:<\/p>\n<pre>\/usr\/local\/man:\/usr\/local\/share\/man:\/usr\/share\/man<\/pre>\n<p>So you can see, manpath produces a colon separated list of paths for manual pages.<\/p>\n<p>Note that you can use the -g command line option in case you want to produce a manpath consisting of all paths named as &#8216;global&#8217; within the man-db configuration file.<\/p>\n<h2 id=\"q-how-to-have-catpath-in-output-instead-of-manpath\">Q2. How to have catpath in output instead of manpath?<\/h2>\n<p>For this, use the -c command line option.<\/p>\n<p class=\"command\">manpath -c<\/p>\n<p>Here&#8217;s how the tool&#8217;s man page explains this operation:<\/p>\n<pre>Once the manpath is determined, each path element is converted to its relative catpath.<\/pre>\n<p>For example, here&#8217;s the output produced on my system:<\/p>\n<pre>\/var\/cache\/man\/oldlocal:\/var\/cache\/man\/local:\/var\/cache\/man<\/pre>\n<h2 id=\"q-how-to-make-manpath-print-debugging-information\">Q3. How to make manpath print debugging information?<\/h2>\n<p>For this, use the -d command line option.<\/p>\n<p class=\"command\">manpath -d<\/p>\n<p>For example, here&#8217;s the output this command produced on my system:<\/p>\n<p><a class=\"fancybox\" id=\"img-manpath-d\" href=\"https:\/\/www.howtoforge.com\/images\/command-tutorial\/big\/manpath-d.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/linux-manpath-command-tutorial-for-beginners-5-examples.png\" alt=\"How to make manpath print debugging information\" width=\"500\" height=\"454\" title=\"\"><\/a><\/p>\n<p>Agreed, you may not use this option very frequently, but you should at least be aware of it in case you need to debug the tool&#8217;s output.<\/p>\n<h2 id=\"q-how-to-make-manpath-access-other-os-manual-hierarchies\">Q4. How to make manpath access other OS&#8217; manual hierarchies?<\/h2>\n<p>For this, use the -m command line option. Here&#8217;s how the tool&#8217;s man page explains this option:<\/p>\n<pre readability=\"9\">-m system[,...], --systems=system[,...]<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <br\/>If\u00a0 this\u00a0 system\u00a0 has access to other operating sys?<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tem's manual hierarchies, this option can be used to<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 include\u00a0 them\u00a0 in the output of manpath.\u00a0 To include<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NewOS's manual page hierarchies use\u00a0 the\u00a0 option\u00a0 -m<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NewOS.<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 system\u00a0 specified can be a combination of comma<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 delimited operating system names.\u00a0\u00a0 To\u00a0 include\u00a0 the<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 native\u00a0 operating\u00a0 system's manual page hierarchies,<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the system name man must be included in the argument<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 string.\u00a0 This option will override the $SYSTEM envi?<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ronment variable.<\/p><\/pre>\n<h2 id=\"q-how-to-make-manpath-use-a-custom-config-file\">Q5. How to make manpath use a custom config file?<\/h2>\n<p>By default, manpath fetches information from the following file:<\/p>\n<pre>\/etc\/manpath.config<\/pre>\n<p>However, if you want, you can force manpath to read any other file. This you can do using -C command line option.<\/p>\n<p class=\"command\">manpath -C NEWFILE-PATH<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>If your Linux command line work involves dealing with man pages, the manpath command is a helpful tool for you. Here, in this tutorial, we have discussed majority of manpath command line options. For more info on the tool, head to its <a href=\"http:\/\/man7.org\/linux\/man-pages\/man1\/manpath.1.html\" target=\"_blank\" rel=\"noopener noreferrer\">man page<\/a>.<\/p>\n<div class=\"authorbox\" readability=\"15\">\n<img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/linux-manpath-command-tutorial-for-beginners-5-examples.jpg\" alt=\"Himanshu Arora\" title=\"\"> <\/p>\n<p><strong>About Himanshu Arora<\/strong><\/p>\n<p>Himanshu Arora has been working on Linux since 2007. He carries professional experience in system level programming, networking protocols, and command line. In addition to HowtoForge, Himanshu&#8217;s work has also been featured in some of world&#8217;s other leading publications including Computerworld, IBM DeveloperWorks, and Linux Journal.<\/p>\n<\/div>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Flinux-manpath-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/linux-manpath-command-tutorial-for-beginners-5-examples-1.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-manpath-command%2F&amp;text=Linux+manpath+Command+Tutorial+for+Beginners+%285+Examples%29&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/linux-manpath-command-tutorial-for-beginners-5-examples-2.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/linux-manpath-command-tutorial-for-beginners-5-examples-3.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-manpath-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/linux-manpath-command-tutorial-for-beginners-5-examples-4.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Man pages in Linux is the go to spot for first-level support when it comes to command line utilities. As most of you would know, you just write &#8216;man [command-name]&#8217; and the corresponding man page pops up. But do you know the path where these man pages are searched for? In this tutorial, we will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-6581","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=6581"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6581\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=6581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=6581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=6581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}