[NTLUG:Discuss] Symbolic link strangeness

Leroy Tennison leroy_tennison at prodigy.net
Sat Jun 10 23:30:33 CDT 2006


Trying to figure out kdm on CentOS 4.3.  Found:

cd /usr/share/config/kdm
[leroy at linux-b kdm]$ pwd
/usr/share/config/kdm
[leroy at linux-b kdm]$ ll Xsession
lrwxrwxrwx  1 root root 22 May  7 05:08 Xsession -> ../../X11/xdm/Xsession
[leroy at linux-b kdm]$ cd ../../X11/xdm
[leroy at linux-b xdm]$ pwd
/etc/X11/xdm                                    Hmmm, why am I not in 
/usr/share/X11/xdm?

After a little puzzlement and research

[leroy at linux-b xdm]$ cd /usr/share/config
[leroy at linux-b config]$ ll kdm
lrwxrwxrwx  1 root root 20 May  7 05:08 kdm -> ../../../etc/kde/kdm

OK, now the puzzlement above makes sense, so I decide to do

[leroy at linux-b config]$ cd kdm
[leroy at linux-b kdm]$ pwd
/usr/share/config/kdm

Why is pwd showing me /usr/share/config/kdm when I'm really in /etc/kde/kdm?

I know that's where I am because (I had to su because the directory was 
Read Only to all but root)

[leroy at linux-b kdm]$ su
Password:
[root at linux-b kdm]# cat > LeRoY
Where am I really?                                                   
Ctrl-D on an empty line put me back at the prompt.
[root at linux-b kdm]# ll L*
-rw-r--r--  1 root root 19 Jun 10 23:19 LeRoY
[root at linux-b kdm]# exit
exit
[leroy at linux-b kdm]$ cd /etc/kde/kdm
[leroy at linux-b kdm]$ ll L*
-rw-r--r--  1 root root 19 Jun 10 23:19 LeRoY
[leroy at linux-b kdm]$ cat LeRoY
Where am I really?
[leroy at linux-b kdm]$ pwd
/etc/kde/kdm

What disturbs me about this is I can't trust the reply of pwd when a 
symbolic link is a part of a path.  Is there another command I can use 
to tell where I REALLY am instead of where I appear to be?  
/usr/share/config/kdm doesn't really exist as a unique directory.



More information about the Discuss mailing list