Advantages of the Linux file name lowercase

Source: Internet
Author: User

Description: From the old Ruan why the file name to lowercase articles, in fact, I think it should be said that the Linux file name is more appropriate for lowercase.

First, portability

Linux systems are case-sensitive, and Windows systems and MAC systems are the opposite, case insensitive. Generally speaking, this is not a big problem.

However, cross-platform problems can occur if the two filenames have the same case and the others are the same.

  • foobar
  • Foobar
  • FOOBAR
  • fOObAr

The above four file names, the Windows system will treat them as a foobar . If they exist at the same time, you may not be able to open the back three files.

On the other hand, when developing on MAC systems, they are sometimes negligent and write in the wrong case.

// 正确文件名是 MyModule.jsconst module = require(‘./myModule‘);

The above code can run on Mac because the Mac thinks MyModule.js and myModule.js is the same file. However, once the code is run to the server, it will get an error because the Linux system cannot find it myModule.js .

If all the filenames are in lowercase, there will be no problem above, which will ensure good portability of the project.

Second, easy to read

Lowercase filenames are generally easier to read than uppercase filenames, such as easier to accessibility.txt ACCESSIBILITY.TXT read.

It is customary to use the Hump naming method, the first letter of the word capitalized, and the other lowercase letters. The problem with this approach is that if you encounter acronyms that are all capitalized, it will not work.

For example, a New York police agent surnamed Li, whether written NYPoliceSWATLee or NyPoliceSwatlee , are strange, or written ny-police-swat-lee relatively easy to accept.

Third, ease of use

Some systems generate some pre-built user directories, with first-letter capitalization of the directory name. For example, Ubuntu in the user home directory will be generated by default, and Downloads Pictures Documents so on directory.

MAC system is more excessive, some of the system directory is also uppercase, such as /Library/Audio/Apple Loops/ .

In addition, some common configuration files or documentation, also use uppercase file names, such as, Makefile , INSTALL CHANGELOG , .Xclients and .Xauthority so on.

Therefore, the user's files are in lowercase file names, it is convenient to these directories or files to distinguish.

If you break the casserole and ask the end, why does the operating system use this capitalization file name? The reason is also simple, because on early Unix systems, ls commands list uppercase letters, and then lowercase letters, with uppercase paths in front. Therefore, if the directory name or file name is uppercase, it is easier for the user to see first.

Iv. Ease of Access

The file name is all lowercase and also facilitates command-line operations. For example, some commands may not use -i parameters.

# 大小写敏感的搜索$ find . -name abc$ locate "*.htmL"# 大小写不敏感的搜索$ find . -iname abc$ locate -i "*.HtmL"

In addition, capital letters need to hold down the Shift key, more or less troublesome. If the file name is lowercase, you do not have to touch the key, not only easy, but also improve the speed of typing.

Programmers use the keyboard for a long time, a few times a minute Shift, and a day off can save a lot of finger action. Over the ages, is also a protection of their own body.

To sum up, the filenames are all using lowercase letters and conjunction lines (all-lowercase-with-dashes), is a good way to promote the correct practice.

Reference:

Http://www.ruanyifeng.com/blog/2017/02/filename-should-be-lowercase.html (the above content is transferred from this article)

Linux file name lowercase benefits (RPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.