Yes, it maybe true that a dog is man's best friend, but if you ask a programmer, he will tell you that his best friend is indeed man.
Man? Am I saying that a programmer's best friend is another man, as in another programmer? No, what I am talking about is this nice little utility that comes with most linux distributions ( a good reason for you to switch to it if you're a programmer, not using linux), called "man".
"man" is command-line tool that can be used to access documentation for a wide range of topics, from the linux kernel to programming language reference manuals like the "user-contributed perl documentation" etc.
By now, I assume that you have guessed that our good friend, "man" is actually short for "manual". So it naturally follows that each of the pages accessible from "man", are called "man pages".
So this is what wikipedia has to say about "man pages":
A man page (short for manual page) is a form of online software documentation usually found on a Unix orUnix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts. A user may invoke a man page by issuing the man command.
Now, what is a man command, and how do we command this "man" to show us documentation?
Well the syntax so to speak, for looking for a "man page" using man, is as simple as typing:
Well the syntax so to speak, for looking for a "man page" using man, is as simple as typing:
user@linux:~$ man foo
at your terminal and hitting return, and "man" will run through all its "man pages" and find you the entry for in this case "foo", if it exists. And if it couldn't find it, our "man" will reply with the message:
No manual entry for foo
Nice! So how does a "man page" look like if we actually ask "man" for something more sensible? Say printf?
That was the man page entry for printf using man (version 2.6.3)
Great, we now have a tool that helps us find information about printf! Yes, it has documentation for printf, but theres a whole lot more! You can find information about header files in c, or some function in say perl(if the perl-documentation is installed in your system), or you can even find information about man itself!
As a side note, if you have a linux computer, try using man to find the man page for something like stdarg.h (which will reveal the secrets behind printf), or something as simple as time. To do this, all you need to type is man stdarg.h or man time, and you will get some interesting results!
So the next time your coding on linux, and reading some code or maybe writing some, and your not quite sure what a function does, or don't remember its syntax, remember this: "man is your best friend!" and magically you will have all the answers!
Cheers!
Just a small correction, `man stdarg.h` does NOT work. `man stdard` does
ReplyDeleteI was diagnosed as HEPATITIS B carrier in 2013 with fibrosis of the
ReplyDeleteliver already present. I started on antiviral medications which
reduced the viral load initially. After a couple of years the virus
became resistant. I started on HEPATITIS B Herbal treatment from
ULTIMATE LIFE CLINIC (www.ultimatelifeclinic.com) in March, 2020. Their
treatment totally reversed the virus. I did another blood test after
the 6 months long treatment and tested negative to the virus. Amazing
treatment! This treatment is a breakthrough for all HBV carriers.