How shells call other programs
Submitted by srlinuxx on Mon, 02/13/2006 - 08:02
An article about How Linux or UNIX Understand which program to run got picked up by a few dozen RSS feeds recently. It's not a bad article.
It's actually slightly incorrect though.
The implication is that the shell reads the command and decides what to do. It's actually the kernel that makes a lot of the decisions.
For example, when you type "date", the shell looks through its PATH, finds /bin/date, but then immediately execs it: the kernel loads and runs "date".
You can see that if you run bash with strace and then give it various commands. When you type "date", for example, the shell goes looking in its PATH:

Recent comments
7 hours 1 min ago
1 day 11 hours ago
4 days 4 hours ago
4 days 7 hours ago
5 days 3 hours ago