Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
/Users/gu/dev/node.js/express/lib
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
connect

What could be going on? Thanks

share|improve this question
1  
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

1 Answer 1

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

 
discard

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.