Re: [opensuse] deleting soft links
- From: Stefan Hundhammer <sh@xxxxxxx>
- Date: Thu, 3 Jan 2008 12:18:36 +0100
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 <sh@xxxxxxx> Penguin by conviction.
YaST2 Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Nürnberg, Germany
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
- References:
- Re: [opensuse] deleting soft links
- From: Kalvin Weng
- Re: [opensuse] deleting soft links
- Prev by Date: [opensuse] Bug - PHP-5.2.5 + fcgi
- Next by Date: Re: [opensuse] Problems withMP3 codecs and banshee on Opensuse 10.3
- Previous by thread: Re: [opensuse] deleting soft links
- Next by thread: [opensuse] insmod a TV card
- Index(es):
Relevant Pages
|