03 November 2015

In a previous blog I mentioned that we really want to make good use of Internet search engines, especially google. In this blog, I want to point out that the online help systems (man and info) are also very useful. In fact, in many cases they are more convenient and more accurate. Being able to use them is crucial to boost one's productivity.

Manual is easier to access and more focused

The other day, a colleague asked me why file test.txt exists and [ -e test* ] returns true but [[ -e test* ]] return false (btw. neither is correct in terms of good shell coding). I did know the reason either. However, I figured out the answer within one minute by checking out the manual (info bash and then search [[). The manual clearly stated that "Word splitting and filename expansion are not performed on the words between …".

There is no need to search and screen results. And, it is also feasible even when you have no Internet access. What is more, the manual describes exactly the version you are using.

"info" provides much more info than "man"

It is also worth noting that we are usually better off using info because it usually provides a full documentation of designated topic. For instance, one colleague copied a sed code snippet which uses \+ from internet but that code seemed does not work. He "man-ed" and determined that sed does not support regexp \+ and turned to me for help. Once again, I instantly found the answer in info. In the "Regular Expressions" section of info of sed, it confirms that \+ is supported as a GNU extension. In contrast, searching \+ in the man page of sed gets no result.

Learn a little bit "info"

info is handy and useful only if you know how to use it. Fortunately, it is very easy to learn: either man info or info info. However, be warned that you cannot get started without skimming through the manual. And, especially good for Emacs users, Emacs has a very good interface to info documents, C-h i in Emacs brings you to it.

blog comments powered by Disqus