Shell 'ls' command

Recently I had an issue with my 'elder' High Sierra on my 21" iMac Terminal. Finder was showing me files in a directory, but when I went to Terminal and did an 'ls -al' on the same directory it did not show me the same results.


A bit of research told me that 'ls is hashed', which is supposed to speed up shell commands. But how do I clear that hash table?

iMac 21.5″, macOS 10.13

Posted on Dec 12, 2020 1:37 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 16, 2020 3:53 PM

the has you speak of is a shell feature to make accessing the command faster.


hash -r


makes the shell forget its cache of previously used commands.


/bin/ls -la


will ignore the hash as well, and go directly to the ls command.


the -a option is going to show you the invisible files.


Not sure what information you feel is different in the -l option.

  • By default -l shows the modification date. The finder may be showing you a different date.
  • The -l command shows you the size if bytes, unless you throw in the -h option
  • Sort order is by default alphabetical with uppercase before lowercase, as commands run from the shell are case sensitive for the most part.
3 replies
Question marked as Top-ranking reply

Dec 16, 2020 3:53 PM in response to mouthbreather0

the has you speak of is a shell feature to make accessing the command faster.


hash -r


makes the shell forget its cache of previously used commands.


/bin/ls -la


will ignore the hash as well, and go directly to the ls command.


the -a option is going to show you the invisible files.


Not sure what information you feel is different in the -l option.

  • By default -l shows the modification date. The finder may be showing you a different date.
  • The -l command shows you the size if bytes, unless you throw in the -h option
  • Sort order is by default alphabetical with uppercase before lowercase, as commands run from the shell are case sensitive for the most part.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Shell 'ls' command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.