Effect of slash (/) suffixes on symlink names for `ls` with the `-F` option
0
votes
2
answers
273
views
By way of example, I have a directory structure like this:
$ \ls -F
dir/ lnk@
$ \ls -F dir
FILE
$ \ls -l lnk
lrwxrwxrwx 1 user group d Mon hh:mm lnk -> dir
My
ls
command is aliased. I am using \ls
to get standard behavior (I think).
The question is
When using the-F
option with ls
, why does appending a slash to the symlink name affect the behavior of ls
?
$ \ls -F lnk
lnk@
\ls -F lnk/
FILE
Without the /
, the symlink itself is listed with an @
indicator/flag/classifier; with the /
, the files in the directory that the symlink references are listed with indicators (FILE
is a regular file).
I'm not sure whether to call the behavior with no options consistent or inconsistent:
$ \ls lnk
FILE
\ls lnk/
FILE
I am not finding an explanation for this in man ls
.
Similar Posts
-------------
https://unix.stackexchange.com/questions/425029/using-ls-command-with-symbolic-links
https://unix.stackexchange.com/questions/315461/show-contents-of-symbolic-link
References
----------
https://unix.stackexchange.com/questions/29769/trailing-slashes-on-symbolic-links-to-directories
The IEEE and the Open Group (2004) "Pathname Resolution" [subsection 4.11](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11) in _The Open Group Base Specifications Issue 6_
The IEEE and the Open Group (2018a) "Pathname Resolution" [subsection 4.13](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html) in _The Open Group Base Specifications Issue 7_
The IEEE and the Open Group (2018b) "[ls](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html) "
Asked by Ana Nimbus
(687 rep)
Oct 19, 2022, 06:18 PM
Last activity: Oct 20, 2022, 05:55 PM
Last activity: Oct 20, 2022, 05:55 PM