1

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

1
  • 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”. Oct 2, 2010 at 3:48

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .