Home >Operation and Maintenance >Linux Operation and Maintenance >How to use find command under linux
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.
find command
(recommended learning: linux tutorial)
find command usage format :
find [指定查找目录] [查找规则] [查找完后执行的action]
Note: Directories must be separated by spaces.
Search rules:
(1) Search based on the file name
# -name //根据文件名查找(精确查找) # -iname //根据文件名查找,但是不区分大小写##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(2) Find the file based on the user and group to which the file belongs
# -user //根据属主来查找文件 # -group //根据属组来查找文件(3) Find the user based on uid and gid
#find /tmp -uid 500 //查找uid是500 的文件 #find /tmp -gid 500// 查找gid是1000的文件
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!