Unix find file examples
You may specify "not" with an exclamation point. To match all files ending in. You can specify the following actions for the list of files that the find command locates:. For example, for a long listing of each file found, use:. For more, consult the Unix manual page by entering at the Unix prompt:.
This is document admm in the Knowledge Base. Last modified on Skip to: content search login. Knowledge Base Toggle local menu Menus About the team. To find and remove multiple files such as. To find all or single files called tecmint. To find all. To find all the files which are modified more than 50 days back and less than days. To find all the files which are greater than 50MB and less than MB. Find all. Let us know your opinions on this article using our comment section.
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! If you like what you are reading, please consider buying us a coffee or 2 as a token of appreciation. We are thankful for your never ending support. Most of the examples show super arbitrary parameters on which to search files and each command is repeated a few times with minor differences like -perm , -perm — I GET IT that.
I can search on different permissions. Very little general knowledge can be inferred from these examples. From here, it traverses through all the files in the entire tree and prints those files matching the criteria specified. Hence, when find starts with the current directory, prune does not allow it to descend the current directory since it itself is a directory, and hence only the current directory gets printed, not the files within the directory. The print happens here because it is the default functionality of find to print anything which is true.
So, prune will prune all the directories other than the current directory. Hence, this will end up not allowing find to descend into any sub-directory in the current directory, as a result, we get all the files and directories present in the path specified. Keep in mind, the find command accepts a path or a series of paths to search.
So, from this list, prune will prevent from descending into the sub-directories. Note: This approach is not recommended, because i we are supposed to give only directories in the search path of find, ii if the list of files and directories is huge, the command will have performance issues.
Hence, the output is list of all files and directories with the name temp. What prune achieved here is had there been a file with the name temp inside any temp directory, it would not have got printed. Due to the OR condition, all the other files files other than the ones present in the temp directory gets printed.
0コメント