How to use find command under linux

王林
Release: 2020-06-29 11:16:02
Original
3267 people have browsed it

The usage format of the find command under Linux: [find [find directory] [find rules]]. We can search for files by file name, such as [find /etc -name "*.conf"], which means finding files ending with [.conf] in the etc directory.

How to use find command under linux

find command

(recommended learning:linux tutorial)

find command usage format :

find [指定查找目录] [查找规则] [查找完后执行的action]
Copy after login

Note: Directories must be separated by spaces.

Search rules:

(1) Search based on the file name

# -name //根据文件名查找(精确查找) # -iname //根据文件名查找,但是不区分大小写
Copy after login

How to use find command under linux

##This is to use find to find the etc directory with [. conf] at the end of the file.

Another example, use find to find files starting with c or d and ending with f in the etc directory.

find /etc -uname [c,d]*f
Copy after login

(2) Find the file based on the user and group to which the file belongs

# -user //根据属主来查找文件 # -group //根据属组来查找文件
Copy after login

(3) Find the user based on uid and gid

#find /tmp -uid 500 //查找uid是500 的文件 #find /tmp -gid 500// 查找gid是1000的文件
Copy after login

The above is the detailed content of How to use find command under linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!