12

As I find that UpperCase are really readable for first letter word separation in long complex names, I tend to give some of my Linux files names with some UpperCase. Mostly executables, some directories too.

But it's been a few weeks I have remarked that the huge majority off all file names in my linux distrib are lowercase...

So I made some googling a moment ago, and I found this article: Linux File Names, that states one should always use lowercase in the unix world,

...It's best to always use lowercase in Linux unless you can think of a good reason to use uppercase or mixed case. Most Unix people use lowercase almost exclusively, but aside from this "cultural" point, there's another good reason to use lowercase. If you're sharing or accessing a DOS file system with Linux, DOS will not be able to see the files that have uppercase or mixed-case file names...

Is that really the case?

1
  • 2
    yes, that's really the case. unix people can't seem to find the shift key. but there's really nothing justifiable to support rules against mixed case. it's just a rant. Commented Feb 8, 2013 at 2:30

3 Answers 3

21

Programmers abhor the use of the shift key (and caps lock is something many try to do away with). Continuing on from the spot that says "always use lower case"...

It's best to always use lowercase in Linux unless you can think of a good reason to use uppercase or mixed case. Most Unix people use lowercase almost exclusively, but aside from this "cultural" point, there's another good reason to use lowercase. If you're sharing or accessing a DOS file system with Linux, DOS will not be able to see the files that have uppercase or mixed-case file names.

The main reason for this is that if you are transferring two files that are separated by only case to a case-insensitive system, confusing things can happen on the insensitive machine.

The files on your linux machine are yours. Do with them as you like in a way that makes sense to you.

I have found that a convention of using upper case for the leading letter of a directory makes it easier for me to navigate them. Doing an 'ls' in the directory automatically puts all of the directories at the top of the list and separates the directories from the files making both easier to see and navigate to. But again that is for me - do what works for you.

4
  • 1
    DOS? Really? That's no longer relevant. Commented Feb 8, 2013 at 2:10
  • 3
    @mh01 I used to consider EBCDIC not relevant until last year I had to deal with a system that sent that character set rather than ascii. I've seen OpenVMS systems around (the most recent release was only 2 years ago, not bad for something that had a first release 35 years ago)... and its file system is still case insensitive. Apparently Macs have both case sensitive and case insensitive (and steam and photoshop don't like case sensitive file systems on the mac). Case insensitive is alive.
    – user40980
    Commented Feb 8, 2013 at 4:09
  • 3
    Not to mention the huge majority of desktop machines running case-insensitive Windows file systems. Commented Feb 8, 2013 at 7:22
  • Good point about case-insensitivity versus case-preservation, but if you have different files which differ only in the casing of the file name, I'd think that there are problems other than transferring to case-insensitive file systems that could cause confusion...
    – user
    Commented Feb 8, 2013 at 10:10
10

"Consumer-oriented" (whatever that may mean) usages tend to use Title Case, even in the Unix world. This is more often the case when the organization in question has people whose whole job is to think about user experience.

For example, my Ubuntu desktop has folders in the home directory called Downloads, Pictures, Documents, etc. Same goes for my OSX laptop (yes, it counts; it's BSD). Though it's worth pointing out that Apple goes as far as to name its own system directories with titlecase (e.g. /Library/Audio/Apple Loops/), while keeping the "classic" base filesystem all lowercase (e.g. /usr/libexec/dtrace/). But no Linux distribution I'm aware of uses titlecase anywhere outside the user's home directory.

Presumably the distinction is that directories you expect people to actually look at are titlecase, while places you expect people to not go exploring are all lowercase. A similar distinction appears to be at play with Ubuntu; only the directories that are expected to show up as a list of folders in an Nautilus window are titlecase, while folder names that are expected to be typed (not browsed) are all lower.

And that's the crux of it; titlecase or uppercase is more difficult to type. But titlecase looks better in a list or set of tiled folders. So, choose accordingly. Linux people frequently deal in the command line even for mundane tasks, so lowercase makes more sense.

1
  • good point but I would add that spaces or underscores are easier to read then camel or Pascal case
    – jk.
    Commented Feb 8, 2013 at 7:58
4

About the DOS argument: DOS/Windows filesystems do see your files regardless of case, and they can handle them fine. Very old DOS filesystems do not support anything beyond 8.3 filenames, but even FAT32 can handle long filenames. The only problem is that while DOS/Windows filesystems preserve case (in most cases; some flavors discard case for filenames that fit in the 8.3 format), they are not case sensitive when it comes to comparing filenames; Windows considers "foobar", "Foobar", "FOOBAR" and "fOObAr" to be the same filename.

That said, it is mostly a culture thing, but there is some background to it. The reason why this particular convention stuck in the UNIX world is usability. There are two main arguments here:

  • Separating words using non-letter characters is better for reading comfort than using casing to mark word boundaries. IfYouDonTBelieveMe, CompareThisSentenceWithThePreviousOneAndTellMeWhichIsEasierToRead. (And of course, novisualseparationatallistheworst).
  • Lower-case letters have more varied shapes than upper-case, which in turn leads to more diverse word shapes. THIS MAKES TEXT WRITTEN IN LOWERCASE EASIER TO READ THAN TEXT WRITTEN IN UPPERCASE.

These observations are easy to verify, and they have even been confirmed by scientific research.

In addition, UNIX culture prefers conventions that are not only easy to read, but also easy to write; UNIX hackers are typically people who spend a lot of time using their keyboard, and many use either the official touch-typing system or some personal derivative tweaked for programming. The concept of staying on the home row is important either way, so people like to avoid using keys that cannot be reached from the home row, especially the shift keys.

If you combine these three constraints, there is only really one sensible convention, which is all-lowercase-with-dashes.

2
  • 3
    @StephaneRolland: pursuing consistent naming across such different things as identifier in different programming languages and filenames is not wise. Be consistent within each realm, and stick to established conventions, but don't try to find one convention to rulel them all. Java variables are not SQL table names, and they aren't filenames either.
    – tdammers
    Commented Feb 8, 2013 at 12:03
  • @StephaneRolland - I believe the word you want is snake_case. Commented May 8, 2015 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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