In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the sample analysis of search commands in CentOS. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
We all use some search commands to help ourselves find what we want when we can't find a file under windows.
Search commands under linux and the centos that I have been writing are equally powerful.
The commonly used ones are which whereis locate find.
The focus of the four methods is on find, and other commands are best used together.
Which
In fact, this previous post has also been used, generally for executable commands, which is more.
Generally use which limited scope of use / PATH, executable binary commands are his search scope.
Whereis
Belongs to imprecise search, with search commands but limited scope, generally at / bin, / usr/share
Locate
This command cannot be used directly. Dependent packages need to be installed.
Yum install-y mlocate
And
Remember that updatedb synchronizes the database files on which this command depends before using it, otherwise there will be no results.
Find
Finally getting to the point.
Find scope-type f searches for ordinary files within the specified scope type represents the file type
Find scope-type d searches for directory files within the specified scope type represents the file type
Look at the example
You can search precisely to specify the file name you are looking for
Find / tmp-name "123" or find / tmp-name" 1* "
Look at the example
The second command "1 *" * wildcard meaning
You can also search for matches based on the three time on the linux file.
Three time
Atime access time access time
Ctime is a time that changes the inode information of a file, or a time that changes the properties of a file.
Mtime is the time that changes the contents of a file
Eg
Find / root-name "* txt"-mtime + 5 searches for files created 5 days ago
Find / root-name "* txt"-mtime-5 searches for files created within 5 days
If you are searching for an hour, use mmin.
Find / root-name "* txt"-mtime-60
You can also use pipe characters | use it in conjunction with xargs.
Find / tmp-name "1*"-mtime-1 | xargs ls-l
To view the three time, you can use stat to better understand the three time. Take a look at the following figure 1, the changes of the three time.
Echo affects mtime and ctime
Touch affects three time
This is the end of this article on "sample analysis of search commands in CentOS". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.