On Thursday 03 January 2008 07:13, Kalvin Weng wrote:
> You can use the command unlink .....I think.

No. That's something different. The "unlink" command provides direct access to 
the unlink() system call. It is what the "rm" and "rmdir" commands ultimately 
call, but with some safeguards on the way. The "unlink" command is not 
intended for general use; use "rm" or "rmdir" instead.

Both the "unlink" command and the unlink() system call deal with hard 
links(!). They don't know anything about symlinks. To the system, each file 
or directory is identified with an "i-node" which has an "i-number". File 
names and directory paths are just there for us mere mortals who have a hard 
time remembering 32 bit i-numbers to identify a file or directory. ;-)

http://en.wikipedia.org/wiki/Inode
http://en.wikipedia.org/wiki/Hard_link
http://en.wikipedia.org/wiki/Symbolic_link



From "info unlink":

"12.8 `unlink': Remove files via the unlink syscall
==================================================

`unlink' deletes a single specified file name.  It is a minimalist
interface to the system-provided `unlink' function.  *Note Deleting
Files: (libc)Deleting Files.  Synopsis: It avoids the bells and
whistles of the more commonly-used `rm' command (*note rm invocation::).

     unlink FILENAME

   On some systems `unlink' can be used to delete the name of a
directory.  On others, it can be used that way only by a privileged
user.  In the GNU system `unlink' can never delete the name of a
directory.
..."


From "man 2 unlink":

"NAME
       unlink - delete a name and possibly the file it refers to

SYNOPSIS
       #include <unistd.h>

       int unlink(const char *pathname);

DESCRIPTION
       unlink()  deletes a name from the filesystem. If that name was the last
       link to a file and no processes have the file open the file is  deleted
       and the space it was using is made available for reuse.

       If  the  name  was the last link to a file but any processes still have
       the file open the file will remain in existence  until  the  last  file
       descriptor referring to it is closed.

       If the name referred to a symbolic link the link is removed.

       If  the  name  referred  to a socket, fifo or device the name for it is
       removed but processes which have the object open may  continue  to  use
       it.
..."




-- 
Stefan Hundhammer <[EMAIL PROTECTED]>                Penguin by conviction.
YaST2 Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Nürnberg, Germany
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to