xclock
Display a graphical clock
TLDR
Display an analog clock
Display a 24-hour digital clock with the hour and minute fields only
Display a digital clock using an strftime format string (see strftime(3))
Display a 24-hour digital clock with the hour, minute and second fields that updates every second
Display a 12-hour digital clock with the hour and minute fields only
SYNOPSIS
xclock [options]
PARAMETERS
-analog
Displays an analog clock. This is the default behavior.
-digital or -d
Displays a digital clock.
-brief
For analog clocks, it suppresses the seconds hand. For digital clocks, it suppresses the date display.
-hands <color>
Sets the color of the analog clock's hands.
-highlight <color>
Sets the color of the tic marks for analog clocks, or the text for digital clocks.
-chime
Causes the clock to chime once on the half hour and twice on the hour.
-fg or -hd <color>
Sets the foreground color of the clock.
-bg <color>
Sets the background color of the clock window.
-bd <color>
Sets the border color of the clock window.
-bw <pixels>
Sets the border width in pixels for the clock window.
-geometry <geometry_string>
Specifies the initial window position and size (e.g., 80x80+10+10).
-display <display_name>
Specifies the X server to connect to.
-padding <pixels>
Sets the padding (in pixels) between the window border and the clock image.
-update <seconds>
Sets the interval (in seconds) at which the clock updates its display. Default is 60 seconds.
-xrm <resource_string>
Specifies a resource string to be merged with other resources. Useful for setting X resources directly on the command line.
-font <font_name>
Specifies the font to be used for the digital clock display.
-strftime <format_string>
Specifies the format string for the digital clock, using conventions similar to strftime(3).
-twelve or -12
Displays the digital clock in 12-hour format (e.g., 3:00 PM).
-twentyfour or -24
Displays the digital clock in 24-hour format (e.g., 15:00).
-utc or -ut
Displays Universal Time (UTC) instead of local time.
-localtime
Displays local time (this is the default behavior).
DESCRIPTION
The xclock command is a traditional utility for the X Window System, designed to display the current time in a dedicated window. It offers both analog (default) and digital clock styles, providing a simple yet customizable visual timekeeping solution for X desktop environments. Users can configure various aspects of its appearance, including colors, fonts, border, size, and update interval. It's primarily used for convenient, always-visible time display directly on the X display, often launched at session startup.
CAVEATS
xclock requires an active X Window System environment to run, making it unsuitable for purely command-line or headless server use. Its direct functionality is largely superseded by integrated clock features in modern desktop environments, which often offer more sophisticated features and better visual integration within the desktop panel or bar.
X RESOURCES
Beyond command-line options, xclock's appearance and behavior can be extensively customized using X resources. These resources can be set in files like ~/.Xdefaults or ~/.Xresources. For example, XClock*background: #282a36
and XClock*foreground: #f8f8f2
could be used to set colors. Resource names typically follow the pattern XClock*resourceName
, allowing for persistent customization across sessions.
DEFAULT BEHAVIOR
By default, xclock displays an analog clock face, shows local time, and updates its display every 60 seconds. Its default size and position are typically determined by the window manager or the X server's configuration, placing it where space is available or at a predefined location.
HISTORY
xclock is one of the oldest and most iconic applications of the X Window System, dating back to its initial releases by the MIT X Consortium in the mid-1980s. It was designed as a simple yet effective demonstration and utility for X's graphical capabilities. While its core functionality has remained consistent, it has seen minor enhancements over the decades to support new X features and customization options, continuing to be a part of the standard X application suite in many distributions.
SEE ALSO
date(1), hwclock(8), timedatectl(1), xsetroot(1)