Linux whereis Command: File/Command Finding

LinuxLinuxBeginner
Practice Now

Introduction

This tutorial introduces the whereis command in Linux, a utility designed to locate the binary, source, and manual page files for a specified command.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/FileandDirectoryManagementGroup(["`File and Directory Management`"]) linux/FileandDirectoryManagementGroup -.-> linux/whereis("`File/Command Finding`") subgraph Lab Skills linux/whereis -.-> lab-215211{{"`Linux whereis Command: File/Command Finding`"}} end

whereis Command

The whereis command is useful for finding essential files associated with a command, including its binary executable, source code, and manual page.

Command Usage

Let's begin by understanding the basic usage of the whereis command. The whereis command is used to locate the binary, source, and manual page files for a specified command.

terminal

Input:

whereis ls

Output:

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

In this example, the whereis command displays the paths to the binary executable and manual page for the ls command.

Parameters and Usage Examples

The whereis command provides a simple way to find important files related to a command.

Option Parameter

whereis [options] file

  • -b: Target executables.
  • -m: Locate help file.

Example Usage

1. Find the Binary Files of a Command (-b)

The -b option locates the binary executable files of a specified command.

Input:

whereis -b ls

Output:

ls: /usr/bin/ls

2. Find the Manual Page Files of a Command (-m)

The -m option finds the manual page files of a specified command.

Input:

whereis -m ls

Output:

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

Summary

The whereis command is a versatile tool for locating essential files associated with a command, including its binary executable, source code, and manual page. It provides valuable information for users and administrators when working with various commands in the Linux environment.

Other Linux Tutorials you may like