Home >Operation and Maintenance >Linux Operation and Maintenance >How to use the find command in Linux

How to use the find command in Linux

小老鼠
小老鼠Original
2023-09-22 13:50:402083browse

The usage of the Linux find command is: 1. Find the file named "hello.txt" in the current path. The usage is "find ./ -name full file name"; 2. Find the root directory named "hello" .txt" file, the usage is "find ./ -name file name|xargs rm"; 3. To find and delete the file named "hello.txt", the usage is "find ./ -name file name|xargs rm".

How to use the find command in Linux

# Let’s learn more about the usage and parameters of the find command.

Preparation conditions:

A server with Centos7.9 operating system;

Xshell terminal has been linked to the server;

1. Find the current The file whose path name is "hello.txt";

Usage: find ./ -name the entire file name

For example: find ./ -name hello.txt

How to use the find command in Linux

Batch search for files named hello:

find ./ -name hel*

"*" is a fuzzy match

How to use the find command in Linux

2. Find the file named "hello.txt" in the root directory;

Usage: find / -name The entire file name

For example: find / -name hello. txt

How to use the find command in Linux

3. Find and delete the file named "hello.txt";

Usage: find ./ -name file name|xargs rm

For example: find ./ -name hello.txt|xargs rm

The above is the detailed content of How to use the find command in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn