How to resolve the error “-bash: xclock: command not found” in CentOS / RHEL

xclock is a handy tool to test if the DISPLAY variable is set properly and you can get a GUI based clock on running the “xclock” command as shown below. The package xorgs-x11-apps provides the xclock command.

Installing the package providing the xclock command

1. Check the package which provides the binary, using below command:

# yum whatprovides xclock
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.cisp.com
 * epel: mirror.cogentco.com
 * extras: mirror.cs.vt.edu
 * nux-dextop: li.nux.ro
 * updates: mirror.vtti.vt.edu
xorg-x11-apps-7.7-7.el7.x86_64 : X.Org X11 applications
Repo        : base
Matched from:
Provides    : xclock

2. As you can see in the output above, the package xorgs-x11-apps provide the xclock command. To install the xorg-x11-apps package run the below command.

# yum install xorg-x11-apps
...
===================================================================================================================================================================
 Package                                    Arch                                Version                                    Repository                         Size
===================================================================================================================================================================
Installing:
 xorg-x11-apps                              x86_64                              7.7-7.el7                                  base                              307 k
Installing for dependencies:
 libXaw                                     x86_64                              1.0.13-4.el7                               base                              192 k
 libXpm                                     x86_64                              3.5.12-1.el7                               base                               55 k
Transaction Summary
===================================================================================================================================================================
Install  1 Package (+2 Dependent packages)
Total download size: 554 k
Installed size: 1.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): libXpm-3.5.12-1.el7.x86_64.rpm                                                                                                       |  55 kB  00:00:00     
(2/3): xorg-x11-apps-7.7-7.el7.x86_64.rpm                                                                                                   | 307 kB  00:00:00     
(3/3): libXaw-1.0.13-4.el7.x86_64.rpm                                                                                                       | 192 kB  00:00:01
...
Related Post