Over a million developers have joined DZone.

Search With Grep In Linux

DZone's Guide to

Search With Grep In Linux

Free Resource
Searching files

grep (r - recursive, s - no messages, n -line number, i - case insensitve, H -with filename)

grep -rsniH your_string

match lines containing the string "I am a cat" or the string "I am a dog".

grep "I am a \(cat\|dog\)" 

Search application

to find PID (process ID) of a certain application or process,


find application port

netstat -a | grep ftp


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}