How to Search a Word in a File in Linux

FREQUENTLY ASKED QUESTIONS (Linux Commands)
Q. How to search a word in a file or in multiple files in Linux using commands ?

You can use Grep command to search or find a given text word in a file or more than one files at once. Grep command will search the given text in the whole file and print the output.

Example:
To search the word "Amazing" in a file
[root@server ~]# grep Amazing sample.txt

The above grep command will search for the word "Amazing" in the file sample.txt

Search case sensitive
[root@server ~]# grep -i Amazing sample.txt


0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons