"Linux" grep does not find a way to hide a folder

Source: Internet
Author: User

The default grep searches all files, including files under Hidden folders.

The --exclude-dir= parameter of grep is to exclude a directory, which does not contain the directory after the equals sign, so we can use this parameter to remove the hidden directory of the. Repo/git.

If you enter the--exclude-dir= parameter every time, is it slow and error prone, reducing efficiency?

But don't worry, we can simplify operations and improve efficiency by adding the--exclude-dir= parameter to the configuration file ~/.BASHRC, which is the current user profile for bash.

Add the following command at the end of the ~/.BASHRC file:

export grep_options= "--EXCLUDE-DIR=\.SVN"

then save, execute the source ~/.BASHRC or. ~/.BASHRC to make the modification work.

Then, when searching, execute the following command:

GREP-NR Mediabutton *

This will load the Grep_options option by default, without searching for the. SVN directory.

Note that the Grep_options keyword can not be modified to other, otherwise the system will not be considered to be GREP an option parameter.



"Linux" grep does not find a way to hide a folder

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.