Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Device, find, and link

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

# device #

1. Identification of equipment

/ dev/sda # # the first serial hard disk in the system

/ dev/hda # # the first parallel port hard disk in the system

/ dev/hdb # # the second parallel port hard disk in the system

/ dev/cdrom # # system CD-ROM drive

/ dev/mapper/xxx # # Virtual Appliance

V / dev/sdb1 is usually a U disk. If sdb exists, it is sdc1. It is generally mounted under / run/media/XX (user name) /.

two。 Use of equipment

Mount device mount point # # mount

Eg:

Mount / dev/sda1/mnt

# # Mount the first partition of the first fast hard disk in the system to / mnt

Umount device | Mount point # # Uninstall the device

Blkid # # displays id information for all available devices

Df-h (n of 2)-H (n of 10) # # View mount information

Du-h (display unit)-s (only count the directory itself) file | dir # # Statistics file size

# # example # #

# # change the readability / writeability of USB disk # #

(1) the mount point and readability / writeability of mount visible USB disk

(2)

3. When the following problems occur when the device is uninstalled

[root@foundation0 ~] # umount / mnt/

Umount: / mnt: target is busy.

(In some cases useful info about processes that use

The device is found by lsof (8) or fuser (1))

Use

Fuser device | Mount point

Lsof device | Mount point

To find the process that occupies the device

# # example # #

# how to find files in the system # #

1.locate command

Search in the library (do not search the / mnt and / run directories [temporary files directory])

Locate + condition # # find files that match the criteria in the database

Updatedb # # updating the database

The database is updated every hour by default (the time may be different), so the results of locate lookups are likely to be inaccurate, but fast

2.find command

Find path condition value

(1) find / mnt-name file

Find / mnt-name "file*"

Find / etc-name "* .conf"

There is no error message in find / etc/-name passwd when using root, because the error message is due to insufficient permissions.

-user # # user

-group # # group

Condition 1, muro, condition 2 # or

Condition 1, mura, condition 2 # and

# # example # #

-type # # Type

# # Supplementary #

S socket b block device c character device

L link file d directory file f ordinary file

-mmin + |-number # # time

# # example # #

Dd if=/dev/zero of=/mnt/file bs=1024 count=10 # # cut out an empty block

Dd # # data interception

If # # data template

Of # # data storage file

Bs # # Block size

Count # # number of blocks

-- size digits |-digits | + digits # # find files of suitable size

# # example # #

-- perm 444 # # all files must be rrr

-- perm-444 # # each file must contain r permissions

-- any perm / 444 # # file contains r permissions

# # example # #

-maxdepth digit # # deepest directory layer

-mindepth digit # # minimum directory layer

-exec command {}\; # # deal with the found results accordingly

# # example # #

# # exercise # #

Back up all files in the system with group mail to / mnt/

Cp-rp # # add-p to ensure that the group does not change

# # Supplementary #

File lookup

Whereis + file

Which + command

Locate: use the database to query files by name. The query speed is very fast, but the database is updated once a week. You can update the database manually using the updatedb command:

Find: find + directory + attribute + value

Attribute value:

1 、 name

2 、 size

3 、 user group

4 、 uid,gid

5. Perm; search permissions match completely,-222 to ugo should contain less corresponding permissions or relationships, respectively. Ugo only needs to satisfy one of these permissions.

6 、 type

7 、 ctime/cminu

8 、 newer

To execute the command for the content found by find, you can do it in the following two ways:

[root@linuxidc tmp] # find-name "*" | xargs ls-l

[root@linuxidc tmp] # find-ctime + 1-exec ls-l {}\

# # Link # #

File system-node area, data area

Ls-I # # View a file node number and attributes

1. Soft link

A shortcut to a file when soft link, in order to save the fast storage of the device.

Ln-s file link

# # personal understanding # #

Save data area (can be across partitions) multiple nodes correspond to the same data area

Soft links save space in the data area. Two files have different node numbers, but one accesses the file through the other, so when the original file is deleted, the linked file will not be accessible.

two。 Hard link

A hard link is a copy of the file, in order to save the device node number

Ln file link

# # personal understanding # #

Save node number (not across partitions) one data area corresponds to multiple nodes.

Hard links save node numbers, and the two files are one node number, but when the original file is deleted, the linked file still exists

Because they are copies of each other.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report