Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the difference between Unix file name and Windows file name

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

How to analyze the difference between Unix file name and Windows file name, I believe that many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

The naming rules for files in the Unix operating system are not as strict as those in the Windows operating system. In other words, characters that cannot be included in file names in many Windows operating systems are allowed in Unix operating systems. So some administrators transferred from the Windows operating system will feel particularly unaccustomed. Today, the author summarizes the differences between the naming rules of the two operating systems to help Windows system administrators transition more smoothly to the position of Unix operating system.

First, the representation of hidden files is different.

In the Windows operating system, if you want to set the properties of a file to hidden, you must click on the file, and then right-click to select "hide". Then you can set this file to be hidden. That is, in general, you can't see the files hidden by the user. But it is different under the Unix operating system. In the Unix operating system, like the Windows operating system, you can hide a folder or file. But the two ways are different. In the Unix operating system, it is controlled by the name of the file or folder (directory file). That is, if you want to set a file to be hidden, you only need to add a period in the English state at the beginning of the file name. If you want to set a directory file to be hidden, Kone only needs a period in front of the name of the directory file, that is, the last English state. Such as .Unix and so on. This means that the folder is a hidden file or a hidden folder.

So how do you view this hidden file or hidden folder? This is different from the Windows operating system. In the Unix operating system, if you want to access a hidden folder, you don't need a special setting like the Windows operating system. Just type in the file name or directory file name. In other words, it is necessary to put that. Take the number with you. To get into the UNIX hidden folder set above, you only need to execute the cd .UNIX command. So in the Unix operating system, whether setting hidden files or hiding directory files, or viewing these files, are controlled by a period in the English state. For this reason, the importance of this dot should be fully recognized in the Unix operating system.

Second, the degree of case sensitivity is different.

In the Windows operating system, both files and folders are not case-sensitive. In other words, Unix and UNIX are the same file or folder. So in the Windows operating system, when you name a folder or directory, you don't need to consider case. This brings great convenience to the operation. For example, when defining environment variables, there is no need to consider case. There is no problem with all lowercase or uppercase paths. But it is different in the Unix operating system. In the Unix operating system, both ordinary files and directory files are sensitive to case. That is, Unix and UNIX are two different files or directories. Although the difference is not great, the impact is far-reaching. For example, when defining environment variables in Unix, when entering a path, neither case can be wrong. If there is a problem with the case of a character, then this environment variable will not work because it points to the wrong location.

For this reason, special care is required when defining files or file names in the Unix operating system. In general, unless there is a special need, the author establishes that for ordinary files, lowercase characters are used. For system files or directories, use characters of the size. No matter what kind of file, there is a taboo is not to use mixed case to name files or directories. Because on the one hand, it will be troublesome to enter mixed-case directories or files. Secondly, it is also easy to make mistakes when referencing the path. For this reason, the name of any kind of file (ordinary file, directory file, device file) is in all uppercase or lowercase. In addition, when defining environment variables, * * specify the path for the environment variables by copying and pasting, so as to prevent the environment variables from failing to function due to case errors.

Speaking of this case, I would like to remind you by the way. When defining an environment variable, the case of the variable name is also sensitive. In the Windows operating system, the case of the environment variable is not sensitive, and the user enters the name of the environment variable as the same case or lowercase. But the case of this environment variable is also sensitive in the Unix operating system. According to custom, environment variables in Unix operating systems are generally defined as uppercase. Ordinary variables are set to lowercase. Although this is an unwritten rule, the systems engineer still follows it. To reduce the annoyance caused by case sensitivity.

Third, the requirements of the extension are different.

In Windows operating systems, it is generally required that files must have an extension. The operating system associates applications based on this extension. For example, text.txt,***,.txt is the extension of the file. Especially for some scripted batch programs, it is required to end with the bat extension. Only in this way will the operating system execute as a batch program. However, there are no such strict requirements in the Unix operating system. Even for ordinary files, the extension is optional. By default, sh is an executable file under the Unix operating system. However, if the executable written by the engineer does not have this extension, it can also be run. This is mainly due to the different ways in which the two operating systems call scripts. Under the command line window of the Windows operating system, you can run the script simply by entering its full name (with an extension). But in the shell of the Unix operating system, if you call a script, you need to precede the script with a. / symbol to indicate that the system is asked to execute the program. In other words, he does not distinguish whether this is an executable script by extension. It is judged by the prefix of the command line. For this reason, there is no provision for extensions in the Unix operating system.

Although there are no hard and fast rules for extensions in the Unix operating system. However, under normal circumstances, the author still advises users to add an extension name when creating a normal file. Only in this way, you can understand the type of file by looking at the extension without looking at the specific contents of the file. As soon as you see the sh extension, you know that this is a script file. Without having to look at its contents. Similarly, you can add an extension to C source files, text files, and so on.

Special characters can be added to the file name.

In the Windows operating system, although most characters can be used as file names, there are strict restrictions on the use of some special characters. For example, some special-purpose characters such as /, * and other symbols can not become their file names. However, in the Unix operating system, there are no such strict requirements in this respect. For example, in the Unix operating system, text*.txt, text/tet.txt and other file names are legal. So regardless of other factors, files in the Unix operating system can basically use any character. However, some characters have a special meaning, and if you add these characters to the file name, it may adversely affect the subsequent operation.

As the author mentioned at the beginning, the period in English is a control symbol of file data. If the * characters in the name of a normal file or directory file is a period in English, it means that this is an invisible file or folder. For this reason, when defining files, do not start with a period in the should state unless there is a special need to set them to be hidden. However, a file name can be followed by multiple periods, that is, it can be distinguished by a period. Such as student.num.txt. A text file that represents a student number. If you are in the Windows operating system, you will think that this file has two extensions. When the file is opened for * times, the user will be prompted which software to use to open it. However, it is considered legal in the Unix operating system.

Although *,-and other symbols can also be used as the name of the file. But because it has some special meanings, it needs to be used with caution when using them to name files. If it is similar to a dot, do not use the-symbol as the * * character of the file name. Because this-symbol represents the optional command in the system. For this reason, when using commands such as cat to manipulate the file, the system will mistakenly treat the file name parameter as optional. It turns out that there is no this option to protect the error. In addition, this * symbol represents a wildcard in the system. If you use the rm command to delete a file name with * at this time, you must use escape characters. Otherwise, there will be some disastrous consequences. For this reason, the author suggests that although some special symbols can be used as the names of files or directories in the Unix system. But do not include special symbols in the file name unless there is a special need. Otherwise, users are likely to ask for trouble because of their excessive pursuit of individuality.

After reading the above, do you know how to analyze the difference between Unix file name and Windows file name? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report