Hi all,
Iam new to unix. I want to know the series of events that takes place when creating a directory.
I mean
If I type a command like
mkdir mydir
what is the exact thing that takes place within the *nix operating system?
Hi all,
Iam new to unix. I want to know the series of events that takes place when creating a directory.
I mean
If I type a command like
mkdir mydir
what is the exact thing that takes place within the *nix operating system?
The "*nix operating system"s for the most part are open source so you can take a look at the code. You can also use strace
sk@sk:~$ strace -s 5000 mkdir abc123456
execve("/bin/mkdir", ["mkdir", "abc123456"], [/* 22 vars */]) = 0
uname({sys="Linux", node="sk", ...}) = 0
brk(0) = 0x804e3e8
access("/etc/ld.so.nohwcap", F_OK) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=54652, ...}) = 0
mmap2(NULL, 54652, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = 0
open("/lib/libselinux.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P8\0\0004\0\0\0p2\1\0\0\0\0\0004\0 \0\5\0(\0\27\0\26\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\260&\1\0\260&\1\0\5\0\0\0\0\20\0\0\1\0\0\0\334.\1\0\334>\1\0\334>\1\0\354\2\0\0\270\f\0\0\6\0\0\0\0\20\0\0\2\0\0\0\0/\1\0\0?\1\0\0?\1\0\330\0\0\0\330\0\0\0\6\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0R\345td\334.\1\0\334>\1\0\334>\1\0\30\1\0\0\30\1\0\0\4\0\0\0\4\0\0\0\7\1\0\0\25\1\0\0\0\0\0\0\262\0\0\0\332\0\0\0Q\0\0\0\0\0\0\0A\0\0\0\1\1\0\0\6\1\0\0\202\0\0\0\243\0\0\0\17\0\0\0>\0\0\0\n\1\0\0r\0\0\0\0\0\0\0\351\0\0\0\0\0\0\0\0\0\0\0K\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\230\0\0\0\0\0\0\0\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\215\0\0\0]\0\0\0{\0\0\0\207\0\0\0\330\0\0\0\354\0\0\0\0\0\0\0\v\1\0\0\211\0\0\0\350\0\0\0U\0\0\0\r\1\0\0\373\0\0\0\0\0\0\0\364\0\0\0$\0\0\0\347\0\0\0\324\0\0\0m\0\0\0\0\0\0\0_\0\0\0x\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\'\0\0\0H\0\0\0\0\0\0\0\24\1\0\0y\0\0\0\377\0\0\0\311\0\0\0\24\0\0\0p\0\0\0Z\0\0\0T\0\0\0\7\1\0\0\0\0\0\0\f\1\0\0\22\1\0\0\335\0\0\0\0\0\0\0", 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=79368, ...}) = 0
mmap2(NULL, 84884, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40026000
mmap2(0x40039000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12) = 0x40039000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220T\1\0004\0\0\0\214y\21\0\0\0\0\0004\0 \0\t\0(\0:\0009\0\6\0\0\0004\0\0\0004\0\0\0004\0\0\0 \1\0\0 \1\0\0\5\0\0\0\4\0\0\0\3\0\0\0\240\364\20\0\240\364\20\0\240\364\20\0\23\0\0\0\23\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\2\21\0\10\2\21\0\5\0\0\0\0\20\0\0\1\0\0\0\f\f\21\0\f\34\21\0\f\34\21\0\0c\0\0(\215\0\0\6\0\0\0\0\20\0\0\2\0\0\0<]\21\0<m\21\0<m\21\0\340\0\0\0\340\0\0\0\6\0\0\0\4\0\0\0\4\0\0\0T\1\0\0T\1\0\0T\1\0\0 \0\0\0 \0\0\0\4\0\0\0\4\0\0\0P\345td\264\364\20\0\264\364\20\0\264\364\20\0T\r\0\0T\r\0\0\4\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0R\345td\f\f\21\0\f\34\21\0\f\34\21\0\0R\0\0\0R\0\0\4\0\0\0 \0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\4\0\0\0\1\0\0\0\377\3\0\0\204\10\0\0\4\1\0\0\235\6\0\0Y\2\0\0\320\0\0\0\6\7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\213\6\0\0\353\5\0\0\0\0\0\0<\10\0\0\225\6\0\0\25\2\0\0\257\2\0\0Q\10\0\0.\4\0\0F\10\0\0\0\0\0\0\314\6\0\0\203\2\0\0\21\10\0\0007\6\0\0\326\4\0\0\342\7\0\0\251\7\0\0\0\0\0\0f\5\0\0\316\5\0\0J\10\0\0W\7\0\0\0\0\0\0", 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1147548, ...}) = 0
mmap2(NULL, 1157428, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4003b000
mmap2(0x4014c000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x110) = 0x4014c000
mmap2(0x40153000, 10548, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40153000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = 0
open("/lib/libdl.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\f\0\0004\0\0\0@!\0\0\0\0\0\0004\0 \0\10\0(\0\33\0\32\0\6\0\0\0004\0\0\0004\0\0\0004\0\0\0\0\1\0\0\0\1\0\0\5\0\0\0\4\0\0\0\3\0\0\0\236\31\0\0\236\31\0\0\236\31\0\0\23\0\0\0\23\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270\31\0\0\270\31\0\0\5\0\0\0\0\20\0\0\1\0\0\0\324\36\0\0\324.\0\0\324.\0\0|\1\0\0\240\1\0\0\6\0\0\0\0\20\0\0\2\0\0\0\354\36\0\0\354.\0\0\354.\0\0\340\0\0\0\340\0\0\0\6\0\0\0\4\0\0\0\4\0\0\0004\1\0\0004\1\0\0004\1\0\0 \0\0\0 \0\0\0\4\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0R\345td\324\36\0\0\324.\0\0\324.\0\0 \1\0\0 \1\0\0\4\0\0\0\4\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\4\0\0\0\1\0\0\0A\0\0\0002\0\0\0\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0\0\r\0\0\0\22\0\0\0\33\0\0\0/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0\0\21\0\0\0\31\0\0\0\17\0\0\0#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0.\0\0\0\0\0\0\0\16\0\0\0\24\0\0\0\0\0\0\0)\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0001\0\0\0\0\0\0\0\0\0\0\0\f\0\0\0", 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=9592, ...}) = 0
mmap2(NULL, 12404, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40156000
mmap2(0x40158000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0x40158000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = 0
open("/lib/libsepol.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0200\0\0004\0\0\0\360V\3\0\0\0\0\0004\0 \0\4\0(\0\30\0\27\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\224R\3\0\224R\3\0\5\0\0\0\0\20\0\0\1\0\0\0\224R\3\0\224b\3\0\224b\3\0\244\3\0\0,\251\0\0\6\0\0\0\0\20\0\0\2\0\0\0\240S\3\0\240c\3\0\240c\3\0\310\0\0\0\310\0\0\0\6\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0\305\0\0\0\355\0\0\0\215\0\0\0\255\0\0\0\247\0\0\0\236\0\0\0\256\0\0\0\250\0\0\0F\0\0\0\272\0\0\0\0\0\0\0\0\0\0\0\230\0\0\0\0\0\0\0002\0\0\0L\0\0\0000\0\0\0u\0\0\0n\0\0\0\27\0\0\0\'\0\0\0\233\0\0\0\334\0\0\0\0\0\0\0N\0\0\0\0\0\0\0r\0\0\0\0\0\0\0\267\0\0\0\204\0\0\0i\0\0\0\252\0\0\0\0\0\0\0T\0\0\0\0\0\0\0007\0\0\0\347\0\0\0\231\0\0\0\245\0\0\0\240\0\0\0\0\0\0\0\311\0\0\0\330\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Q\0\0\0\353\0\0\0\276\0\0\0\211\0\0\0009\0\0\0\354\0\0\0\225\0\0\0\0\0\0\0\302\0\0\0\0\0\0\0\271\0\0\0\261\0\0\0\203\0\0\0\0\0\0\0\345\0\0\0\0\0\0\0\314\0\0\0\333\0\0\0\343\0\0\0\0\0\0\0\0\0\0\0\300\0\0\0\0\0\0\0\350\0\0\0\210\0\0\0\0\0\0\0\254\0\0\0\305\0\0\0\257\0\0\0\266\0\0\0\346\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0v\0\0\0", 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=219824, ...}) = 0
mmap2(NULL, 265152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4015a000
mmap2(0x40190000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x35) = 0x40190000
mmap2(0x40191000, 39872, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40191000
close(3) = 0
mprotect(0x4014c000, 20480, PROT_READ) = 0
munmap(0x40018000, 54652) = 0
access("/etc/selinux/", F_OK) = -1 ENOENT (No such file or directory)
brk(0) = 0x804e3e8
brk(0x806f3e8) = 0x806f3e8
brk(0x8070000) = 0x8070000
open("/proc/mounts", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
read(3, "rootfs / rootfs rw 0 0\n/dev/root / ext2 rw 0 0\ntmpfs /lib/init/rw tmpfs rw,nosuid 0 0\nproc /proc proc rw,nosuid,nodev,noexec 0 0\ntmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0\ndevpts /dev/pts devpts rw,nosuid,noexec 0 0\n/dev/hda2 /tmp ext2 rw,nosuid 0 0\n/dev/hda3 /home ext2 rw,nosuid 0 0\n", 4096) = 283
read(3, "", 4096) = 0
brk(0x806f000) = 0x806f000
close(3) = 0
munmap(0x40018000, 4096) = 0
mkdir("abc123456", 0777) = 0
close(1) = 0
exit_group(0) = ?
Process 24617 detached
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.