Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've sort of "lost" some files under a hidden directory in my home called .node_libraries When I ls its content from another directory, i see the wanted files and directories, but when i cd to it and then list the content, i can only see one directory. See below:

marvin:lib gu$ pwd
marvin:lib gu$ ls ../../../../.node_libraries/
admin.js      crypto        gridfs        request.js    view.js
bson          cursor.js     index.js      response.js
collection.js db.js         jade          responses
commands      express       middleware    server.js
connection.js goog          public        utils.js
marvin:lib gu$ cd ../../../../.node_libraries/
marvin:.node_libraries gu$ ls

What could be going on? Thanks

share|improve this question
Dennis’ answer seems right. The cd and pwd commands built into bash conspire to give the illusion of being able to cd into and out of symlinks; ls is an external program and can not be easily recruited into the conspiracy. When ls resolves .., it uses the “physical” cwd. The shell’s pwd shows (and cd uses) the “logical” cwd. If one of the path components of dev/node.js/express/lib (under /Users/gu) is a symlink, then the physical and logical cwds will not match. Use set -P (or cd -P and pwd -P//bin/pwd) to escape the “symlink-in-cwd conspiracy”. – Chris Johnsen Oct 2 '10 at 3:48
up vote 2 down vote accepted

You have a symlinked directory.

What do these commands give you?:

set -o | grep physical
alias cd
alias ls
ls -ld /Users/gu/.node_libraries
ls -ld /Users/gu/dev/node.js/express/lib
find /Users/gu -H -type l -xtype d -ls
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.