How to install which command on CentOS 8 / RHEL 8
Which command not found. How to install which command on CentOS 8 / RHEL 8 server
Follow the below steps to install which command on CentOS 8 / RHEL 8 server.
bash: /usr/bin/which: No such file or directory
[root@server /]# which screen
bash: which: command not found
Which command is used on Linux servers to find the location of the executable of a command.
On Redhat and CentOS servers, which command is provided by which package.
1. You must log into your Linux server as ‘root’ user or sudo user to install which package
2. Install which package either using yum or dnf command
Command to install which package :
OR
# dnf install which
3. Enter ‘y’ and press enter, if yum ask for confirmation while installing
4. Run the following command to verify installation by checking which version
GNU which v2.21, Copyright (C) 1999 – 2015 Carlo Wood.
GNU which comes with ABSOLUTELY NO WARRANTY;
This program is free software; your freedom to use, change
and distribute this program is protected by the GPL.
How to download and install Which rpm on CentOS 8 / RHEL 8 server
1. You must login to server as ‘root’ user
2. Download which package from centos.org website using wget command
3. Install which rpm using either yum or rpm command
(a) Install which on CentOS 8 / Redhat 8 x86_64 server using yum command :
Yum will install which package and the required dependencies.
(b) Install which on CentOS 8 / Redhat 8 x86_64 server using rpm command :
You must install the below required dependencies, if you are installing using rpm command.
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
Which command usage
Usage: which [options] [–] COMMAND […]
Write the full path of COMMAND(s) to standard output.
–version, -[vV] Print version and exit successfully.
–help, Print this help and exit successfully.
–skip-dot Skip directories in PATH that start with a dot.
–skip-tilde Skip directories in PATH that start with a tilde.
–show-dot Don’t expand a dot to current directory in output.
–show-tilde Output a tilde for HOME directory for non-root.
–tty-only Stop processing options on the right if not on tty.
–all, -a Print all matches in PATH, not just the first
–read-alias, -i Read list of aliases from stdin.
–skip-alias Ignore option –read-alias; don’t read stdin.
–read-functions Read shell functions from stdin.
–skip-functions Ignore option –read-functions; don’t read stdin.