Linux--Understanding the Linux file system (file types, user types)

Table of contents

1. Date operations in Linux:

2. File system in Linux:

3. Standards for file naming in Linux systems

4. Relative paths and absolute paths

5. File classification in Linux system  

6. User types in Linux 


1. Date operations in Linux:

        Operation of time in Linux system (Foreigners here like to use lowercase letters to represent large items, just like our year, month and day, we like to use lowercase letters, and use small and large for hours, minutes, and seconds; the same is true for ASCII encoding, and lowercase a means 97, the size of A is 65)

Options describe
%y Show current year
%m Show current month
%d Display the current day of the month
%H Display hours (00~23)
%M Display the current minute (00~50)
%S Display seconds (00~59)
%T Display the time in the format HH:MM:SS
%a Displays the abbreviated day of the week (Mon to Sat)
%h Display the month written (Jan to Dec)
%r Display time in AM/PM notation

Practical operation:

2. File system in Linux:

        No matter what system it is, it is actually a file system that follows a tree structure. The same is true for our Linux operating system. The Linux file system is a collection of files and directories and has the following attributes:

        *It has a root directory (/) that contains other files and directories. This should not be confused with the root user, which is different.

        *It is self-contained. There is no dependency between one file system and another file system

File path (remember it is /start anyway) describe
/ The root directory, which is different from our root user, can be called our ancestor directory.
/bin directory

It stores many practical programs in Linux. These utilities are commands available in the Linux system. They are usually in binary format (binary), so they are called the bin directory.

/dev directory It stores all device-related files in the system (device)
/etc directory It stores system-related data that our users and systems need to reference, such as passwd, profile and other important configuration files, so it is the directory used to manage our system programs and configuration files.
/lib directory It contains a database of compilers installed on the system, for example: C language routines
/home directory It is used to manage the home directories of all our users, and can also be specified using our ~ number, which often appears when configuring our user-level environment variables - vim ~/.bash_profile.
/user directory It stores operating system files that are not included in the boot process.
/var directory Contains information specific to different Linux utilities

3. Standards for file naming in Linux systems

        Length: Can be up to 255 bytes in length

        Characters: special characters except "/"

        Letters: Can contain uppercase and lowercase letters, and are case-sensitive

        General: cannot contain our spaces or tabs

4. Relative paths and absolute paths

        Relative path: Relative path is actually understood as the position relative to our current path.

        Absolute path: The absolute path actually starts from our root directory and continues to find the storage location of our files based on the file's storage path.

for example:

5. File classification in Linux system  

file type describe
Ordinary document All files created by the user are grouped into normal files, which include all data files, program files, object files, and executable files. Users can apply various operations to these files, such as adding, modifying, deleting, or even deleting the entire file.
directory file Linux automatically creates directory files when creating a directory. This file has the same name as the directory and contains information about the files under the directory. For example, for the directory /home/steve, there will be a directory file named Steve in the directory /home. The directory file contains a list of all files and directories that exist in the directory. Users cannot modify catalog files. When adding new files or new subdirectories to the directory, the system will automatically modify it.
special files

Most system files in Linux are special files. They are usually associated with I/O devices and are found in standard Linux directories. For example, /dev and /etc, users cannot modify special files      

         *Character device file: Character device file reads and writes data one character at a time. A modem is a character device file. Character devices are also called sequential access devices.        

        *Block device file: A block device file can access one piece of data at a time. Usually, a piece of data can be 512 or 1024 bytes. At this time, the kernel reads or writes at least one piece of data at a time. The kernel collects data from blocks in memory and then provides it to the user, a device that allows random access. This makes I/O operations fast. A hard disk is a block device. Many devices can act as character devices or block devices, depending on the command used by the user to access the device. Hard links: Hard links are special files that allow a file to have multiple names. You can only have hard links to files, not hard links to directories. These links are called hard links because they create direct links to the index node. And because each file system has its own database of inode information, you can only create hard links between files on the same file system.      

        *Symbolic links: Symbolic links, also known as soft links, are similar to hard links, the only difference is that they can work across different file systems 

        *Sockets: Sockets enable inter-process communication and use network ports to connect processes running on different computers        

        *Named Pipes: Named pipes transfer data between two processes running on the same computer, where the output of one or more processes serves as the input to the other process. Therefore, named pipes are also called first-in, first-out (FIFO) files.

6. User types in Linux 

user type describe
System administrator The system administrator controls the entire system and has all permissions of the Linux system. It is also called the root user and is mainly responsible for the smooth operation of the system. The administrator's job is to switch at the system console, the computer where the operating system resides, called the server. Create users and user groups for the system and perform backups to prevent data loss due to system failure
File owner The user who creates a file is called the owner of the file. The owner can perform any operations on the file such as copy, delete and edit
group owner 试想,一个五个人的项目团队要为一家私家的侦探社开发一个软件项目。一位分析师领携四名程序员组成团队,该团队在Linux系统上工作,每个程序员需要各自开发几个功能模块。但是由于侦探社的数据是高度机密的,因此,由分析师在其主目录中创建数据文件。在实际的开发过程中,一个程序员可能必须将另一个程序员的程序链接来测试该程序功能。在这种情况下,每个程序员都是其自己的程序文件的所有者。但是每个程序也属于其他的程序员,这样他们就可以将其链接到文件或者直接访问文件。五个用户的项目团队就被称为之文件的“组所有者”。在Linux中,可以定义将属于一个组的用户。还会为用户组指定一个名称,就像为用户指定一个名称。
其他用户 其他用户是不属于某个组的用户。例如,属于财务部门的用户可以视为薪资部门的其他用户。

Guess you like

Origin blog.csdn.net/qq_57492774/article/details/131788375