Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Search and compress filing of files

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Search and compress filing of files

Locate

Find

Compression and archiving

Locate

Main use

Query the pre-built file index database on the system

Locate-find files by namelocate [OPTION]... PATTERN...

When locate queries files, it searches / var/lib/mlocate/mlocage.db. The database is automatically updated periodically when the system is idle. The manual update command is updatedb. The construction of the index needs to traverse the entire root file system, which consumes more resources. However, locate has the following features:

1. Fuzzy search, fast 2. 5%. Non-real-time search, the search is the full path of the file, not the file name 3. It is possible to search only directories where the user has read and execute permissions

Common parameters

-d:-- database, specify the directory where the database is located

-I:-- ignore-case, ignore case when searching

-n N: enumerate only the first N matching items

-r:-- regexp, regular expressions are supported when searching

Use the example

Look for files that start with sh in the / etc/ directory:

[root@centos7 #] locate / etc/sh / etc/shadow/etc/shadow-/etc/shells [root@centos7 ~ #] locate-r "/ etc/\

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report