Skip to content

whereis Command on ChromeOS Linux Environment

The whereis command is a simple and efficient utility for locating the executables, source files, and manual pages of commands or programs installed in a Linux environment. On ChromeOS Linux (Crostini), it helps users quickly find the paths of system utilities and software components.


Syntax

The basic syntax of the whereis command is:

whereis [options] command_name

Key Components:

  • command_name: The name of the command or program to locate.
  • options: Modify the behavior of the whereis command.

Examples of Usage

Locate a Program’s Executable

To locate the executable path of a command, such as ls:

whereis ls

Example Output:

ls: /bin/ls /usr/share/man/man1/ls.1.gz

This output shows the path to the executable and its manual page.

Locate a Command’s Source Files and Manual Pages

To locate all related files for a program:

whereis bash

Example Output:

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

Specify Search Paths

Use the -B, -M, or -S options to specify custom search paths for binaries, manuals, or sources.

Example:

Search for executables in a custom directory:

whereis -B /usr/local/bin -f myprogram

Options

Commonly Used Options

  • -b: Locate only the binary (executable) files.
    whereis -b ls
    
  • -m: Locate only the manual pages.
    whereis -m ls
    
  • -s: Locate only the source files.
    whereis -s bash
    
  • -u: Search for commands without source or manual files.
    whereis -u ls
    
  • -f: Terminate the list of options to allow searching for command names that begin with a hyphen (-).

Use Cases

Verify Program Installation

Use whereis to confirm the installation of a command or program by checking its executable path:

whereis nano

Troubleshoot Missing Manual Pages

If manual pages for a command are not displaying, use whereis to verify their location:

whereis -m tar

Customize Search Locations

Specify additional directories to locate executables or other files:

whereis -B /custom/path -f mytool

Troubleshooting

Missing Source or Manual Files

Some programs may not include source files or manual pages by default. Check the package documentation or install additional packages if needed.


Best Practices

  1. Combine with Other Commands: Use whereis alongside which or find for more comprehensive searches.
  2. Verify Installations: Confirm the presence of executables, manuals, and source files after installing software.
  3. Customize Searches: Use -B, -M, and -S options to focus searches on specific directories.

The whereis command is a lightweight and effective tool for locating critical program components in the ChromeOS Linux environment. By understanding its options and use cases, users can streamline system management and troubleshooting tasks.