39

When you are naming files with multiple words in the name, is it more common in Unix systems to use underscores, camel case, or dashes to separate the words?

dan
  • 4,077
  • 5
  • 27
  • 34

1 Answers1

51

On one of my random systems:

$ find /usr/bin -xdev -type f -name '*-*' | wc -l                # hyphen
1019
$ find /usr/bin -xdev -type f -name '*_*' | wc -l                # underscore
311
$ find /usr/bin -xdev -type f -name '*[a-z][A-Z][a-z]*' | wc -l  # camelcase
2
$ find /usr/bin -xdev -type f -name '* *' | wc -l                # space
0

Your mileage may vary. There's a lot of personal preference involved -- my home directory is probably very much skewed towards hyphens, because underscore and camelcase involves shifting, and space has difficulties with quoting.

Jim Paris
  • 14,337