{"id":1178,"date":"2012-07-23T17:42:09","date_gmt":"2012-07-23T17:42:09","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=1178"},"modified":"2012-07-23T17:42:09","modified_gmt":"2012-07-23T17:42:09","slug":"search-man-pages","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=1178","title":{"rendered":"Search Man Pages"},"content":{"rendered":"<p>You need to use the following commands to search man pages:<\/p>\n<h2>apropos Command<\/h2>\n<p>The apropos command searches a set of database files containing short descriptions of system commands for keywords and shows the result on the screen. The syntax is as follows:<\/p>\n<pre>\u00a0\r\napropos keyword\r\napropos \"string or phrase\"\r\napropos -s 1 delete<\/pre>\n<h3>apropos Command Examples<\/h3>\n<p>To Search command \/ functions related to compare operation, enter:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">$ apropos compare<\/div><\/div>\n<p>Sample outputs:<\/p>\n<pre>[ (1)                - check file types and compare values\r\nbcmp (3)             - compare byte sequences\r\nbzcmp (1)            - compare bzip2 compressed files\r\nbzdiff (1)           - compare bzip2 compressed files\r\ncmp (1)              - compare two files byte by byte\r\ncomm (1)             - compare two sorted files line by line\r\ncompare (1)          - mathematically and visually annotate the difference between an image and its reconstruction.\r\ndiff (1)             - compare files line by line\r\ndiff3 (1)            - compare three files line by line\r\ngit-diff-files (1)   - Compares files in the working tree and the index\r\ngit-diff-index (1)   - Compares content and mode of blobs between the index and repository\r\ngit-diff-tree (1)    - Compares the content and mode of blobs found via two tree objects\r\ninfocmp (1)          - compare or print out terminfo descriptions\r\nmcomp (1)            - Compares two files using mtools\r\nmemcmp (3)           - compare memory areas\r\nmsgcmp (1)           - compare message catalog and template\r\nndiff (1)            - Utility to compare the results of Nmap scans\r\nntfscmp (8)          - compare two NTFS filesystems and tell the differences\r\npthread_equal (3)    - compare thread IDs\r\nstrcasecmp (3)       - compare two strings ignoring case\r\nstrcmp (3)           - compare two strings\r\nstrcoll (3)          - compare two strings using the current locale\r\nstrncasecmp (3)      - compare two strings ignoring case\r\nstrncmp (3)          - compare two strings\r\nstrverscmp (3)       - compare two version strings\r\ntest (1)             - check file types and compare values\r\nwcscasecmp (3)       - compare two wide-character strings, ignoring case\r\nwcscmp (3)           - compare two wide-character strings\r\nwcsncasecmp (3)      - compare two fixed-size wide-character strings, ignoring case\r\nwcsncmp (3)          - compare two fixed-size wide-character strings\r\nwmemcmp (3)          - compare two arrays of wide-characters\r\nxzcmp (1)            - compare compressed files\r\nxzdiff (1)           - compare compressed files\r\nzcmp (1)             - compare compressed files\r\nzdiff (1)            - compare compressed files<\/pre>\n<h4>Task: Search For a String<\/h4>\n<p>Search command to remove a file, enter:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">$ apropos &quot;remove file&quot;<\/div><\/div>\n<p>Sample outputs:<\/p>\n<pre>rm                   (1)  - remove files or directorie<\/pre>\n<h4>Task: Search Specific Section of The Man Page<\/h4>\n<p>To search only the given manual section use the -s option:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">apropos -s 1 compare<\/div><\/div>\n<p>Sample outputs:<\/p>\n<pre>[ (1)                - check file types and compare values\r\nbzcmp (1)            - compare bzip2 compressed files\r\nbzdiff (1)           - compare bzip2 compressed files\r\ncmp (1)              - compare two files byte by byte\r\ncomm (1)             - compare two sorted files line by line\r\ncompare (1)          - mathematically and visually annotate the difference between an image and its reconstruction.\r\ndiff (1)             - compare files line by line\r\ndiff3 (1)            - compare three files line by line\r\ngit-diff-files (1)   - Compares files in the working tree and the index\r\ngit-diff-index (1)   - Compares content and mode of blobs between the index and repository\r\ngit-diff-tree (1)    - Compares the content and mode of blobs found via two tree objects\r\ninfocmp (1)          - compare or print out terminfo descriptions\r\nmcomp (1)            - Compares two files using mtools\r\nmsgcmp (1)           - compare message catalog and template\r\nndiff (1)            - Utility to compare the results of Nmap scans\r\ntest (1)             - check file types and compare values\r\nxzcmp (1)            - compare compressed files\r\nxzdiff (1)           - compare compressed files\r\nzcmp (1)             - compare compressed files\r\nzdiff (1)            - compare compressed files<\/pre>\n<h4>Task: Regex Based Search<\/h4>\n<p>You can force apropos to interpret each keyword as a regular expression using the -r option:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">$ apropos -r scanf<\/div><\/div>\n<p>Sample outputs:<\/p>\n<pre>fscanf (3)           - input format conversion\r\nscanf (3)            - input format conversion\r\nsscanf (3)           - input format conversion\r\nVideo::DVDRip::CPAN::Scanf (3pm) - emulate sscanf() of the C library\r\nvfscanf (3)          - input format conversion\r\nvscanf (3)           - input format conversion\r\nvsscanf (3)          - input format conversion<\/pre>\n<h2>The &#8216;man -K&#8217; Command<\/h2>\n<p>The -K option is passed to the man command to search for the specified string in all man pages. The syntax is as follows:<\/p>\n<pre>\u00a0\r\nman -K keyword\r\nman -K \"string or phrase\"<\/pre>\n<p>Search all man pages for fopen word, type:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">$ man -K &quot;fopen&quot;<\/div><\/div>\n<p>Output:<\/p>\n<pre>\/usr\/share\/man\/en\/man3\/fclose.3.gz? [ynq]<\/pre>\n<p>Type\u00a0y\u00a0to open\/display man page,\u00a0n\u00a0to continue search,\u00a0q\u00a0to Quit search. This is a brute-force search, and is likely to take some time. So it helps to specify a man page section (1-7) using the following syntax:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">$ man -s 3 -K &quot;open&quot;<\/div><\/div>\n<p>OR<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">$ man -s 8 -K &quot;user&quot;<\/div><\/div>\n<p>Please note that above commands also works with other UNIX and *BSD like oses<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You need to use the following commands to search man pages: apropos Command The apropos command searches a set of database files [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1178","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1178"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1178\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}