how file utility programs work with symblic links

  • Follow


In general, for all shells,

rm works on a symbolic link itself
cp, mv, rmdir, etc. work as if the symbolic link is the thing it is
pointing too (dereferenced)

This is without using any options to these functions.

0
Reply lite.on.beta (15) 3/25/2012 1:32:57 AM

In article <0f9803d2-1917-4d97-af3b-e858e6862862@d17g2000vba.googlegroups.com>,
 Beta What <lite.on.beta@gmail.com> wrote:

> In general, for all shells,
> 
> rm works on a symbolic link itself
> cp, mv, rmdir, etc. work as if the symbolic link is the thing it is
> pointing too (dereferenced)
> 
> This is without using any options to these functions.

On Macs 'man 7 system' discusses this. I don't know if the same manpage is on 
Linux.


https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/
man7/symlink.7.html

-- 
My name Indigo Montoya.      |    R'lyeh 38o57'6.5''S 102o51'16''E.
You flamed my father.        |       I'm whoever you want me to be.
Prepare to be spanked.       |  Annoying Usenet one post at a time.
Stop posting that!           |    At least I can stay in character.
0
Reply chine.bleu (655) 3/25/2012 1:45:07 AM


Woah.  Best reference ever!

I tried reading so many online tutorials on this, but they should all
be replaced to a link to this.
0
Reply lite.on.beta (15) 3/25/2012 3:25:20 AM

On 2012-03-25, Beta What <lite.on.beta@gmail.com> wrote:
> In general, for all shells,
>
> rm works on a symbolic link itself
> cp, mv, rmdir, etc. work as if the symbolic link is the thing it is
> pointing too (dereferenced)
>
> This is without using any options to these functions.

Are you sure about mv?
0
Reply ike7 (162) 3/25/2012 7:24:16 AM

On Sunday 25 March 2012 09:24, Ike Naar conveyed the following to 
comp.unix.questions...

> On 2012-03-25, Beta What <lite.on.beta@gmail.com> wrote:
>> In general, for all shells,
>>
>> rm works on a symbolic link itself
>> cp, mv, rmdir, etc. work as if the symbolic link is the thing it is
>> pointing too (dereferenced)
>>
>> This is without using any options to these functions.
> 
> Are you sure about mv?

mv works on the symlink, not on what the symlink points at.

-- 
= Aragorn =
(registered GNU/Linux user #223157)
0
Reply stryder2 (284) 3/25/2012 7:30:50 AM

On 25-03-2012 03:45, China Blue Water Navy wrote:
> In article <0f9803d2-1917-4d97-af3b-e858e6862862@d17g2000vba.googlegroups.com>,
>  Beta What <lite.on.beta@gmail.com> wrote:
> 
>> In general, for all shells,
>>
>> rm works on a symbolic link itself
>> cp, mv, rmdir, etc. work as if the symbolic link is the thing it is
>> pointing too (dereferenced)
>>
>> This is without using any options to these functions.
> 
> On Macs 'man 7 system' discusses this. I don't know if the same manpage is on 
> Linux.
> 
> 
> https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/
> man7/symlink.7.html
> 

for linux the link is:
http://www.kernel.org/doc/man-pages/online/pages/man7/symlink.7.html
0
Reply luuk (814) 3/25/2012 12:45:45 PM

On Sat, 24 Mar 2012 18:32:57 -0700, Beta What wrote:

> In general, for all shells,

This has nothing to do with shells.

> rm works on a symbolic link itself
> cp, mv, rmdir, etc. work as if the symbolic link is the thing it is
> pointing too (dereferenced)

You got one out of three right. mv and rmdir behave like rm, i.e. mv will
rename the symlink, rmdir will complain that the symlink isn't a directory.

> This is without using any options to these functions.

In general: operations on directory entries (mv, rm, rmdir) treat a
symlink as a symlink. Operations on the contents of files (or directories)
(cp, cat) treat a symlink as the object it points to.

0
Reply nobody (4805) 3/26/2012 1:27:30 AM

6 Replies
84 Views

(page loaded in 0.107 seconds)

Similiar Articles:













7/27/2012 10:18:36 PM


Reply: