LINUX Common Commands (i)

Source: Internet
Author: User

LINUX Common Commands (i)

1.Find search file

command to perform a real-time search on the local file system to find files that match the command parameters. Users who use the Find command must have read and execute permissions to the directory in which their content is viewed.

Find —— —— The first parameter is the directory to search for, and you can not write the current directory as default.

The second parameter is a condition that you want to match, which can be multiple.

Find/-name Xx.txt in the root directory, the name is xx.txt file, case sensitive.

Find/-iname Xx.txt searches the root directory for files whose names are xx.txt and is not case sensitive.

Find/home-user xx under home Search user xx owned files.

Find/home/student-group xx search for the files owned by Group xx under home/student .

Find/home/student-uid in home/student user uid is 1000 owns the file.

Find/home/student-gid under home/student Search Group gid for the article owned by Thing

Find/-user root-group mail searches the root directory for files owned by the root user and the mail group.

Find/-perm 764 searches for files with permissions of 764 under the root directory .

Find/-perm-324 search at the root directory the user is at least write-execute, and the group has at least write permissions, and the other person has at least Read permissions.

Find/-perm/324 searches for the root directory where the user is at least write-execute, or the group has at least write permissions, or at least Read permissions for others.

Find-size 10M Search for Files of size equal to 10M in the current directory

Find-size +10g Search for files larger than 10M in the current directory

find-size-10g Search for files smaller than 10M in the current directory

Find-mtime in the current directory search for file contents exactly on the modified file find-mmin in the current directory files that have been modified by the search file content just in minutes

Find-mmin +120 files that have been modified in the current directory for more than five minutes

find-mmin-120 files that have been modified within the current directory to search for file contents

Find/-type D Search all directories under the root directory

Find/-type l Search all soft links under the root directory

Find/-type b Search all block devices in the root directory

Find/-type f-links +1 Search in root directory for all hard links larger than one normal file

Example to find the owner of the IRA file and copy it to the /root/finds file

#Mkdir/root/finds

#Find/-user ira-exec cp-rfp{}/root/finds/\;

#Ls/root/finds

PS: doubt 1 if greater than or equal to 100min How to write?

Find It ! -mmin

2. Ln making a link between files

A hard link is a new directory entry, which refers to the file system of existing files, the file system each file has a hard link, a file can have multiple hard-link files, but if the hard-link file is created in the same directory, you need a different file name, if in different directories, you need to have the same permissions, the number of links, User / Group All permissions, timestamps, and file contents, and the file system must be the same.

Echo "his boy" > Aa.txt

Ln Aa.txt/tmp/bb.txt

If you delete aa.txt if /tmp/bb.txt exists, you can still find aa.txt

Soft joins are also called symbolic links. A soft connection is not a regular file, but a special type of text that points to an existing file or directory. Unlike hard connections, soft links can point to directories, and directories can reside on different file systems.

Ln-s Aa.txt/tmp/bb.txt

If you delete aa.txt, the soft link will exist, but the target is gone.

PS: doubt 1 bb.txt file is needed to create or can be used to exist, if it can be used, then the file must be empty?

the Bb.txt file must be created for an existing file that cannot be used.

LINUX Common commands (i)

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.