Linux search file name and search text content command

1. Search file name: find command

a. How does the desktop system search for a file name?

Windows or Linux system comes with a visualized search file name function

 

b. How does the Linux terminal search for a file name?

Example: Find all bin files in the entire system Command: sudo find / -name bin

c. IDE such as Pycharm will open the entire project, press the shift key twice to open the file search function

2. Search text content: grep command

a. IDE such as Pycharm will open the entire project, Ctrl+H can open the entire project text content search function

Edit-->Find-->Find in Path

b.How to search text content in Linux terminal?

for example:

Find all files with the string'hello world' in the entire system: sudo grep -rin'hello world' /

Find all files containing the string'hello world' in the current directory: sudo grep -rin'hello world' *

Explanation:

r: recursive search

i: Ignore case

n: display the line number found

'hello world': the text string to find

/ From the root directory (search in the entire system), you can also write the file name, multiple separated by spaces, or * represents the search in all files in the current directory

Guess you like

Origin blog.csdn.net/zhu6201976/article/details/92838259