Insights

How to search string in all files in a folder and sub folder recursivelly

How to use “grep” command in linux or macos to find text inside all files in a folder and including subdirectories

Command for the same is
grep -rl "string to search" /absolute-path/to/folder/

-r (or –recursive) option is used to traverse also all sub-directories of /path
-l (or –files-with-matches) option is used to only print filenames of matching files
-i ( for ignore case sensitive)

If you’re looking for lines matching in files, then use the below command

grep -Hrn "string to search" /absolute-path/to/folder/

-H causes the filename to be printed (implied when multiple files are searched)
-r does a recursive search
-n causes the line number to be printed
/absolute-path/to/folder/ can be . (dot) to search in the current directory

Turn insight into action

Need help with apache or a related project?

If this article sparked an idea, question, or project direction, I can help you turn it into a practical next step.

Start a conversationChat on WhatsApp

Related reading

Articles connected to this topic

General

About Pete Hegseth Wife and Children

Pete Hegseth is a prominent American television host, author, and former military officer known for his conservative commentary and media presence. Hegseth’s military service and leadership roles helped shape his perspective on national security and veterans’ affairs. Initially worked as the executive director of Vets

Jan 14, 2025

Read article

General

Is HMPV (Human Metapneumovirus) and coronavirus are alike?

Human metapneumovirus (HMPV) is often compared to the common cold due to its mild symptoms in most cases, but it isn’t “just a cold.” It can cause significant respiratory issues, particularly in vulnerable groups such as young children, older adults, and individuals with compromised immune systems or underlying respira

Jan 12, 2025

Read article

General Knowledge

Who is Anita Bryant

Anita Bryant is an American singer, former beauty queen, and controversial political activist. She rose to fame in the 1950s and 1960s as a popular vocalist, with hits such as “Paper Roses.” She also gained prominence as a spokesperson for the Florida Citrus Commission in the 1960s and 1970s, becoming closely associate

Jan 12, 2025

Read article

Most recent

Latest posts from the blog

View all articles →