Casey Bralla on 14 Dec 2016 12:04:45 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Symlink Problem


On Wednesday, December 14, 2016 03:00:43 PM Thomas Delrue wrote:
> On 12/14/2016 02:52 PM, Casey Bralla wrote:
> > I executed: "ln -s "/files/document /docs" to create the symlink.
> > But when I do a listing of "/docs", I get this:
> > 
> > #ls -lap /docs total 8 drwxr-xr-x  2 root root 4096 Dec 14 14:44 ./
> > drwxr-xr-x 29 root root 4096 Dec 14 14:43 ../ lrwxrwxrwx  1 root root
> > 15 Dec 14 14:44 document -> /files/document
> > 
> > If I list the "/docs/document" directory, I get all my documents
> > listed as I expected.
> > 
> > Can somebody explain to me what I'm doing wrong?   It all seems so
> > simple, but I'm screwing it up somehow.
> 
> yes, everything is working as expected.
> when you do (I use -hal but your -lap works similarly):
> 
> $> ls -hal /docs
> What you are asking is: shows me the info for the entry "/docs".
> This happens to be a 'file' (special one at that - it's a symlink) and
> not a directory so you can think of this being the same question as:
> $> ls -hal /path/somefile.txt
> 
> When you do that, it just shows you the info for /path/somefile.txt
> So ls is doing exactly what you are asking it (I'll stop yelling RTFM
> now, I promise)
> 
> Instead, you want to descend into /docs, so what you really want to ask
> ls to do is this:
> 
> $> ls -hal /docs/
> (did you notice the trailing / ???)
> 
> That will make it descend into it and show you the content of /docs/
> instead of the entry for docs...



Thomas, thanks for quick reply, but adding the trailing "/" still gives me the 
"document -> /files/document" link and not the listing of files.

-- 

Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug