The length of a linux file name must not exceed the number of characters. The length of a linux file name.

How are the file names in the file control block stored in Linux?

In a directory in the file system, directory entries corresponding to all file name information are stored in the data blocks of the file name files in the directory. Each directory entry only includes a 14-byte file name string and a 2-byte i-node number corresponding to the file name. Therefore, one logical disk block can store 1024/16=64 directory entries.

Other information about the file is stored in the i-node structure specified by the i-node number. This structure mainly includes information such as file access attributes, host, length, access storage time, and the disk block where it is located.

The i-node for each i-node number is located at a fixed location on the disk.

Learn Linux file types and suffixes a little bit a day?

Common file types in Linux

General files

This is the file we list through ls-l. The first character in the first column is - , according to the content of the file, it can also be divided into several categories:

Plain text file (ASCII): This is equivalent to Notepad, called a plain text file, and we can directly read the contents of the file. This kind of files occupies a lot in Linux systems.

Binary file (binary): The executable file (scripts) in the Linux system is a binary file, and this file must have x permissions to be executed. Some commands in our system are files of this type.

Data format file (data): In the Linux system, some programs will read certain databases when running. These files are data files. For example, the last command we mentioned earlier calls /var/log/wtmp. If we use the cat command to view the /var/log/wtmp file, you will find that it is all garbled.

Regarding some other file types, such as connection files, device files, data interface files (sockets), pipe files (pipe), etc., these are also special file types, we only need to understand them Yes, in the subsequent study, you just need to know what it is when you see it. If you want to learn more deeply, then find relevant information and study slowly, such as how to view a data file, etc.

Linux file suffix

We also said at the beginning that on the Linux system, the requirements for this suffix are not as strict as Microsoft's win system, but In order to make it easier to confirm what kind of file the file is, the corresponding suffix is ??added at the end. If the contents of a file can be read using the cat command, after we change the suffix, it can still be read using cat.

We also know that on Microsoft's win system, commonly used executable files generally end with .com, .bat, and .exe. It's different on our Linux system. I can add X (executable) permissions to any file, but whether it can be executed successfully depends on the content of the file itself. An important point here is that there is a difference between being able to be executed and being able to be executed successfully. For example, we have an install.log file in the home directory of the root user. We add X permissions to it. Although it is an executable file, there will be no results after execution because the content in this file is not accessible to our system. Executed, of course he failed to execute it!

So, in order to make it easier for us to understand what the files in the system are for. The Linux system will still use the corresponding suffix name to indicate the type of file. Let's take a look at some common suffixes

.sh: This is usually some scripts files we write ourselves, usually written through the shell, so it is represented by .sh.

.z, .tar, .tar, .gz, .zip, .tgz: This type of file is a compressed file, but the compression method used is different.

.log: This type of file is a log file.

.conf: This type of file is some configuration files, which are most commonly seen on Linux systems.

.rpm: This is a Red Hat software package. Of course, different Linux distributions have different suffixes for the software packages they use.

.php, .jsp, .html, .css: This category is all website type files.

Of course, there are some other suffixes, which don’t have much meaning. They are just for our convenience to identify. Let’s take a brief look at them.

This length is already very long, enough for us. In the subsequent study, you will find that on the Linux system, many software names are very long. It will be a waste of time if you type each word one by one, and sometimes you will make mistakes. Isn't this too inconvenient? Of course not. Long file names help us know what this file is for (I think so). It is actually convenient for us. In order to prevent us from typing so many words, there is an important function key on the Linux system, which is TAB. This has a completion function. Just type the first few words and press TAB to complete them. If you press If used twice, content related to these words will be displayed. Haha, if friends who use Linux don’t know this function, or don’t know how to do it, then it’s a failure!

Naming rules for files in Linux systems

We know that on Linux systems, commands are basically used to operate. The shell we use has many special features. Characters, if our file name is the same as the special characters in this shell, it will be difficult to handle, so when we name the file, we should avoid some special characters while making it easy to identify. We list them below. For your reference (it’s not that you can’t command these characters, it’s just recommended to avoid them).

In Linux, how to calculate the maximum file length and maximum disk space based on the disk block size and disk block number size?

You cannot save a disk block with even a disk block number. Normally, the disk block size is divided by the byte size occupied by the disk block number, and you can get the maximum number of disk blocks that a file can occupy (level one). Index)

What is the maximum number of characters allowed in a file name?

The length limit of Linux file names is 255 characters

Fully qualified file names under Windows must be less than 260 characters, and directory names must be less than 248 characters.

Win7x64 environment:

260 characters is the total file name length limit.

What is the maximum length of a single file supported by this file system?

The maximum size of a single FAT32 file cannot exceed 4G. If it exceeds 4G, it cannot be read. NTFS (Windows): supports a maximum partition of 2TB and a maximum file of 2TB. FAT16 (Windows): supports a maximum partition of 2GB and a maximum file of 2GB. FAT32 (Windows): supports a maximum partition of 128GB and a maximum file of 4GB. HPFS (OS/2): supports a maximum partition of 2TB and a maximum file of 2GB. 2GBEXT2 and EXT3 (Linux): supports a maximum partition of 4TB and a maximum file of 2GBJFS (AIX): supports a maximum partition of 4P (blocksize=4k) and a maximum file of 4PXFS (IRIX): This is a serious 64-bit file system that can support 9E ( 2 to the 63rd power) partition