Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of fork() and grep in Linux?

Tags:

linux

grep

fork

api

As a non-native English speaker, I have difficulty remembering Linux commands compared to other APIs. In Linux, the function names don't seem to indicate their purpose.

Why is the name fork() chosen to create a child process? In the dictionary, fork means "a utensil with two or more prongs", which is unrelated to creating a new process.

Why is the name grep chosen to "print lines matching a pattern"? Does grep mean "g report"?

Where can I find the etymology behind other commands in the Linux API?

like image 226
Wallace Avatar asked Oct 25 '12 08:10

Wallace


People also ask

What does fork () do in Linux?

fork() creates a new process by duplicating the calling process. The new process is referred to as the child process. The calling process is referred to as the parent process. The child process and the parent process run in separate memory spaces.

What happens when fork () is called?

System call fork() is used to create processes. It takes no arguments and returns a process ID. The purpose of fork() is to create a new process, which becomes the child process of the caller. After a new child process is created, both processes will execute the next instruction following the fork() system call.

Why do we need fork ()?

In the computing field, fork() is the primary method of process creation on Unix-like operating systems. This function creates a new copy called the child out of the original process, that is called the parent.

What is the difference between creating process using fork () on Linux and CreateProcess () on Windows?

fork() by default creates a child process with same file descriptors while CreateProcess() does not. CreateProcess() by default creates a child process with same file descriptors while fork() does not. fork() duplicates the program for different process. CreateProcess() creates different process with new program.


2 Answers

Fork can mean to split in two, as a road (source).

Fork (15): to divide into branches.

Grep's etymology:

From an idiomatic command sequence in the qed and ed text editors: ‘g/re/p’, meaning: globally search for a regular expression and print.

This answer lists the etymology of some Linux commands.

like image 172
Andy Avatar answered Sep 27 '22 21:09

Andy


www.lockergnome.com/uncategorized/2006/08/21/linux-forks

Linux forks, a term often applied to the varieties of Linux distributions, are poorly understood even in the Linux community. Are all the various distributions available on the internet true forks of the kernal? Kevin Morgan argues that they are not. Is his Enterprise OpenSource Magazine (formerly LinuxWorld Magazine) article “Linux Technology Leadership and the Forking Issue”, he explores the concept of forking in detail, explains the advantages of having unique variants for distinct applications and explains why variants are not forks.

like image 28
tux23 Avatar answered Sep 27 '22 21:09

tux23