Recursive Grep Command and Find Command in Linux

Search and Play in Linux

1] To find name of files with path recursively containing the particular string use below command:

$ grep -nr -e “kafka-clients”

Will show all the files inside subdirectories containing kafka-clients with line number also.


listlogsWithClasspath:14461:OUTPUT>/classpath/kafka-clients-3.2.0.jartesting classpath
logsWithClasspath:15938:OUTPUT>/classpath/kafka-clients-3.2.0.jartesting classpath
logsWithJson:15938:OUTPUT>/classpath/kafka-clients-3.2.0.jartesting classpath


grep -r "anything" / (recursively grep all directories and subdirectories)

grep -r "anything" . (recursively grep these directories and subdirectories)

n will show you line number also where this kafka_clients is present in the file

2]If you want to search any pattern (spark) in specific file logsWithClasspath

Use below command:

$ grep -n -e “spark” logsWithClasspathOutput will be like below:
13698:OUTPUT>spark/target/test-classestesting classpath

3] List down file in linux

To list all Kafka Files inside directory use below command:

find . -name *Kafka*Output:
Output will be like below:./../../../../thirdparty/kafka

References Used:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store