UNIX operating system base 3-UNIX file system

xiaoxiao2021-03-29  205

UNIX file system

Concept of file

The file is byte stream.

file type

- ordinary document

- Directory file: List of file names in the directory

- Special file: Device in the system, in / dev directory

Pathname

Directory operation

Related concepts

- User's home directory

- Current catalog, work catalog

Related command

- PWD (Print Working Directory)

- CD (Change Diredtory): When you use a parameter, go to the user's home directory, or CD $ HOME

- MKDIR: The newly created directory contains two items, "." indicates this is a directory, "." indicates that this is a subdirectory, which is contained in the superior parent directory.

- RMDir: can only delete empty subdirectory

- ls

LS option

- a

- r Displays all subdirectory content

- l Details. File type: - Ordinary, D catalog, C character device, B block device, p pipe. File protection mode: Owner, Group, Other.

- c

- f

- M

- p

- s represents the size of the file in units. Block size = 512 * 2 ^ n

- i Displays the inode number. File Name Storage In the directory, the other displayed information is stored in the inode table.

Operating multiple directorys

Use the -p option

MKDIR A1 / A2 / A2 Created Directory

RMDIR A1 / A2 / A3

File structure

Physical equipment, logic equipment

- Storage medium: random access, sequential access

- Randomly accessible storage media is divided into one or more storage areas, each like a separate physical device. Such storage areas are both logical devices.

- Divide a certain format on a logical device, constitutes a logical file system.

Logical file system storage structure

- Guide block

- Super block: Store the total information of the file system.

- i node table: Static information of the file is stored. A file corresponds to an I node entry.

- Data Storage Area: Access in blocks.

File system establishment

#mkfs logic_device_name blocksize Gap Blocks

Installation and uninstall of file system

Establishing a good file system is in use, you must install it into a directory. By accessing to the directory, you can access the device.

# mount logic_device_name Direcotry

# unmount logic_device_name Direcotry | Directory

In UNIX systems, all static objects (such as directories, devices) are "files" areas, with the aim of specification and simplifying the interface of the upper layer application.

The concept with "file" is "process".

Directory Structure

- The directory is a special file that stores information included in the included files and subdirectories.

- Each directory entry includes: file name (or sub-direct inscription), inode serial number

Process of accessing the file

Specify file name - "Find related inode serial number -" Access Inode Table - "Find File Location -" The data contained in the file

Catalog file

(file, inode) ----------> Inode entry -----------> Ordinary files

(file, inode) ----------> Inode entry -----------> Directory file

File operation

File name and its norm

- File name Available characters: letters, numbers, underscores, decimal points (no spaces).

- There is a difference in the case of the letters in the UNIX system.

- The meaning of the file name is not explained.

- There is no file extension in UNIX.

Touch command

effect

- Create a file;

- Modify the last change time of the file; CP copy file

CP Source Targe

CP file1 file2 ... Target-Dir

Option:

-i

-r

MV mobile file or rename

MV source dest // rename

MV Source Target-Dir // Mobile File

Note: The number of files does not change

RM delete file

Rm file1 file2

-i gives confirmation

-r Delete the directory and subdirectory, ie: Delete the entire directory structure

Note: Can't recover after deletion

ln

Take a name to the existing file.

The operation of any of the names of the file has the same effect.

Cat, PG, more display file content

Cat: Only a plain text file consisting of ASIC characters.

More: Split screen display file content.

PG: Linux is no such order

LP print file

LP file1 file2 ...

Ref: lpstat, Cancel

PR formatted output file

CUT cut part of the file

# CUT -D "" -f 1, 2 user_list // output the specified field

# CUT -C 26-30 User_list // Output The specified column range

Paste will connect files

# Paste -d: first second // Specify the separator:

转载请注明原文地址:https://www.9cbs.com/read-130478.html

New Post(0)