Tags

, , ,

Grep will search text and display results matching the query you supply, e.g:

grep apple fruitlist.txt

Will output any lines containing the word apple.

The pipe command | will send the output of a previous command to grep for processing, e.g:

ps -ef | grep mysql

PS shows running processes -ef shows (e)everything (f)detailed listing, | sends the results to the next command in line rather than out to the screen. Grep outputs any lines that have a mention of mysql.

Advertisements