How does 'ls' command work when it has multiple arguments?
<p><a href="https://stackoverflow.com/questions/204202/how-does-the-ls-command-work-in-linux-unix">How does the &#39;ls&#39; command work in Linux/Unix?</a></p>

<p>So that's some reference.</p>

<p>But I was wondering how a command such as </p>

<pre><code>ls -1 | grep 'myfile'
</code></pre>

<p>would be executed by the shell, i.e. when is exec called, when is fork called, when id dup called(if at all).</p>

<p>Also, how is this entire command parsed?</p>