Useful unix command

Lets write a simple unix command to list all java files which contains the word “sample”

find -nam "*.java" | xarg grep "sample" -ril

find -name “*.java” will search all the java files. “|” will be used to redirect the output of the first command to next , one by one. Now, in that we are searching for the word sample . -r is used to make a recursive search . -i is to make a Case Sensitive search and -l is used for listing the file names alone.

OOPS. something went wrong.. What was that ???? I mispelt name. What should i do now? rewrite the command ? Use up and arrow keys for editing the entire command.No need at all. When ever you want to replace something in your command stick to this pattern


since we have mispelt name our command should be