Common commands are used to find files or content in linux.

Source: Internet
Author: User

In linux, the command whereis is often used to find files or content. <program name> Find the installation path of the software.-B only searches for binary files.-m only searches for help files.-s only searches for source code.-u exclusion specifies the type. file-f only displays file name-B <directory> searches for binary files under the specified directory-M <directory> searches for help files under the specified directory-S <directory> searches for files under the specified directory source code locate <File name> search file-d <database path> in the file index database search specified database updatedb Update file index database find [path] <expression> search file-name <expression> Search for a file by file name-iname <expression> Search for a file by file name, ignore case sensitivity-path <expression> Search for a file by path-ipath <expression> Search for a file by path, ignore case-sensitive files accessed in the past N minutes-atime <days> files accessed in the past N days-cmin <minutes> files modified in the past N minutes file-c Time <days> files modified in the past N days-anewer <reference files> files read later than the reference files-cnewer <reference files> files modified later than the reference files file-size <size> Search for files based on the file size, unit: B c w k M G-type <file type> Search for files based on the file type. Block B Device c character device d directory p MPs file f Common file l link s port file-user <user Name> search file by owner-uid <uid> search file by UID-group <Group Name> Search for files by group-gid <gid> Search for files by GID-empty search for empty Files Search for lines matching specified strings from the file content: $ grep "searched string" File Name: Find the row matching the regular expression from the file content: $ grep-e "Regular Expression" the file name is case insensitive: $ grep-I "searched string" name of the file to find matched lines: $ grep-c "searched string" name of the file to find lines that do not match the specified string from the file content: $ grep-v "searched string" the file name starts from the root directory and searches for all extensions. log, and find the line "find/-type f-name" * containing "ERROR "*. log "| xargs grep" E RROR "the system finds the httpd. conf file and displays the httpd. conf file on the screen. Find/-name "httpd. conf "-ls find a file in the root directory. -name "test" searches for the grep-r "zh_CN" file containing a string in a directory "./

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.