0

I'm new in Ubuntu and I have this question about strace ls command. When I'm run this command it gives all the system calls. What if I need to know the system calls for a specific command, for example if I run the command mkdir? I want to know what are the system calls for this particular command.

Its helps me a lot in my studies. Thank a lot.

2
  • I didn't get this. strace ls does give you the system calls for ls, so what exactly do you intend to know?
    – jobin
    Feb 27, 2014 at 6:27
  • its gives me the whole system calls
    – OS teacher
    Feb 27, 2014 at 8:52

2 Answers 2

3

Shortly:

strace command [arguments]

For example:

strace mkdir test

For more info, see man strace.

0
1

Just like you do strace ls, you should do strace mkdir which will give you list of all calls made by mkdir like as sample below from my PC:

execve("/bin/mkdir", ["mkdir"], [/* 37 vars */]) = 0
brk(0)                                  = 0x83da000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7736000
........
.......

Hope this will solve your problem, but if you want to know about each syscall made then read its man pages or specifically ask about a syscall.

2
  • Its works fine for me but I used "strace -c kdir test " to organize the output.
    – OS teacher
    Feb 27, 2014 at 18:33
  • great your problem has been solved. you ultimate destination will Intel Pin binary instrumentation if you have long term planning to work in kernel level Feb 28, 2014 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.