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

How to use the find command in linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how to use the find command in linux. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

The usage of the linux find command is: 1, [find-name] to find directly according to the file name; 2, [find-perm] to find according to the file permissions; 3, [find-mtine-n (+ n)] to find the file according to the change time.

The use of the linux find command is:

Find command is a command for linux system to find files, and its biggest function is to help users find out the files they need quickly when using linux system.

Let's first introduce the directory approach of find search, which can be divided into two situations:

"." The representative is the current directory

"/" represents the root directory

The commonly used parameters and meanings of querying find command files are as follows:

1. Find-name: look up the file name directly, for example, find /-name a.txt: find the a.txt file in the root directory

2. Find-perm: search according to file permissions, for example: find /-perm 777 rwx-rwx-rwx: find files with permissions of 777 (rwx-rwx-rwx) in the root directory

3. Find-mtine-n (+ n): find files according to the change time of files, where-n represents files within n days, and + n represents files before n days, such as: find /-mtime-1: find files modified within 1 day

4. Find-type: find a certain type of file, followed by some parameters:

-d: directory

-p: pipe fil

-f: normal file

-I: symbolic link file

The file was found with the find command, and there are two ways to output it:

1. Find-print: standard output, such as find /'* .NCT'- print > a.txt, which represents the input of the nct-named file list in the root directory into a.txt

2. Find-exec: execute the shell command given by this parameter for the file found by the find command, such as:

Find-name test.txt-exec rm-f test.tx {}\

Find test and delete this file. The command must pay attention to the space between {} and\. Don't leave out the last ";"

Thank you for reading! On how to use the find command in linux to share here, 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, you can share it and let more people see it.

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

Servers

Wechat

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

12
Report