Results 1 to 5 of 5
Hello All,
I am doing some basic stuffs on the terminal can any one tell me that How exactly the ls command works ?
Q1 : The exact question is ...
- 09-22-2009 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 45
What happens in background?
Hello All,
I am doing some basic stuffs on the terminal can any one tell me that How exactly the ls command works ?
Q1 : The exact question is what happens in the background when we type a command ls or some other commands on the terminal ?
Thnaks,
Packet
- 09-22-2009 #2
Assuming ls is neither a builtin or a declared function in the shell:
- The shell looks if it can find an executable called "ls" in the directories which are in the PATH variable.
- Shell tells the kernel to load this executable into memory and to execute it, passing it the options you typed after "ls". For example "-a".
What ls exactly does you find out by typing "man ls" and by looking at the programs source code. "ls" is part of the GNU coreutils Index of /pub/gnu/coreutilsDebian GNU/Linux -- You know you want it.
- 09-22-2009 #3
In case if you looking from programming point of view,use strace ls, it will show you list of system call executed to produce the desired result.
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 09-22-2009 #4Just Joined!
- Join Date
- Mar 2008
- Location
- Chennai, India
- Posts
- 26
when you type a command in the shell, let us say "ls" in this case, shell "forks" a child process which "exec"s "ls". This is how shell works.
Hope this was helpful.
Sarma
- 09-23-2009 #5Just Joined!
- Join Date
- Feb 2008
- Posts
- 45
Thanks lot for everyone


Reply With Quote