Example of Linux Process Creation


In this example, we use the ls command to list a file. Because the ls program is the child of its local shell, we need to trace the shell from which the ll (ls -al alias) command is executed. Two shell windows are required to perform this test.

  1. Window one: Determine the pseudo terminal and PID of shell by tying in echo $$. In my case it was 12310

    2007-12-19-215244_1280x800_scrot

  2. Window two: Start trace of shell process with this command: strace -o /tmp/ll.strace -f -p 12310 just make sure you use your own PID here.

    2007-12-19-215309_1280x800_scrot

  3. Go back to window one and type in 11 or any commands for that matter. You can look at the strace output on window two. The trace shows the fork() and execve() calls.

    2007-12-19-215404_1280x800_scrot

 

 



Subscribe without commenting


Leave a Reply

Note: Any comments are permitted only because the site owner is letting you post, and any comments will be removed for any reason at the absolute discretion of the site owner.