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

Re: "ls -d" OK, but not "ls"



On 2021-06-23 at 09:59, Vincent Lefevre wrote:

> On a Debian GNU/Linux 10 (buster) machine:
> 
> $ ls -ld /etc/systemd
> drwxr-xr-x 3 root root 0 2021-04-19 09:40:41 /etc/systemd
> $ ls /etc/systemd
> ls: cannot open directory '/etc/systemd': No such file or directory
> 
> Any explanation???

On a non-systemd machine, I get:


$ ls -ld /etc/systemd/
drwxr-xr-x 4 root root 4096 Jul 23  2019 /etc/systemd/
$ ls /etc/systemd/
system  user


It seems possible that the 4 vs. 3 may be notable.

An empty directory will normally report 2: the '.' link from inside it,
and the named link from the parent directory. 4 here reflects the two
'..' links from the two visible subdirectories; 3 would indicate that
one of those four links is missing on your system, and depending on
which one that is, it seems possible that that could lead to misbehaviors.

It could be useful to check on this with other tools. For a start, what
does

$ stat /etc/systemd/

report?


Also, my first thought was to verify that ls is running the way you
think it is. What do the following commands give you?

$ type ls
$ echo $LS_DEFAULT_OPTIONS

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: