I created a directory d
and a file f
inside it. I then gave myself only read permissions on that directory. I understand this should mean I can list the files (e.g. here), but I can't.
will@wrmpb /p/t/permissions> ls -al
total 0
drwxr-xr-x 3 will wheel 102 4 Oct 08:30 .
drwxrwxrwt 16 root wheel 544 4 Oct 08:30 ..
dr-------- 3 will wheel 102 4 Oct 08:42 d
will@wrmpb /p/t/permissions> ls d
will@wrmpb /p/t/permissions>
If I change the permissions to write and execute, I can see the file.
will@wrmpb /p/t/permissions> chmod 500 d
will@wrmpb /p/t/permissions> ls d
f
will@wrmpb /p/t/permissions>
Why is this? I am using MacOS.
Edit: with reference to @ccorn's answer, it's relevant that I'm using fish and type ls
gives the following:
will@wrmpb /p/t/permissions> type ls
ls is a function with definition
function ls --description 'List contents of directory'
command ls -G $argv
end
alias ls='ls -G'
, which I think many people do. – wrgrs Oct 04 '17 at 16:07