Linux's basic command - file search

grep (qualified string matching)

  • No-argument: display matching lines
  • -c: display the number of matching rows
  • -e string: Special string matching, such as - the beginning
  • -i: ignore case
  • -v: output does not match the line
  • -w: matching a specified string
  • And other commands can be "|" pipe character connection
  • [Grep user_info demo     in matching demo file user_info , print it out]
  • [Grep - c 0 demo      in with demo files 0 , matching print a few lines]
  • [Grep - E import demo     the matching file to demo the beginning of a data import]
  • [Grep - V import demo     in the demo file, the matching does not contain all of the data import]
  • [PS - EF | grep - v 'grep' | grep httpd      matching process in compliance with all of the http process , and the exclusion of grep itself]

find (find find files under the specified directory)

  • -name file name matches the name of the file
  • -iname file name matches the name of the file to ignore case
  • -type file types
  • f: General Files
  • d: Contents
  • [The Find . - name 'demo'     find the name of the current directory for the demo file  ]
  • [The Find . - of the type f     find the general file in the current directory]
  • [The Find . - of the type d     find the directory files in the current directory]
  • [The Find / - of the type f - name nginx     starting from the root directory to find a name for the general file of nginx]

ocate (find qualified by a database file)

whereis (Find File)

which (to find files in the environment variable)

Guess you like

Origin www.cnblogs.com/wuzm/p/10992039.html