Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. $ which uname
  2. /bin/uname
  3.  
  4. $ type -a uname
  5. uname is /bin/uname
  6.  
  7. $ locate uname
  8. /bin/uname
  9. (... SNIP dozens of Windows files on C & D ...)
  10. /usr/lib/klibc/bin/uname
  11. /usr/lib/plainbox-provider-resource-generic/bin/uname_resource
  12. /usr/share/man/man1/uname.1.gz
  13. /usr/share/man/man2/oldolduname.2.gz
  14. /usr/share/man/man2/olduname.2.gz
  15. /usr/share/man/man2/uname.2.gz
  16.  
  17. $ strace uname -n
  18. execve("/bin/uname", ["uname", "-n"], [/* 62 vars */]) = 0
  19. brk(NULL) = 0x2356000
  20. access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
  21. access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
  22. open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
  23. fstat(3, {st_mode=S_IFREG|0644, st_size=109073, ...}) = 0
  24. mmap(NULL, 109073, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff2f9a9f000
  25. close(3) = 0
  26. access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
  27. open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
  28. read(3, "177ELF21133>1Pt2"..., 832) = 832
  29. fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
  30. mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff2f9a9e000
  31. mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff2f94cb000
  32. mprotect(0x7ff2f968b000, 2097152, PROT_NONE) = 0
  33. mmap(0x7ff2f988b000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7ff2f988b000
  34. mmap(0x7ff2f9891000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ff2f9891000
  35. close(3) = 0
  36. mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff2f9a9d000
  37. mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff2f9a9c000
  38. arch_prctl(ARCH_SET_FS, 0x7ff2f9a9d700) = 0
  39. mprotect(0x7ff2f988b000, 16384, PROT_READ) = 0
  40. mprotect(0x606000, 4096, PROT_READ) = 0
  41. mprotect(0x7ff2f9aba000, 4096, PROT_READ) = 0
  42. munmap(0x7ff2f9a9f000, 109073) = 0
  43. brk(NULL) = 0x2356000
  44. brk(0x2377000) = 0x2377000
  45. open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
  46. fstat(3, {st_mode=S_IFREG|0644, st_size=10219008, ...}) = 0
  47. mmap(NULL, 10219008, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff2f8b0c000
  48. close(3) = 0
  49. uname({sysname="Linux", nodename="alien", ...}) = 0
  50. fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
  51. write(1, "alienn", 6alien
  52. ) = 6
  53. close(1) = 0
  54. close(2) = 0
  55. exit_group(0) = ?
  56. +++ exited with 0 +++
  57.  
  58. STRACE(1) General Commands Manual STRACE(1)
  59.  
  60. NAME
  61. strace - trace system calls and signals
  62.  
  63. SYNOPSIS
  64. strace [-CdffhikqrtttTvVxxy] [-In] [-bexecve] [-eexpr]... [-acolumn] [-ofile] [-sstr‐
  65. size] [-Ppath]... -ppid... / [-D] [-Evar[=val]]... [-uusername] command [args]
  66.  
  67. strace -c[df] [-In] [-bexecve] [-eexpr]... [-Ooverhead] [-Ssortby] -ppid... / [-D]
  68. [-Evar[=val]]... [-uusername] command [args]
  69.  
  70. DESCRIPTION
  71. In the simplest case strace runs the specified command until it exits. It intercepts
  72. and records the system calls which are called by a process and the signals which are
  73. received by a process. The name of each system call, its arguments and its return value
  74. are printed on standard error or to the file specified with the -o option.
  75.  
  76. strace is a useful diagnostic, instructional, and debugging tool. System administra‐
  77. tors, diagnosticians and trouble-shooters will find it invaluable for solving problems
  78. with programs for which the source is not readily available since they do not need to be
  79. recompiled in order to trace them. Students, hackers and the overly-curious will find
  80. that a great deal can be learned about a system and its system calls by tracing even
  81. ordinary programs. And programmers will find that since system calls and signals are
  82. events that happen at the user/kernel interface, a close examination of this boundary is
  83. very useful for bug isolation, sanity checking and attempting to capture race condi‐
  84. tions.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement