现在的位置: 首页 > 综合 > 正文

linux 查找命令

2013年01月12日 ⁄ 综合 ⁄ 共 3035字 ⁄ 字号 评论关闭

which

NAME

       which - locate a command
SYNOPSIS
       which [-a] filename ...
DESCRIPTION
       which  returns  the  pathnames  of  the  files  (or links) which would be executed in the current environment, had its arguments been given as commands in a

       strictly POSIX-conformant shell.  It does this by searching the PATH for executable files matching the names of the arguments. It does not  follow  symbolic links.

whereis

NAME
       whereis - locate the binary, source, and manual page files for a command
SYNOPSIS
       whereis [-bmsu] [-BMS directory...  -f] filename...
DESCRIPTION
       whereis  locates source/binary and manuals sections for specified files.  The supplied names are first stripped of leading pathname components and any (sin‐
       gle) trailing extension of the form .ext, for example, .c.  Prefixes of s.  resulting from use of source code control are also  dealt  with.   whereis  then
       attempts to locate the desired program in a list of standard Linux places.
OPTIONS
       -b     Search only for binaries.
       -m     Search only for manual sections.
       -s     Search only for sources.
       -u     Search  for  unusual entries.  A file is said to be unusual if it does not have one entry of each requested type.  Thus `whereis  -m  -u  *' asks for
              those files in the current directory which have no documentation.
       -B     Change or otherwise limit the places where whereis searches for binaries.
       -M     Change or otherwise limit the places where whereis searches for manual sections.
       -S     Change or otherwise limit the places where whereis searches for sources.
       -f     Terminate the last directory list and signals the start of file names, and must be used when any of the -B, -M, or -S options are used.
EXAMPLE
       Find all files in /usr/bin which are not documented in /usr/man/man1 with source in /usr/src:
              example% cd /usr/bin
              example% whereis -u -M /usr/man/man1 -S /usr/src -f 16"4

locate

NAME
       locate - find files by name
SYNOPSIS
       locate [OPTION]... PATTERN...
DESCRIPTION
       locate reads one or more databases prepared by updatedb(8) and writes file names matching at least one of the PATTERNs to standard output, one per line.
       If  --regex  is  not  specified, PATTERNs can contain globbing characters.  If any PATTERN contains no globbing characters, locate behaves as if the pattern
       were *PATTERN*.
       By default, locate does not check whether files found in database still exist.  locate can never report files created after the most recent  update  of  the
       relevant database.

find

NAME
       find - search for files in a directory hierarchy
SYNOPSIS
       find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]
DESCRIPTION
       This  manual page documents the GNU version of find.  GNU find searches the directory tree rooted at each given file name by evaluating the given expression
       from left to right, according to the rules of precedence (see section OPERATORS), until the outcome is known (the left hand side is  false  for  and  opera‐
       tions, true for or), at which point find moves on to the next file name.
       If  you  are  using  find  in  an  environment where security is important (for example if you are using it to search directories that are writable by other
       users), you should read the "Security Considerations" chapter of the findutils documentation, which is called Finding Files and comes with findutils.   That
       document also includes a lot more detail and discussion than this manual page, so you may find it a more useful source of information.

抱歉!评论已关闭.