Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UNIX:Two directories with same name on the same path? [closed]

While I was going through a unix system I found Five, two directories with same name listed on the same path, when I did a ls -Dl

Here is the view, Why I said Five, Two Directories with same name.....

//11/# ls -Dl

total 553

drwxrwxr-x  2 root      root          12288 Dec 20  2010 bin

drwxrwxr-x  2 root      root          16384 Sep 28  2010 bin

drwxrwxr-x 11 root      root           4096 Oct 25 06:49 etc

drwxrwxr-x 11 root      root           8192 May 17 07:40 etc

drwxrwxr-x  3 root      root           4096 Sep 28  2010 qnx4

drwxrwxr-x  4 root      root           4096 Jul 26  2010 qnx4

drwxrwxr--  4 root      root           4096 Sep 28  2010 registry

drwxrwxr-x  4 root      root           4096 Aug 31  2008 registry

drwxrwxr-x 16 root      root           4096 Sep 28  2010 usr

drwxrwxr-x 17 root      root           4096 May 27 03:49 usr

How can this be possible?? what will happen if I cd any one of them, which directory i'll end up in??

There is another way of looking at it, when I did ls -liF the directories listed here came up with different inodes. and were not even symbolic links or anything.???

Please explain this to me??

like image 764
VJ22 Avatar asked Oct 26 '13 07:10

VJ22


2 Answers

You should use all these commands to check what are various characters (including hidden ones) in your filename:

printf "[%s]\n" *

printf "%s\n" * | cat -vte

printf "%s\n" * | od -bc

Last one will also dump each dump each character in octal and ascii.

like image 192
anubhava Avatar answered Oct 04 '22 18:10

anubhava


use ls -b, if you found any "\" appended after your folders or files, that should be spaces.

like image 27
Colin Su Avatar answered Oct 04 '22 20:10

Colin Su