How to install locate command in Linux Redhat and Centos

Technology - How to install locate command in Linux Redhat and Centos

To install the locate command (mlocate) in Redhat or Centos, use the ’YUM’ command, install function. 

  • Logon as ‘root’ or use with ‘sudo’ permissions
  • Then, run a ’man’ command to confirm that the locate command is not already installed: ‘man locate’

Example ‘man’ command (as root user)

[root@blog-server ~]# man locate

  • If the ’man’ documentation page returns, then it is already installed.  If no ’man’ documentation page is returned, then run the ‘yum install’ command.
  • Run the ‘yum install’ command as ‘root’ or ‘sudo’ user:

Example ‘yum install’ command (as root user)

[root@blog-server ~]# yum install mlocate

Example ‘yum install’ command (as sudo user)

[root@blog-server ~]# sudo yum install mlocate

Then run the [root@data-server ~]# updated

Example Run ‘updatedb’ Command (as Root user)

[root@blog-server ~]# updated

Example Run ‘updatedb’ Command (as sudo user)

[root@blog-server ~]# sudo updated

How to use Install and use locate command on Linux

1 Comment

Comments are closed.

%d