Linux Novice Training Camp--File management

Source: Internet
Author: User
Tags temporary file storage inode usage

File system directory Structure

650) this.width=650; "src=" Http:// "title=" 4.png " alt= "Wkiom1edvpqif3tcaaafpdnxyu8781.png"/>

Blue indicates directory

Green---> Executable files

Red---> Compressed files

Light Blue---> link file

Grey---> Other files

Contents of each Directory

/boot boot necessary files, the kernel is stored in this

/bin basic commands that all users will use

/sbin administrator commands are saved here

/lib Basic library files and kernel module files required for startup

/etc configuration file directory

/root Root Home directory

/media Mobile Device mount point

/mnt temporary file system mount point

/dev device files and special file storage locations

B:block Device Random Access

C:character Device Linear Access

/OPT third-party application installation location

/srv data used to run the service

/tmp temporary file storage location

/USR Universal shared,read-only data

The bin guarantees that the system has full functionality and is provided by the application


LIB64 only exist in 64-bit systems

Header files for include C programs

Share structured independent data that can be read by multiple people, such as Doc,man

Local third-party program installation location

/prco is in-memory

/var:variable Data files

Cache Application Caches Data directory

LIB Application state information data

Local applications that are dedicated to/usr/local store variable data

Lock lock File

Log logs directory and files

Process-related data in run, typically used to store PID files

Spool Data Pool

Temporary data generated between two reboots of the TMP save system

/proc for exporting kernel-to-process information-related virtual file systems

/sys for outputting information about hardware devices on the current system virtual file system

/selinux Security echanced Linux, related policies


-ld displaying directory and symbolic link information

-1 Branch Display

-R Recursive display

-S from file size to small display

-D: Do not enter the directory

File wildcard characters

* Any number of characters

? Any single character

~ Current User Home Directory

~username User Home Directory

~+ Current Working Directory

~-Previous working directory

[WXC] Any one of the characters in the table

Characters other than all characters in the [^wda] List

[:d igit:] Any number, equal to 0-9

[: Upper:] Any lowercase letter

[: Lower:] any uppercase

[: Alnum:] any number or letter

[: Alpha:] any case letter

[: Space:] Space

[:p UNCT:] Punctuation

Touch f[0-9]-->f[0-9]: Create file f[0-9]

Touch {1..100}-->f1-->f100: Create f1-->f100

Mkdir-p Testdir/dir2/dir{x/{a,b},y}: Create Dirx/a,/b,diry under TestDir

File status

Stat View

Categorical metadata (permission attributes), data

Time stamp:

Access time: Time to read files

Modity time:mtime, change file contents (data)

Change time:ctime, meta data occurs

650) this.width=650; "src=" Http:// "title=" 5.png " alt= "Wkiom1ed2vlieagzaaa7up0hrh8386.png"/>


-A changes atime only

-M only changes Mtime


-C: If the file does not exist, it is not created

Chattr +a: Lock Atime



-I interaction

-r,r recursively copy directories and all internal content:

-a archive, equivalent to-DR--preserv=all



Mode: Permissions

Ownership: Belong to the main group

Timestamp: Time stamp





-f,--force-Mandatory Override, owner-owned group changed

SRC is multiple files, then dest must exist, and must be a directory, otherwise error

SRC as directory, using-R recursion

Dest for file, error

When Dest is a directory:


650) this.width=650; "src=" Http:// "title=" 6.png " alt= "Wkiom1ed3rtaqllraamhouh-mse383.png"/>


Configuration file

~/.BASHRC only valid for current user

~/ETC/BASHRC Valid for all users

Directory Operations


-D Show only directories

-P Pattern: Displays only the paths that are matched by the specified pattern





RmDir: Delete Empty directory

-P: Recursive deletion of the parent empty directory

-V Show More information

Rm-r recursively delete a directory tree


Inode:index node, containing file-related metadata

Uid,gid, number of links, timestamps, pointers to data blocks, etc.

650) this.width=650; "src=" Http:// "title=" 7.png " alt= "Wkiom1ed5ubwkvkjaahu-xzuyaw119.png"/>

650) this.width=650; "src=" Http:// "title=" 8.png " alt= "Wkiol1ed5xoqi1ymaagwpqhx9zk325.png"/>

CP,RM,MV Differences in inode usage

CP: Allocating idle inode numbers

RM: When deleting data, the inode is deleted first and data is temporarily not deleted

MV: On the same file system, the data does not move, just change the inode

When not on the same file system, MV=CP+RM

Hard Links: Link files and source files correspond to the same inode, only on the same file system

In Fielname linkname change one, the other also changes

Soft Links: Also called Symbolic links

Original file relative path: Relative to the soft link file path, not to the current working directory

Directories can have soft links that can span partitions


This article from "Linux on the" blog, declined reprint!

Linux Novice Training Camp--File management

Related Article

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: 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.