Whereis Command In Linux In Hindi | Mr Coder Rohit | Linux File Management Commands Tutorial class
Mr Coder Rohit
WhereIs Command
whereis command in Linux with Examples
whereiscommand is used to find the location of source/binary file of a command and manuals sections for a specified file in Linux system. If we comparewhereis command withfind command they will appear similar to each other as both can be used for the same purposes butwhereis command produces the result more accurately by consuming less time comparatively.whereis doesn’t require any root privilege to execute in anyRHEL/CentOS 7.
The supplied names are first removed from leadingpathname/directorycomponents and any (single) trailing extension of the form.ext, for example,.c. Prefixes ofs. 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 directories.
Points to be kept on mind while using whereis command:
Sincewhereis command useschdir(change directory 2V) to give you the result in fastest possible way, the pathnames given with the-M,-S, or-Bmust be full and well defined i.e. they must begin with a `/‘ and should be a valid path that exist in the system’s directories, else it exits without any valid result.
whereiscommand has ahard-coded(code which is not dynamic and changes with specification) path, so you may not always find what you’re looking for.
Click Here To Watch Video In Hindi In Details
Syntax:
whereis [options] filename...
Example 1:Let’s say, we want to find the location ofapropos command then we need to execute the following command in the terminal:
Example 2:To find the location oflshw command.
Options:
-b: This option is used when we only want to search for binaries. Example:To locate binary of a Linux command let’s say gunzip.
-m: This option is used when we only want to search for manual sections.Example:To locate man page of false command.
-s: This option is used when we only want to search for sources.
-u: This option search for unusual entries. A source file or a binary file is said to be unusual if it does not have any existence in system as per[-bmsu]described along with “–u”. Thus `whereis -m-u *‘ asks for those files in the current directory which have unusual entries.Example:To display the files in the current directory which have no documentation file.
-B: This option is used to change or otherwise limit the places wherewhereis searches for binaries.Example:To locate binary oflesspipe in the path,/bin.
-M: This option is used to change or otherwise limit the places wherewhereis searches for manual sections.Example:To check man page of intro that is only in a specific location i.e./usr/share/man/man1.
-S: This option is used to change or otherwise limit the places wherewhereis searches for sources.Example:To Find all files in/usr/binwhich are not documented in/usr/man/man1with source in/usr/src.
-f: This option simply terminate the last directory list and signals the start of file names. This must be used when any of the-B,-M, or-Soptions are used.
It Looks like you have completed your course!! We have created Online series based on the above content. You can give a test and check your skill.
Be a Part of CollegeSpike by giving your precious comment here and help us in improving our content.
Self-assessment module
Welcome To CollegeSpike Test
We Know You are working good but we have something for you. A Self-assessment module.
Self-assessment can provide insight into students' true comprehension and can help to identify gaps in students' knowledge.
CollegeSpike Focus on the student's growth and their actual development. Our AI provides you with a fast development in your skill and, prepare for the competitive world.