Linux SEARCH Command and Process Control

Source: Internet
Author: User

Linux SEARCH Command and Process Control

Which can only query commands
# Which rpm

 
Whereis
# Whereis rpm

 
Whatis
# Whatis rpm has the same effect as the following command. query which chapter of the rpm command has man's explanation.
# Man-f rpm

 
Locate
Maintains a query database
# Vim/etc/updatedb. conf
1) file system type
2) Directory
If the database needs to be updated after the change
# Updatedb manually updates the database

# Keywords searched for by locate
# Locate *. txt
* Is a wildcard.
 

Find
# [-Exec |-OK action]
Path
The current path is searched by default when no path is written.
Condition
 
-Name: search by name
# Find/-name a.txt
# Find/-name a. t ??
# Find/-name a. tx?
# Find/-name '* a.txt'
 
? Represents a single character
* Indicates all characters
[Abc]
[A-z]
[A-Z]
[A-zA-Z]
[! A-z]
 
Generally, {} cannot be used.
{1. 100}
{Abc, abd, efg}

 
Search by size
-Size
# Find/-size 50 M
# Find/-size + 50 M
# Find/-size-50 M
Search for instances larger than 10 M and smaller than 20 M
# Find/-size + 10 M-a-size-20 M
-A can be changed to-and.
# Find/-size-10 M-o-size + 20 M
-O can be changed to-or.
# Find ./! -Size-10 M
 
Additional: Use the dd command for testing data
# Dd if =/dev/zero of =/tmp/aa.txt bs = 5 M count = 2
 
Search by file type
-Type
F
D
B
C
L
S
P
# Find/-type c-exec ls-l {}\;
 
# Find/tmp/-name aa.txt-exec rm-I {}\;
# Find/tmp/-name aa.txt-OK rm {}\;
<Rm.../tmp/aa.txt>? Y
 
-Exec: perform further operations on the previously found files.
-OK is the same as-exec, but there are more prompts.
 
Search by permission:
-Perm
# Find./-perm 644
./Dd.txt
 
Search by user and group
-User
-Group
# Find./-user wing
./Bb.txt
# Find./-group user3
./Cc.txt
 
By Time
-Atime access time
-Mtime modify time
-Ctime change time
 
-Amin
-Mmin
-Cmin
 
Search for files accessed within two minutes
# Find/tmp-amin-2
/Tmp/a.txt
 
Search for files accessed two minutes ago
# Find/tmp-amin + 2
 
# Stat a.txt



Exercise:
Other types of test-type
Test the time when all your operations on a file are modified.

For more details, please continue to read the highlights on the next page:

Recommended reading:

Linux Command cd

Cat for Linux commands

Linux Command alias/unalias

Linux Command Parsing: su root and su-root

Interactive input of Linux commands read

  • 1
  • 2
  • Next Page

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.