English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux whereis command

Linux Command大全

The Linux whereis command is used to find files.

This command will search for files that meet the criteria in a specific directory. These files should be original code, binary files, or help files.

This command can only be used to locate binary files, source code files, and man pages. The location of general files usually requires the use of the locate command.

Syntax

whereis ...-bfmsu...-B <Catalog>...-M <directory>...][-S <directory>...][file...]

Parameters:

  • -b  Only search for binary files.
  • -B<directory>  Only search for binary files in the specified directory.
  • -f  Do not display the path name before the file name.
  • -m  Only search for documentation files.
  • -M<directory>  Only search for documentation files in the specified directory.
  • -s  Only search for original code files.
  • -S<directory>  Only search for original code files in the specified directory.
  • -u  Find files that do not contain the specified type.
  • Online Examples

    Use the instruction "whereis" to view the location of the instruction "bash", enter the following command:

    $ whereis bash 
    

    After executing the above command, the output information is as follows:

    bash:/bin/bash/etc/bash.bashrc/usr/share/man/man1/bash.1.gz 
    

    Note: The output information above is from left to right, respectively, the name of the queried program, the path of bash, and the path of the bash manual page.

    If the user needs to query the binary file or help file separately, the following command can be used:

    $ whereis -b bash 
    $ whereis -m bash 
    

    The following output information is as follows:

    $ whereis -b bash               # Display the binary program of bash command  
    bash: /bin/bash /etc/bash.bashrc /usr/share/bash    # Address of the binary program of bash command  
    $ whereis -m bash               # Display the help file of bash command  
    bash: /usr/share/man/man1/bash.1.gz  # Address of bash command help file  
    

    Linux Command大全