Logo 
Search:

Unix / Linux / Ubuntu FAQ

Submit Interview FAQ
Home » Interview FAQ » Unix / Linux / UbuntuRSS Feeds

What Happens when you execute a command?

  Shared By: Adah Miller    Date: Jan 25    Category: Unix / Linux / Ubuntu    Views: 330

Answer:

When you enter 'ls' command to look at the contents of your current working directory, UNIX does a series of things to create an environment for ls and the run it: The shell has UNIX perform a fork. This creates a new process that the shell will use to run the ls program. The shell has UNIX perform an exec of the ls program. This replaces the shell program and data with the program and data for ls and then starts running that new program. The ls program is loaded into the new process context, replacing the text and data of the shell. The ls program performs its task, listing the contents of the current directory.

Share: 
 

Didn't find what you were looking for? Find more on What Happens when you execute a command? Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: