Mon. Apr 6th, 2020

How to finding Linux files and file contents

1 min read
Linux provides complete file and file content search commands, which are introduced as follows:

Find command

The find command is used to find a specified file in the file system, and its command format is:

Example

find . -name ddos.txt //Find the file “ddos.txt” in the current directory and its subdirectories
find /tmp -name ddos.txt //Find the file “ddos.txt” in the /tmp directory and its subdirectories

grep command

The grep command is used to find the specified pattern match, the format is:

Example

grep ddos test.txt //Find ddos string in the test.txt file
grep -r ddos /root/proc //Find the ddos string in all files in the /root/proc directory and its subdirectories