If a command is used with sudo (for e.g. sudo yum clean all) it takes time to execute.
[21:29]$ sudo yum clean all [sudo] password for test@geeklab: Loaded plugins: package_upload, product-id, search-disabled-repos, subscription-manager Cleaning repos: production-rhel-x86_64-workstation-7.4 rhel-7-server-rpms Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos [21:33]$
In the above output it’s taking about 4 minutes for the command to execute completely.
Running sudo requires a name server lookup for the machine’s hostname. If there is no entry in /etc/hosts file assigning the hostname to a localhost interface, then sudo will attempt a hostname lookup through the configured DNS server as per /etc/resolv.conf file. That lookup might take a while if the hostname of the machine is not publicly resolvable.
1. First check /etc/hosts file of the system and check if the entry for the hostname is present.
2. Make appropriate entry for the hostname in the file. It will be like:
# cat /etc/hosts 127.0.0.1 server4 server4.example.com
where ‘example.com’ is the actual ‘hostname’ of your system.
3. Now monitor the time taken by the command “sudo yum clean all” to execute.