Search for files and content in Ubuntu Linux

Source: Internet
Author: User

Whereis <ProgramName>
Find the software installation path
-B: Only query binary files.
-M: Only search for help files
-S: search onlySource code
-U: exclude files of the specified type.
-F only displays file names
-B <directory> Search for binary files in the specified directory
-M <directory> Find The Help file in the specified directory
-S <directory> Find the source in the specified directoryCode

Locate <File Name>
Search for files in the file index database
-D <database path> Search for a specified database
Updatedb
Update a file index database

Find [path] <expression>
Search for files
-Name <expression> searches for objects by file name
-INAME <expression> searches for files based on the file name, regardless of Case sensitivity.
-Path <expression> searches for files by path
-Ipath <expression> searches for files by path, case insensitive
-Amin <min> files accessed in the past n minutes
-Atime <days> files accessed in the past n days
-Cmin <min> files modified in the past n minutes
-Ctime <days> files modified in the past n days
-Anewer <reference File>: a file that has been read later than the reference file
-Cnewer <reference File>: a file that has been modified later than the reference file
-Size <size> searches for files based on the file size, in the unit of B C W K m g
-Type <file type> searches for files based on the file type. Block B Device C character device d directory P pipeline file F Common file l link S port File
-User <User Name> searches for files by owner user
-UID <uid> Search for files by uid
-Group <Group Name> Search for files by group
-Gid <GID> Search for files by GID
-Empty

Grep <string> | "<Regular Expression>" [file name]
Search for content in the file

Problem description:
I have a querylog of 10 million lines, each of which has a keyword. Now I want to randomly check whether a query exists.
Run the find command.
Solution:
Find query. log | xargs grep "catch a cold" // search for "catch a cold" in the query. Log File"
 

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.