[CentOS] My current directory is lost in a bash shell

Les Mikesell lesmikesell at gmail.com
Sat Mar 3 17:21:49 UTC 2007

Theo Band wrote:
> Robert Becker Cope wrote:
>> Theo Band <theo.band at xanadu-wireless.com> wrote:
>>> [thba at vink layout]$ nc script/xw_functions.ample
>>> NEdit: getcwd() fails: No such file or directory
>>> NEdit: getcwd() fails: No such file or directory
>>> [thba at vink layout]$ ll script/xw_functions.ample
>>> -rw-rw-r-- 1 thba thba 16829 Oct 25 16:59 script/xw_functions.ample
>>> [thba at vink layout]$ pwd
>>> /home/thba/workarea/colibri/design/ana/layout
>>> [thba at vink layout]$ /bin/pwd
>>> /bin/pwd: cannot get current directory: No such file or directory
>> This is typical when the directory you are in has been removed out from under
>> you. Try this:
>> Log into two shells (or use screen, or whatever), A and B. In A, do "cd ~;
>> mkdir -p xxx/yyy; cd xxx/yyy; touch 123; ls -l 123". Then, in B, do "cd ~; rm
>> -rf xxx". Finally, back in A, repeat what you did above, "ls -l 123; pwd;
>> /bin/pwd". You will find the behavior is the same.
>> Good luck,
>> robert
> Then you have a stale NFS handle. That is not the same error message I'm getting:
> [thba at scholekster yyy]$ ls -l 123
> ls: 123: Stale NFS file handle
> The directories have not changed at all, still the shell complains.

The process has to be able to read it's way back up the '..' parent 
directories to find the path.  Do you have a permissions or selinux 
issue preventing that? Can the process where getcwd() fails do an
ls .; ls .. ; cd ..; all the way back to /?

   Les Mikesell
    lesmikesell at gmail.com

More information about the CentOS mailing list