Red Hat Bugzilla – Bug 91886
"ls .." output diffesr from the output of "cd .. ; ls " in case the current working directory is a symlink.
Last modified: 2007-04-18 12:54:08 EDT
Description of problem:
"ls .." shows different directory content than "cd .. ; ls" when the current
directory is a symlink, pointing to another directory. This will create
confusion for an average user who is not aware of the fact that the current
directory is a symlink.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. say I've a directory as
& another directory as
2. making a new symlink to /path1/foo
$ cd /path2/
$ ln -s /path1/foo/ bar
$ cd bar
3. now executing the command "ls .." shows the content of the parent of target
directory (content of /path1, & not of /path2)
$ ls ..
while "cd .." will lead me to /path2
$ cd ..
.... this seem to be an inconsistency, considering the situation where a user is
not aware of that 'bar' is actually a symlink, what he sees is a completely
different output from seemingly trivial commands.
"ls .." & "cd .. ; ls" show different directory contents.
The contenst shown by "ls .." should be the content of the parent directory of
No, this is correct behaviour. Use 'cd -P' to prevent confusion. When you have
used 'cd symlink', the 'parent' directory (the one you were just in) is only
known to bash, and not to ls.