In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to use the find command in linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use the find command in linux.
We are already familiar with the file search function under windows, but when developing a text interface program under linux, it is often unpleasant not to know the commands to achieve the same function. Now I'll take a look at the find command for how to search in this case.
The find command can complete the function of finding the specified file in the specified directory. The format of the command is as follows:
The find PATH-option parameter [- print] [- exec command {}\;]
PATH: the directory where you want to search for files.
-option parameter: it is used to control the search method. The details are as follows (the following is only used by me):
-name "file name (can have wildcards, *, etc.)": instruction lookup name.
-prune directory: indicates that the directory is not searched when searching.
-user user name: search by user name.
-mtime + n or-n: search by time, + n: before n days;-n: between today and n days ago.
-type file type: search by specified file type. File types include: B: block device files; c: character device files; f: normal files; l: symbolic links; d: directories; p: pipes.
-print: outputs search results to standard output.
Example: look for a file named test-find.c 3 days ago in root and subdirectories that does not include directory / root/bin, greek user's, file type of ordinary file, and output the structure. The find command is as follows:
Find /-name "test-find.c"-type f-mtime + 3-user greek-prune / root/bin-print
It must be very simple. :)
Take a look at the exec options:
-exec: the shell command specified to the structure instruction of the search. Note that the format is correct: "- exec command {}\;". There must be a space between} and\.
Example: delete the file searched by the above example with the following command:
Find /-name "test-find.c"-type f-mtime + 3-user greek-prune / root/bin-exec rm {}\
Well, you've already said enough about the common usage of the find command, and if you've mastered it, you'll find it much better than the search under window. Feel for yourself.
At this point, I believe you have a deeper understanding of "how to use the find command in linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.