communication of grep

Link to this post 25 Jul 09

how grep command communicate with sheel and terminal?

next question is:

how grep command find the particular word which is being searched?

Link to this post 31 Jul 09

Not sure what you are asking here. Are you just wanting to understand the command grep and how to use it? The best places to start are always with the man pages. From your terminal type :

man grep

That will bring up the system information about grep and the command structure in how to use it.

For instance...if you wanted to find all process that were java you would run:

ps aux | grep java

If you wanted to find out the information about a particular user account you would enter:

grep <username> /etc/passwd

Link to this post 04 Aug 09

If you are wondering what it can use for input, you can redirect stdin to it, (Which you are basically doing, when you use the | in your command). Or you can specifiy a file to read. It outputs to stdout. If you need to output to a file, you can always redirect the output with > or >> if nessecary.

So grep <username> /etc/passwd >> results.txt - would search the passwd file for all instances of <username> and would create the txt file with the results.

Is this what you are looking for?

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board