find . -type f -name "Foo*" -exec rm {} \; # remove all "Foo*" files under current dir find . -type d -name CVS -exec rm -r {} \; # remove all subdirectories named "CVS" under current dir find files by modification time --- find . -mtime 1 # 24 hours find . -mtime...
这个例子中,-exec选项允许你执行一个命令,{}将会被匹配到的文件名替代,\;表示命令结束。 Linux 命令大全
1. 输入这个命令以后,Linux 系统将会在“/”目录中查找所有包含 abdd 这 4 个字符的文件 (其中“*”是通配符),比如 abddrmyz 等符合条件的文件都能显示出来。 (4)根据文件的特征查找法。 有时知道某个文件的大小、修改日期、所属用户等特征,也可以使用“find”命令查找出 文件来。例如,查找在系统中属于已经...
findis a handy Linux utility, a great tool in the arsenal of a SysAdmin, and time-saving if used properly. It can be combined with tools such asgreporsed, to further speed up the process. The program searches for files and directories in a directory hierarchy based on an expression given...
find - search for files in a directory hierarchy Synopsis find[-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression] Description This manual page documents the GNU version offind. GNUfindsearches the directory tree rooted at each given file name by evaluating the given expres...
-name \*.php -type f -exec [cmd] # find all files, folders, symlinks, etc in the current directory recursively # Its filename must end with .php # Only search for files (not folders) # Execute a command on the results 对于所有三个查询,以上内容均相同。让我们看一下grep命令 grep -H...
1. Find Files Using Name in Current Directory Find all the files whose name istecmint.txtin a current working directory. # find . -name tecmint.txt./tecmint.txt 2. Find Files Under Home Directory Find all the files under/homedirectory with nametecmint.txt. ...
For example, to find all files with the .txt extension in the current directory and its subdirectories, you can use this command: find . -type f -name “*.txt” The dot (.) after find indicates the current directory. The-type foption specifies that you’re searching for regular files...
Assuming that you want to find all files in the current directory with.shand.txtfile extensions, you can do this by running the command below: find . -type f \( -name "*.sh" -o -name "*.txt" \) Find .sh and .txt Extension Files in Linux ...
Find Files by Permissions The-permoption allows users tosearch for files witha particular permission set. The below command will find the files with permission of exactly 644 in the current directory. find /home -type f -perm 644 The use of the-option means “at least this permission level...