Question: In many programs and man pages of Linux, I have seen code using `fork()`. Why do we need to use `fork()` and what is its purpose?

Answer: 
fork() will create a new child process identical to the parent. So everything you run in the code after that will be run by both processes — very useful if you have for instance a server, and you want to handle multiple requests.
You probably don't need to use fork in day-to-day programming if you are writing applications.

Even if you do want your program to start another program to do some task, there are other simpler interfaces which use fork behind the scenes, such as "system" in C and perl.

For example, if you wanted your application to launch another program such as bc to do some calculation for you, you might use 'system' to run it. System does a 'fork' to create a new process, then an 'exec' to turn that process into bc. Once bc completes, system returns control to your program.

You can also run other programs asynchronously, but I can't remember how.

If you are writing servers, shells, viruses or operating systems, you are more likely to want to use fork.