Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: jpeters on September 24, 2009, 12:27:08 PM

Title: listing links (ls -l)
Post by: jpeters on September 24, 2009, 12:27:08 PM
I'm not sure why 'ls -ld' doesn't show the link with .files in $HOME, although they show up as links with emelfm.  Is there some other option I should be using?   Also 'du -h' follows the link as well.
Title: Re: listing links (ls -l)
Post by: robc on September 25, 2009, 12:57:31 AM
I don't quite understand what you are asking...but would "ls -lda" work?
Title: Re: listing links (ls -l)
Post by: combo3 on September 25, 2009, 01:24:37 AM
The -d switch requires extra arguments.

Visible directories: ls -ld */

Hidden directories: ls -ld .*/

All directories: ls -d .*/ */

To list everything, including sudirectories use: ls -laR

To list only links: ls -aR | grep ^l
Title: Re: listing links (ls -l)
Post by: jpeters on September 25, 2009, 02:58:57 AM
Okay, so as combo3 noted,  "ls -lda" or "ls -ld"  needs the extra  ".*" arg, and then correctly lists all the links:

tc@box:~$ ls -lda .*
Code: [Select]
lrwxrwxrwx    1 root     root           35 Sep 24 09:13 .openoffice.org2 -> /mnt/hda3/Desktop/.openoffice.org2//

If I try to list only the .openoffice.org link, however:

tc@box:~$ ls -lda  .openoffice.org2/
Code: [Select]
drwxr-sr-x    3 tc       staff        4096 Sep 24 17:57 .openoffice.org2//

Code: [Select]
tc@box:~$ ls -la .openoffice.org2/
drwxr-sr-x    3 tc       staff        4096 Sep 24 17:57 ./
drwxr-xr-x   14 tc       staff        4096 Sep 24 08:37 ../
drwxr-sr-x   12 tc       staff        4096 Sep 24 08:24 user/

Edit: Interesting....the same goes with "du -h", which requires the ".*" or it follows the link:

du -h
Code: [Select]
2.0M    .openoffice.org2/

du -h .*
Code: [Select]

0       .openoffice.org2

"du -h .openoffice.org2" also follows the link (lists all the files, ending with 2.0M .openoffice.org2/)

Thanks!
Title: Re: listing links (ls -l)
Post by: combo3 on September 25, 2009, 03:29:41 AM
When the argument is a specific directory name, "-d" lists only the directory name.
Title: Re: listing links (ls -l)
Post by: jpeters on September 25, 2009, 04:17:36 AM
When the argument is a specific directory name, "-d" lists only the directory name.

It would be nice, however, if  "ld"  showed the link, but at least with ".*" I can see it. Maybe there's  some way to see the individual link, but haven't found it yet.  
Title: Re: listing links (ls -l)
Post by: bmarkus on September 25, 2009, 04:45:36 AM
I gues you are playing with the commands provided by Busybox. As an option you can install coreutils to have the "real" tool set. It may behave differently. Did not try with these commands, just an idea.
Title: Re: listing links (ls -l)
Post by: combo3 on September 25, 2009, 10:02:45 AM
It seems the results are dependent on whether your directory name ends with a trailing /

tc@box:~$ ls -lad .boot
lrwxrwxrwx    1 tc       staff          14 Sep 25 08:35 .boot -> /mnt/hda1/boot/

tc@box:~$ ls -lad .boot/
drwxr-xr-x    6 root     root         1024 Sep 22 10:44 .boot//

tc@box:~$ ls -la .boot
lrwxrwxrwx    1 tc       staff          14 Sep 25 08:35 .boot -> /mnt/hda1/boot/

tc@box:~$ ls -la .boot/
drwxr-xr-x    6 root     root         1024 Sep 22 10:44 ./
drwxr-xr-x   10 root     root         1024 Sep 22 10:43 ../
drwxr-xr-x    2 root     root         1024 Sep  8 20:02 grub/
drwxr-xr-x    2 root     root         1024 Sep  2 14:40 tc143/
drwxr-xr-x    2 root     root         1024 Sep  2 09:31 tc220/
drwxr-xr-x    3 root     root         1024 Sep 16 11:15 tc231/

With it, ls displays the contents of the linked directory; without it, you get the contents of the current one.
Title: Re: listing links (ls -l)
Post by: bigpcman on September 25, 2009, 10:49:40 AM
It seems the results are dependent on whether your directory name ends with a trailing /

tc@box:~$ ls -lad .boot
lrwxrwxrwx    1 tc       staff          14 Sep 25 08:35 .boot -> /mnt/hda1/boot/

tc@box:~$ ls -lad .boot/
drwxr-xr-x    6 root     root         1024 Sep 22 10:44 .boot//

tc@box:~$ ls -la .boot
lrwxrwxrwx    1 tc       staff          14 Sep 25 08:35 .boot -> /mnt/hda1/boot/

tc@box:~$ ls -la .boot/
drwxr-xr-x    6 root     root         1024 Sep 22 10:44 ./
drwxr-xr-x   10 root     root         1024 Sep 22 10:43 ../
drwxr-xr-x    2 root     root         1024 Sep  8 20:02 grub/
drwxr-xr-x    2 root     root         1024 Sep  2 14:40 tc143/
drwxr-xr-x    2 root     root         1024 Sep  2 09:31 tc220/
drwxr-xr-x    3 root     root         1024 Sep 16 11:15 tc231/

With it, ls displays the contents of the linked directory; without it, you get the contents of the current one.
How is this different than the coreutils ls?
Title: Re: listing links (ls -l)
Post by: jpeters on September 25, 2009, 11:06:07 AM
It seems the results are dependent on whether your directory name ends with a trailing /

tc@box:~$ ls -lad .boot
lrwxrwxrwx    1 tc       staff          14 Sep 25 08:35 .boot -> /mnt/hda1/boot/

tc@box:~$ ls -lad .boot/
drwxr-xr-x    6 root     root         1024 Sep 22 10:44 .boot//


ah.......that's it!  Mine automatically includes "/" when I use the tab key to complete it.  
Code: [Select]
tc@box:~$ ls -ld .openoffice.org2/
drwxr-sr-x    3 tc       staff        4096 Sep 24 17:57 .openoffice.org2//
Code: [Select]
tc@box:~$ ls -ld .openoffice.org2
lrwxrwxrwx    1 root     root           35 Sep 25 01:48 .openoffice.org2 -> /mnt/hda3/Desktop/.openoffice.org2//

Thanks for finding this, combo3  ;)

note: "ls -ld" works

bigpcman: When I tried coreutils,  it was doing the same thing. I assume removing the "/" will also work (haven't tried it).