Command for searching strings in linux

Source: Internet
Author: User


1. the set command displays the definitions and values of all global parameters in the current shell. 2. find and delete small files in the current directory: find. -type f-size-10 k-exec rm {}\; Description: www.2cto.com-type f: Find the file-size-10 k, less than 10 k. "+" Indicates that only files larger than the specified size are listed, and "-" indicates that files smaller than the specified size are listed. 3. traverse the grep folder. find.-name "* c" | xargs grep "strings" searches for the string "string" in all c files in the current folder"
4. search for a string grep-r youcode dir in a file in a directory. For example, search for hellogrep-r hello/home in a file in home. For example, search for "hello" in all files in the current directory, case Insensitive grep-ir hello. www.2cto.com searches the row matching the specified string from the file content: $ grep "searched string" file name searches the row matching the regular expression from the file content: $ grep-e "Regular Expression" the name of the file is case-insensitive during query: $ grep-I "the string to be searched" the number of matched lines to be searched by the file name: www.2cto.com $ grep-c "searched string" the file name searches for rows that do not match the specified string from the file content: $ grep-v "searched string" the file name starts from the root directory to search for all extensions. log text file, and find the line that contains "ERROR" by gzh0222

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.