views:

320

answers:

2

I can't understand the operation of the "readlink" systemcall in Linux.

Can anyone explain about it with simple example on it?

+6  A: 

If you have a symbolic link, e.g.

$ ls -l /vmlinuz
lrwxrwxrwx 1 root root 30 2009-08-03 08:59 /vmlinuz -> boot/vmlinuz-2.6.28-15-generic

then readlink syscall will get you the symlink target (boot/vmlinuz-2.6.28-15-generic), just like readlink command:

$ readlink /vmlinuz
boot/vmlinuz-2.6.28-15-generic
Michael Krelin - hacker
+2  A: 

Also, take a look at man 2 readlink, which contains a concise description of it's purpose and usage.

--Jesse Taylor

jrtayloriv