{"id":13171,"date":"2019-04-01T04:06:37","date_gmt":"2019-04-01T04:06:37","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13171"},"modified":"2019-04-01T04:06:37","modified_gmt":"2019-04-01T04:06:37","slug":"how-to-view-colored-man-pages-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-view-colored-man-pages-in-linux\/","title":{"rendered":"How to View Colored Man Pages in Linux"},"content":{"rendered":"<p>In Unix-like operating systems, a man page (in full manual page) is a documentation for a terminal-based program\/tool\/utility (commonly known as a command). It contains the name of the command, syntax for using it, a description, options available, author, copyright, related commands etc.<\/p>\n<p><strong>Read Also<\/strong>:\u00a0<a href=\"https:\/\/www.tecmint.com\/cat-command-output-with-syntax-highlighting-or-color\/\" target=\"_blank\" rel=\"noopener\">ccat \u2013 Show \u2018cat Command\u2019 Output with Syntax Highlighting or Colorizing<\/a><\/p>\n<p>You can read the manual page for a Linux command as follows; this will display the man page for the\u00a0<a href=\"https:\/\/www.tecmint.com\/how-to-check-disk-space-in-linux\/\" target=\"_blank\" rel=\"noopener\">df command<\/a>:<\/p>\n<pre>$ man df \r\n<\/pre>\n<div id=\"attachment_28202\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/df-Command-Man-Page.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-28202\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/df-Command-Man-Page.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/df-Command-Man-Page.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/df-Command-Man-Page-768x602.png 768w\" alt=\"df Command Man Page\" width=\"802\" height=\"629\" aria-describedby=\"caption-attachment-28202\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-28202\" class=\"wp-caption-text\">df Command Man Page<\/p>\n<\/div>\n<p>By default, the man program normally uses a terminal pager program such as\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-more-command-and-less-command-examples\/\" target=\"_blank\" rel=\"noopener\">more or less<\/a>\u00a0to format its output, and the default view is normally in white color for every kind of text (bold, underlined etc..).<\/p>\n<p>You can make some tweaks to your\u00a0<code>~\/.bashrc<\/code>\u00a0file to get nicely colored man pages by specifying a color scheme using various\u00a0<strong>LESS_TERMCAP<\/strong>\u00a0variables.<\/p>\n<pre>$ vi ~\/.bashrc\r\n<\/pre>\n<p>Add following color scheme variables.<\/p>\n<pre>export LESS_TERMCAP_mb=$'\\e[1;32m'\r\nexport LESS_TERMCAP_md=$'\\e[1;32m'\r\nexport LESS_TERMCAP_me=$'\\e[0m'\r\nexport LESS_TERMCAP_se=$'\\e[0m'\r\nexport LESS_TERMCAP_so=$'\\e[01;33m'\r\nexport LESS_TERMCAP_ue=$'\\e[0m'\r\nexport LESS_TERMCAP_us=$'\\e[1;4;31m'\r\n<\/pre>\n<p>Following are the color codes that we used in the above configuration.<\/p>\n<ul>\n<li>31 \u2013 red<\/li>\n<li>32 \u2013 green<\/li>\n<li>33 \u2013 yellow<\/li>\n<\/ul>\n<p>And here are the meanings of the escape codes used in the above configuration.<\/p>\n<ul>\n<li>0 \u2013 reset\/normal<\/li>\n<li>1 \u2013 bold<\/li>\n<li>4 \u2013 underlined<\/li>\n<\/ul>\n<p>You can additionally reset your terminal by typing\u00a0<strong>reset<\/strong>\u00a0or even start up another shell. Now when you try to view a man page\u00a0<a href=\"https:\/\/www.tecmint.com\/how-to-check-disk-space-in-linux\/\" target=\"_blank\" rel=\"noopener\">df command<\/a>, it should look like this, nicer than the default view.<\/p>\n<div id=\"attachment_28203\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Colored-Man-Page.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-28203\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Colored-Man-Page.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Colored-Man-Page.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Colored-Man-Page-768x657.png 768w\" alt=\"Colored Man Page\" width=\"802\" height=\"686\" aria-describedby=\"caption-attachment-28203\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-28203\" class=\"wp-caption-text\">Colored Man Page<\/p>\n<\/div>\n<p>Alternatively, you can use the\u00a0<a href=\"http:\/\/www.jedsoft.org\/most\/\" target=\"_blank\" rel=\"nofollow noopener\">MOST<\/a>\u00a0paging program, which works on Unix-like operating systems and supports multiple windows and can scroll left and right.<\/p>\n<pre>$ sudo apt install most\t\t#Debian\/Ubuntu \r\n# yum install most\t\t#RHEL\/CentOS\r\n# dnf install most\t\t#Fedora 22+\r\n<\/pre>\n<p>Next, add the line below in your\u00a0<code>~\/.bashrc<\/code>\u00a0file, then source the file like before and possibly reset your terminal.<\/p>\n<pre>export PAGER=\"most\"\r\n<\/pre>\n<div id=\"attachment_28204\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Most-Paging-Program.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-28204\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Most-Paging-Program.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Most-Paging-Program.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/12\/Most-Paging-Program-768x657.png 768w\" alt=\"Most Paging Program for Linux\" width=\"802\" height=\"686\" aria-describedby=\"caption-attachment-28204\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-28204\" class=\"wp-caption-text\">Most Paging Program for Linux<\/p>\n<\/div>\n<p><strong>Read Also<\/strong>:\u00a0<a href=\"https:\/\/www.tecmint.com\/customize-bash-colors-terminal-prompt-linux\/\" target=\"_blank\" rel=\"noopener\">How to Customize Bash Colors and Content in Linux Terminal Prompt<\/a><\/p>\n<p>In this article, we showed you how to display beautifully colored man pages in Linux. To send us any queries or share any useful Linux shell tips\/tricks, use the comment section below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/view-colored-man-pages-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Unix-like operating systems, a man page (in full manual page) is a documentation for a terminal-based program\/tool\/utility (commonly known as a command). It contains the name of the command, syntax for using it, a description, options available, author, copyright, related commands etc. Read Also:\u00a0ccat \u2013 Show \u2018cat Command\u2019 Output with Syntax Highlighting or Colorizing &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-view-colored-man-pages-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to View Colored Man Pages in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13171","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13171"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13171\/revisions"}],"predecessor-version":[{"id":13172,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13171\/revisions\/13172"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}