{"id":103,"date":"2012-05-26T19:42:50","date_gmt":"2012-05-26T19:42:50","guid":{"rendered":"https:\/\/satyadeep.in\/blog\/?p=103"},"modified":"2012-08-07T10:23:10","modified_gmt":"2012-08-07T10:23:10","slug":"linux-command-help-help-commands","status":"publish","type":"post","link":"https:\/\/satyadeep.in\/blog\/linux-command-help-help-commands\/","title":{"rendered":"Linux Command Help \/ Help Commands"},"content":{"rendered":"<p>In this post I\u2019ll be talking about getting help for commands in Linux i.e the various methods of getting to know what a command does using several help commands in Linux.<\/p>\n<p>So the first and most straightforward way to get help is using the \u201c&#8211;help\u201d option along with the command.<\/p>\n<p>Usage<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$command-name\">user@system-name:~$command-name<\/a> &#8211;help<\/p><\/blockquote>\n<p>Say you need to find out what options are available for the \u201cls\u201d command.<\/p>\n<p>You would have to type the following in the Terminal.<\/p>\n<p>Example:<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$\">user@system-name:~$<\/a> ls &#8211;help<\/p><\/blockquote>\n<p>You then get a list of all the options that can be used with the \u201cls\u201d commnd like \u201c\u2013a\u201d , \u201c\u2013l\u201d etc along with a line explaining what each of the options are used for.<\/p>\n<p>Please note that there are two hyphens(&#8211;) before the \u201chelp\u201d option.<\/p>\n<p>I strongly recommend trying out these commands in the Terminal if you are a newbie and planning to learn using the shell commands.<\/p>\n<p>Next we have the \u201cman\u201d command. This command is used as an interface to access the reference manual of the required command. So it is a very detailed and comprehensive description of everything that the command can do.<\/p>\n<p>Once the manual of a required command is opened using the \u201cman\u201d command, the manual spans several pages usually. So to traverse through the pages use the \u201cPage Up\u201d and \u201cPage Down\u201d keys or the \u201cUp\u201d and \u201cDown\u201d arrow keys.<\/p>\n<p>To quit the manual and come back to the shell prompt hit the \u201cQ\u201d key on the keyboard.<\/p>\n<p>Usage<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$man\">user@system-name:~$man<\/a> command-name<\/p><\/blockquote>\n<p>For example to know about the \u201cls\u201d command<\/p>\n<p>Example<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$man\">user@system-name:~$man<\/a> ls<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>We then have the \u201cinfo\u201d command which is very similar to the \u201cman\u201d command. The \u201cinfo\u201d command is supposed to contain more information than the manual pages which one gets by using the \u201cman\u201d command . However when there is no specific \u201cinformation\u201d page written for a command the manual page is displayed instead. So right now there will not be much difference between using the \u201cman\u201d and \u201cinfo\u201d commands other than for those commands for which there are separate information pages.<\/p>\n<p>Usage<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$ info\">user@system-name:~$ info<\/a> command-name<\/p><\/blockquote>\n<p>Example<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$ info\">user@system-name:~$ info<\/a> ls<\/p><\/blockquote>\n<p>Now that we have gone through two commands which give a very detailed and comprehensive information about a required command lets look at a short and sweet command, namely the \u201cwhatis\u201d command.<\/p>\n<p>Short and sweet because it does what it says. It gives a one line description of what a command does<\/p>\n<p>Usage<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$ whatis\">user@system-name:~$ whatis<\/a> command-name<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>Example<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$ whatis\">user@system-name:~$ whatis<\/a> ls<\/p><\/blockquote>\n<p>The output for the above command would be,<\/p>\n<blockquote><p>ls (1)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211; list directory contents<\/p><\/blockquote>\n<p>The above four commands helped you know what a certain command could do.<\/p>\n<p>Now lets look at two commands which help us locate where the binary(the executable file) for a command is located.<\/p>\n<p>The first command is the \u201cwhich\u201d command.<\/p>\n<p>Usage<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$ which\">user@system-name:~$ which<\/a> command-name<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>Say you would like to know where the binary (executable file) for the command \u201ccp\u201d is located<\/p>\n<p>Example<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$ which\">user@system-name:~$ which<\/a> cp<\/p><\/blockquote>\n<p>The result of the above statement would simply be,<\/p>\n<blockquote><p>\/bin\/cp<\/p><\/blockquote>\n<p>The next command does a little bit more than the \u201cwhich\u201d command<\/p>\n<p>It is the \u201cwhereis\u201d command. In addition to the binary of the command it also locates the source code and the man page of the command.<\/p>\n<p>Usage<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$which\">user@system-name:~$<\/a> whereis command-name<\/p><\/blockquote>\n<p>Example<\/p>\n<blockquote><p><a href=\"mailto:user@system-name:~$which\">user@system-name:~$<\/a> whereis ls<\/p><\/blockquote>\n<p>The output would then be<\/p>\n<blockquote><p>cp: \/bin\/cp \/usr\/share\/man\/man1\/cp.1.gz<\/p><\/blockquote>\n<p>Here we see that there are only two locations namely the binary location and the location of the man page.<\/p>\n<p>The location of the source is not shown since the source files have not been installed.<\/p>\n<p>&nbsp;<\/p>\n<p>So these are the various help commands that can be used in the linux shell.<\/p>\n<p>&nbsp;<\/p>\n<p>Hope it was a good learning experience.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I\u2019ll be talking about getting help for  [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[11],"tags":[7,4,6,16,5],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-linux-2","tag-help","tag-linux","tag-shell","tag-shell-commands","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/comments?post=103"}],"version-history":[{"count":7,"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":174,"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/posts\/103\/revisions\/174"}],"wp:attachment":[{"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/media?parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/categories?post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/satyadeep.in\/blog\/wp-json\/wp\/v2\/tags?post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}