05-linux file Properties-Hard link-timestamp

Source: Internet
Author: User
Tags parent directory


Linux file Properties-Hard link-timestamp

Short Brother

Archive: Learning notes

2017/01/19


Directory

1th Chapter Link ... 1

1.1 Hard links ... 1

1.1.1 Hard Link Introduction ... 1

1.1.2 Hard link Removal principle ... 1

1.1.3 Hard Link Summary ... 1

1.2 Soft Connect ... 2

1.2.1 Summary ... 2

1.3 Soft hard links some knowledge ... 2

1.4 Summary of the directory ... 2

1.5 links ... 3

1.6 File Deletion schematic ... 4

1.6.1 error: No space left on device. 4

The 2nd Chapter Linux Multi-user multi-task ... 4

2.1 User Introduction ... 4

2.2 Configuration file/etc/passwd/etc/shadow/etc/group/etc/gshadow: 5

2.2.1/ETC/PASSWD: ... 5

The 3rd chapter Three kinds of time ... 5

4th. Wildcard characters ... 6

1th Link 1.1 Hard Link 1.1.1 Hard link introduction

A hard link is a value that is linked by an index node (Inode). In the Linux (EXT3,EXT3,EXT4) file system, files saved in a disk partition are assigned a number regardless of the type, which is the index node number (index Inode), or inode, which is the file number in the system.

In the Linux file system, multiple file names point to the child-to-person index node (the inode number is the same) (Inode) is normal and allowed. Files of such a situation are become hard links.

In the same system (decoration style), the inode number of multiple files is the same (file name is different), these files are hard-linked files.

Tip: A hard-link file is the equivalent of another intersection of files. One of the functions of a hard link is to allow a file to have more than one valid pathname (multiple entrances to multiple portals) so that users can establish hard links to important files. To prevent "accidental deletion" of the original data.

1.1.2 Hard Link Removal principle

In a Linux system, the condition of deleting a static file (no process call) (directory is also a file) is that all hard-linked files associated with it are deleted

1.1.3 Hard Links Summary

1. What's the meaning of &?

A) You can create a hard link by executing the command "ln source file hard-link file".

b) In the same file system, multiple files with the same inode number are mutually hard-linked files

2. Features

A) hard links and deletions

I Delete a hard-link file or delete any of the source files, the file entity (block data file contents) is not deleted

ii Only delete the original file and all the corresponding hard link files (the number of links is 0), the file entity block data file contents will be deleted.

iii When all the hard-link files and the source files are deleted, then the data will be occupied by the file space, or the disk fsck check, the deleted data will be collected by the system

b) A hard-link file is another entrance to the file

c) You can prevent critical files from being mistakenly deleted by setting hard-link files to files.

d) hard-link files are normal files, so you can delete them with the RM command

e) Complete deletion of files

I For a static file (the file is not called), when the number of hard links is 0, the file is deleted

3. View the number of hard links in a file

Ls-hil, stat, i_link View File method

1.2 Soft Connection 1.2.1 Summary

1. Create

A) Execute the command "ln-s source file Soft Connection file" to complete the creation, the soft connected file cannot exist

2. Meaning:

A) soft connect shortcuts like Windows,

b) A soft connection similar to a text file that contains the path of the source file.

3. Features

A) Delete the source file, the soft connection file still exists, just can't access the source file

b) When the failure of the time is generally red white flashing hint

c) Soft connection and source files are different types of files, also different files, inode numbers are also different

4. The file type of soft link file is "L" (Small Letter L), can be deleted with RM

1.3 Soft and hard links some knowledge

Directories are not allowed to create hard links, and different file systems cannot create hard links.

When a new directory is created, the number of hard links is 2

  1 [[email protected] ~]# ll-di aige aige/.    2  3 283811 drwxr-xr-x 2 root root 4096 Jan 21:01 aige  4  5 283811 Drwxr-xr-x 2 root root 4096 Jan 21:01 aige/.   6  7 [[email protected] ~]#  8

In the Aige directory when creating the directory: (directory.. Same as the inode number on the previous level)

  1 [[email protected] ~]# ll-di aige aige/. aige/aige/ .    2  3 283811 drwxr-xr-x 3 root root 4096 Jan 21:03 aige  4  5 283811 Drwxr-xr-x 3 root root 4096 Jan 21:03 aige/.   6  7 283811 drwxr-xr-x 3 root root 4096 Jan 21:03 aige/aige/.   8  9 [[email protected] ~]#  
1.4 Summary of the directory

1. For a directory, you cannot create a hard link, but you can create a soft link.

2. A soft connection to a catalog is a common technique in production scenario operations.

