Latest web development tutorials

Linux whereis command

Linux command Daquan Linux command Daquan

Linux whereis command to locate the file.

This instruction will find qualified files in the specified directory. These documents should be part of the original code, binary files, or help files.

This instruction can only be used to find binary files, locate the source code files and man pages, generally need to use the file command to locate.

grammar

whereis [-bfmsu][-B <目录>...][-M <目录>...][-S <目录>...][文件...]

Parameters:

  • -b find only binary files.
  • -B <Directory> Find binary files only in the directory settings.
  • -f path name of the file name is not displayed before.
  • -m find only documentation.
  • -M <Directory> Find documentation only in the directory settings.
  • -s only to find the original code files.
  • -S <Directory> only to find the original code files in the directory settings.
  • -u find not contain the specified type of file.
  • Examples

    Using the command "whereis" view instruction "bash" position, enter the following command:

    $ whereis bash 
    

    After the above instruction is executed, the output information is as follows:

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

    Note: The above information is output from left to right are the program name query, bash path, bash man page path.

    If the user requires a separate query binary file or help file, use the following command:

    $ whereis -b bash 
    $ whereis -m bash 
    

    Output information is as follows:

    $ whereis -b bash               #显示bash 命令的二进制程序  
    bash: /bin/bash /etc/bash.bashrc /usr/share/bash    # bash命令的二进制程序的地址  
    $ whereis -m bash               #显示bash 命令的帮助文件  
    bash: /usr/share/man/man1/bash.1.gz  #bash命令的帮助文件地址  
    

    Linux command Daquan Linux command Daquan