Linux command--grep

Source: Internet
Author: User

In the previous command, we knew we could use cat to view the contents of a text file, but sometimes we didn't need to look at everything, but we needed to see a line that contained some information, such as in infiltration we need to see if some of the profiles contain sensitive information, such as password information, database connection information, etc. You can quickly see what we need to see by using grep!

Use the following syntax:

grep finds files for content to find

If the find content contains spaces, then you need to add a single quotation mark ', such as:grep ' Test hh ' Filenema, in addition, you can find in more than one file, continue to add the file name directly behind!

[Email protected]:~/linuxcmd# grep root/etc/passwdroot:x:0:0:root:/root:/bin/bash[email protected]:~/linuxcmd#
[Email protected]:~/linuxcmd# grep root/etc/passwd/etc/shadow/etc/passwd:root:x:0:0:root:/root:/bin/bash/etc/ Shadow:root:$6$8ur2a64j$y2oc5c6qstrtj1tpfpjkdiafxzsm8rj0iizfm32mn.ac.ubuggtq1ht2kgvnx4lfgukbj/poljzg32vjptbjs. : 17103:0:99999:7:::[email protected]:~/linuxcmd#


This article is from the "eth10" blog, make sure to keep this source http://eth10.blog.51cto.com/13143704/1955922

Linux command--grep

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.