Why does ls -a not show files that finder does show?

When navigating to /usr/local/bin a file called "R" can be seen:

enter image description here

But when cd /usr/local/bin and ls (or ls -a), we see a long list of files, but no file called R:

enter image description here

I was surprised by this - apparently finder can see files that ls cannot. Why doesn't ls -a show all files that finder does?


Solution 1:

It's there, but you're not seeing it because it's not where you're expecting it to be because the sorting in Finder is different than the sorting in Bash/Zsh. Basically Finder does a case insensitive search whereas Bash is case sensitive. For example, "a" follows "Z"

If you're looking for a specific file and you know the case, you can use a little ls magic to find it...

$ ls -Ad R*

Where...

  • -A = List all files, except . and ..
  • -d = Treat directories as files and do not search them recursively
  • R* = All files that begin with the letter "R"