Question

Operating System: Mac OS X 10.7.5

Shell: bash

My ls command does not work properly in my home directory. The weird behavior includes:

  1. Sometimes shows part of the files and directories and returns
  2. Sometimes shows part of the files and directories and hangs
  3. Sometimes shows nothing and returns
  4. Sometimes shows nothing and hangs

This thing happens in other system-created directories as well (~/Documents/, ~/Downloads/, ~/Pictures/, etc). I tried directories not in my home directory (/Users/, /var/, etc), as well as directories created by other applications or myself (~/Dropbox/), ls command works just fine.

Any help is appreciated.

Edit:

"type ls" has following output:

ls is hashed (/bin/ls)

Files and directories shows up correctly in Finder app. I'm not sure if it is implemented using ls though...

Samples:

dhcp-10-134-196-222:/ yi$ type ls
ls is hashed (/bin/ls)
dhcp-10-134-196-222:/ yi$ cd
dhcp-10-134-196-222:~ yi$ ll

dhcp-10-134-196-222:~ yi$ ll

dhcp-10-134-196-222:~ yi$ ls

dhcp-10-134-196-222:~ yi$ ls ~/Downloads/

Commands and output (basically no output there..):

dhcp-10-134-196-222:~ yi$ cd
dhcp-10-134-196-222:~ yi$ echo *
dhcp-10-134-196-222:~ yi$ ls

Thanks for helping me. This issue goes away when I upgrade to OS X Mavericks.

Was it helpful?

Solution

Could you give us the output of the following commands?

cd <dir which not work with ls>
echo *
ls

Otherwise, I've never encountered this error before. However, I don't use the default commands. I recompiled all versions of GNU coreutils, and other commands (grep, sed, awk, etc) and Bash and change my PATH.

If you're interested and if nobody gives you a direct solution to solve the problem, you could inform you on it (I used brew and macports to do that. You can read this topic for example).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top