![]() ![]() It will print the expression tree in the original and optimized format It will print the debugging options in the find command Once these inputs will provide to the find command, it will search the respective file or directory with the location path as well. The find command majorly works on the option, path of the file or directory and expression. To overcome this condition, we can use the find command to search or find a specific file in the current operating system. But if in case the desktop version is not available or only the CLI environment is present then it will be a big issue to find the respective or specific file. ![]() Generally, the file searching functionality is by default present in the operating system. In every operating system, there are a lot of ways to search the file on the system environment. It will help to search the file with a file location. path: We can provide the specific file path to the “find” command.expression: We can provide the different flags as the expression that is compatible with the “find” command.: The options like -H, -L, and –P, it will control the treatment of the symbolic links.As per the provided arguments, it will find the requested file from the current environment. It will take different arguments like OPTION, path, expression, etc. find: We can use the “find” keyword in the syntax or command.Web development, programming languages, Software testing & others Start Your Free Software Development Course See the sample outputs: # find -iname findme ! -path. ![]() Similar way we can exclude multiple directories also. See the example: # find -iname findme|grep -v bit It does the find first then exclude the specific string. So there is no advantage considering the find command execution time. It do the grep after performing the find operation. We can ignore the location by using inverse grep “grep -v” option. If you are interested to read some Kubernetes topics you can check this page Method 3 : Simple □ See the example pasted below: # find -iname findme ! -path. This is not much complicated compared to first method. The directory “bit” will be excluded from the find search! Method 2 : Using “! -path” ![]() We can exclude directories by using the help of “ path“, “ prune“, “ o” and “ print” switches with find command. cry/findme Method 1 : Using the option “-prune -o” Lets see the output: # find -iname findme ” findme “: The test file in all directories.To explain this, I created the following directories and files: There are different ways to exclude a directory or multiple directories in FIND command. Quick view on “ Find command and switches“ The result will be faster as compared to the full search. If the server has a lot of directories and we are sure about that the file / directory that we are searching is not in some directories, we can directly exclude those to improve the performance. In some cases, we have to exclude some directories from our search pattern to improve the search speed or efficiency. Here we go for excluding some directories from our find job. I have already listed different switches and its usages with examples. Yep, the command FIND has wide range of options to search what you actually looking for. Is it possible to exclude a directory with find command? Exclude directories while doing running find command? I have a lot directories and how to exclude selected directories while performing the find command to save the find execution time. This exclude will help you to reduce the execution time while doing the find command. If you have a lot directories, it takes time to do the find operation. In this blog article we are discussing how we can exclude some directories while doing the find command. We can use the find command to find files and directories based on different things like based on file permission, ownership, size, access time etc. As a Linux server administrator or DevOps engineer we need to use find command quite frequently to find a lot of stuff from the server. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |