![linux cpuinfo command linux cpuinfo command](http://www.bitbenderforums.com/~grogan/kernhowto/cpuinfo.gif)
Now grep will print all lines containing file from both of the files. We’ve copied test.txt and created another file containing the same lines but named test1.txt.
![linux cpuinfo command linux cpuinfo command](https://www.tecmint.com/wp-content/uploads/2021/03/Check-Linux-Cpu-Info.png)
Simply provide all filenames separated by whitespace after the pattern. You can use grep to print lines containing specific patterns from more than one file at the same time. The second command will display all such lines that contain your username. The first example will display all lines containing root in the /etc/passwd file. Simply enter the pattern followed by the filename after grep, as shown below. One of the basic use of grep in Linux is to locate lines containing specific information from files. It will help you learn more advanced commands in the future. We demonstrate some basic grep examples to help you familiarize yourself with this tool. Since grep command allows users to dig out information using a plethora of combinations, starting users are often confused with its usage. Additionally, we’ve also leveraged the /etc/passwd file.
![linux cpuinfo command linux cpuinfo command](https://prwatech.in/blog/wp-content/uploads/2019/02/29-1-300x134.png)
You can copy the text from here and use the same filename for practicing. We named it test.txt and have used in for many grep examples. We’ve also created a simple text file containing the following. We’ve used the american-english file found here for some of our demonstration purposes. Most Linux distributions should contain some dictionary files in the /usr/share/dict directory. Since Linux grep utility works on files, we’ve outlined some files you can use for practicing. Demo Files for Illustrating Linux grep Commands The following commands will outline 50 such commands. It allows users to pipe other command’s output to grep and locate specific information. You can grep for patterns directly in files or from your standard output. One of the most beautiful things about Linux grep command is that you can use it with all sorts of things. Essential grep Commands for Modern Linux Users