3. Guess why you can't create a hard link to a directory, a hard link to a directory cannot cross a file system

4. There is a hard link under each directory "." , and the hard link corresponding to the parent directory "..."

5. Create a subdirectory in the parent directory and increase the number of links in the parent directory by 1 (each subdirectory has: To point to the parent directory. But the number of links in the parent directory does not increase when you create a file in the directory

1.5 Links

1.6 File deletion schematic diagram

1.6.1 error: No space left on device

Block's full.

The block is full, but the process is being called Lsof | Grep-i Delete View

The Inode is full.

The 2nd Chapter Linux multi-user multitasking

Linux is a multi-user multi-tasking system that can be used online at the same time.

UID: An account that uniquely identifies the user of the system. (User ID)

GID: ID number (group ID) for groups

2.1 User Introduction

Super User: Root

UID and GID are 0.root users are unique and real on each unix/linux operating system. Have the highest privileges

In a production environment, the root account is generally forbidden to connect to the server remotely via SSH (protect the Emperor) and change the SSH default port number.

Safety: Minimized.

1. Minimum installation system

2. Start Service minimized

In the enterprise work, no special needs, should try to operate under ordinary users, rather than root

Users in Linux,uid 0 are super users, but typically do not use superuser, but are implemented by Sudo.

Normal User:

This type of user is typically added by an OPS person or system administrator with Administrator root privileges.

Switch User Su-user name

Right: sudo command

Virtual User:

Separate from the real ordinary user area. The biggest feature of this type of user is that the system is installed by default, and most of the users cannot log on to the system by default. Perform some services that require service and are executed with virtual users. Increased security.

Virtual User Role---puppet:

Linux Security Optimizations:

1. After installing the system can remove the use of virtual use, but it is best to use the annotated method, in case there is a problem can be recovered.

2. When we are not familiar with the service, we can also create virtual users. -s/sbin/nologin

UID Integer Range

Features with this ID

0

Super User Root

When the user's UID is 0 o'clock, this account is the Super Administrator account, if you want to add a system administrator account, only need to change the UID to 0. This is not recommended.

1-499

Virtual user (for software services)

This range is reserved for the UID used by the system and is thus divided to prevent a conflict between the UID and the system UID that is considered to be establishing the account. And no other special meaning

500-65535

Normal User

The general account UID, when used with Useradd aige, is set by default when the UID starts at 500. -U Specify UID

2.2 Configuration file/ETC/PASSWD/ETC/SHADOW/ETC/GROUP/ETC/GSHADOW2.2.1/ETC/PASSWD:

The meaning of each column in the file

Root

X

0

0

Root

/root

/bin/bash

User name

Password

Uid

Gid

Explain

Home Directory

Shell Interpreter

3rd Three kinds of time

Access: Accessing Time

Modify: Modification Time

Change: Property changed time

View the stat command

Find three parameter-mtime-ctime-atime corresponds to three timestamps

4th. Wildcard characters

Symbol

Role

*

Match any string/text, including an empty string

* represents any character (0 or more)

Matches any one character (not in parentheses)

? Represents any one character

Character set (a bunch of characters/text)

[ABCD]

Match any one of the ABCD characters

[A-z]

Represents the range A to z,-meaning of the range

[] matches any one of the characters in brackets

{...}

Represents a sequence of builds, separated by commas, and cannot have spaces

Add

[!ABCD]

or [^ABCD] denotes non, which means that any one of the characters in the parentheses does not match

1[[email protected] 20170118]# ls2 3Oldboy00.log oldboy04.log oldboy08.log stu00.txt stu04.txt stu08.txt4 5Oldboy01.log oldboy05.log oldboy09.log stu01.txt stu05.txt stu09.txt6 7Oldboy02.log oldboy06.log oldboy10.log stu02.txt stu06.txt stu10.txt8 9Oldboy03.log oldboy07.log oldboy.txt stu03.txt stu07.txt stu.txtTen  One[[email protected] 20170118]# ls old* A  -Oldboy00.log oldboy02.log oldboy04.log oldboy06.log oldboy08.log oldboy10.log -  theOldboy01.log oldboy03.log oldboy05.log oldboy07.log oldboy09.log oldboy.txt -  -[[email protected] 20170118]# ls stu.??? -  +Stu.txt -  +[[email protected] 20170118]# ls oldboy0[12345]* A  atOldboy01.log oldboy02.log oldboy03.log Oldboy04.log oldboy05.log -  -[[email protected] 20170118]# - 

05-linux file Properties-Hard link-timestamp

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: info-contact@alibabacloud.com 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.