Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a strange question about file system in Unix. Why isn't it possible to give the same name to two files under same directory ?

Wouldn't it be possible to use IDs to differentiate between distinct files with a similar name?

share|improve this question

closed as unclear what you're asking by Anthon, slm, Zelda, Martin von Wittich, Karlson Jan 24 '14 at 14:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

I am not getting why you would want this. What are you trying to do that requires this sort of strange setup? – Tim Jun 19 '12 at 16:45
You could have 'foo', 'foo ', and ' foo ', so they appeared the same. – jordanm Jun 19 '12 at 16:58
nix file systems are usually case sensitive. So 'foo', 'Foo' and 'foO' are three different files/folders. – SaultDon Jun 19 '12 at 19:18
up vote 8 down vote accepted

Think about it this way: A file's name is a unique human-readable identifier used to unequivocally refer to a file in your commands.

Modern shells are able to understand relative paths, but think of names as the full path of the parent directory + the filename.

The real question you should ask yourself is: is there any advantage to make the unique identifier of a file non-human-readable?

share|improve this answer
Creating files with non-human-readable names isn't exactly trivial, but isn't "hard" either. And there can be some merit to it. But making multiple files with the same filename makes no sense to me at all. Especially when filenames are the only thing most programs use to refer to files. To make filenames ambiguous just doesn't make sense to me. – killermist Jun 19 '12 at 23:53

Moving the disambiguation between files from the name of the file to the ID isn't helpful. What we call the name is now the ID, no problem! Except of course, the name of your file is no longer README but 92847109387477474.

share|improve this answer

No filesystem (as far as I know) allows one to have two files with the same name, and if any of them did, many applications would be broken or would pose security hazards.

If you have 2 files with the same name, you generate ambiguity: even if they have the same file name but different IDs, how do you tell applications which file to refer to (this "open file by ID" could be done, but would require deep changes to many applications, libraries etc...)?

share|improve this answer
He said that he would use IDs to refer to them. I don't know what these IDs are, but it's the answer to your question. – Limited Atonement Jun 19 '12 at 17:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.