xscreensaver

systemLinux/Unix
The xscreensaver command is one of the most frequently used commands in Linux/Unix-like operating systems. xscreensaver Extensible screen saver and locker for the X Window System

Quick Reference

Command Name:

xscreensaver

Category:

system

Platform:

Linux/Unix

Basic Usage:

xscreensaver [options] [arguments]

Common Use Cases

    Syntax

    xscreensaver [options]

    Options

    Main xscreensaver Options

    Option Description
    -display host:display.screen Specifies which X display to use
    -verbose Print diagnostics to stderr
    -no-splash Don't display the startup splash screen
    -log file Write diagnostics to the specified file instead of stderr
    -no-capture-stderr Don't redirect stderr of launched screenhacks
    -lock Lock the screen even if locking is disabled in the configuration file
    -no-lock Don't lock the screen even if locking is enabled in the configuration file
    -remote Control an already-running xscreensaver process
    -version Print version information and exit

    xscreensaver-command Options

    Option Description
    -activate Turn on the screensaver immediately
    -deactivate Turn off the screensaver immediately
    -cycle Switch to the next screensaver in the list
    -next Switch to the next visual in the current screensaver
    -prev Switch to the previous visual in the current screensaver
    -select n Switch to a specific screensaver (by numeric index)
    -exit Causes the xscreensaver process to exit gracefully
    -restart Restart the xscreensaver process
    -lock Lock the screen immediately
    -unlock Unlock the screen (only works if the screen is locked, you'll still need to enter the password)
    -prefs Show the preferences dialog
    -demo Show the screensaver demo dialog

    Additional Configuration

    Additional configuration can be set in the ~/.xscreensaver file, or through the graphical preferences dialog launched with xscreensaver-command -prefs.

    Examples

    How to Use These Examples

    The examples below show common ways to use the xscreensaver command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    # Start xscreensaver in the background xscreensaver &
    # Start xscreensaver in verbose mode xscreensaver -verbose &
    # Lock the screen immediately xscreensaver-command -lock
    # Advanced Examples Advanced
    # Start with a specific configuration file xscreensaver -no-splash -log /var/log/xscreensaver.log &
    # Enable the screensaver, but do not lock the screen xscreensaver -no-lock & # Activate the screen saver even if the mouse is moving xscreensaver-command -activate # Show the configuration dialog xscreensaver-command -prefs # Exit xscreensaver xscreensaver-command -exit

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The `xscreensaver` program is a modular screen saver and locker for the X Window System. It is highly customizable, supporting many different screen-saving animations (called "hacks") and providing robust authentication mechanisms for screen locking. **Core Components:** 1. **xscreensaver**: The main daemon process that runs in the background, monitoring user activity and activating/deactivating the screen saver as appropriate. 2. **xscreensaver-command**: A command-line interface to control a running xscreensaver process, allowing you to lock the screen, activate/deactivate the screensaver, cycle through different animations, and more. 3. **xscreensaver-demo**: A graphical interface for previewing and configuring screensavers. 4. **xscreensaver-settings**: A graphical preferences dialog for configuring xscreensaver behavior. **Key Features:** 1. **Extensive Collection of Screensavers**: xscreensaver comes with over 200 different screen-saving animations, from simple patterns to complex 3D visualizations, games, and even useful tools like RSS readers. 2. **Secure Screen Locking**: xscreensaver provides secure screen locking with various authentication methods, including PAM integration for system password authentication. 3. **Power Management**: It can integrate with your system's power management, activating the screensaver or blanking the screen to save power after periods of inactivity. 4. **Customizability**: Almost every aspect of xscreensaver can be configured, including timing, screensaver selection, randomization, power management behavior, and more. 5. **Multi-monitor Support**: xscreensaver works well with multi-monitor setups, offering options for how screensavers display across multiple screens. **Usage Scenarios:** 1. **Desktop Security**: The primary use case for xscreensaver is to automatically lock the screen after a period of inactivity, protecting your session from unauthorized access. 2. **Power Saving**: By blanking the screen or activating low-power animations during inactivity, xscreensaver can help conserve energy. 3. **Visual Entertainment**: Many users enjoy the artistic and entertainment value of the various screensavers, which range from abstract patterns to games and interactive visualizations. 4. **System Information Display**: Some xscreensaver modules can display useful information like system stats, news feeds, or custom information while the screen is idle. **Configuration:** xscreensaver can be configured in several ways: 1. **Command Line Options**: When starting xscreensaver, various options can be provided to control its behavior. 2. **Configuration File**: The `~/.xscreensaver` file contains user-specific settings in a text format that can be edited manually. 3. **Graphical Interface**: The `xscreensaver-demo` or `xscreensaver-settings` programs provide a user-friendly interface for configuring all aspects of xscreensaver. **Integration with Desktop Environments:** Most modern desktop environments (GNOME, KDE, Xfce, etc.) have their own screen saver and locker mechanisms, but xscreensaver can still be used with them by disabling the built-in screen savers and configuring xscreensaver to start automatically with your session. **Security Considerations:** 1. **Authentication Mechanism**: xscreensaver uses PAM (Pluggable Authentication Modules) for authentication, making it secure and flexible. 2. **Privilege Separation**: xscreensaver is designed with security in mind, separating the privileged authentication component from the unprivileged display components. 3. **Regular Updates**: The xscreensaver project is actively maintained, with security vulnerabilities addressed promptly. **Alternatives:** 1. **gnome-screensaver**: GNOME's built-in screen saver and locker, simpler but less customizable than xscreensaver. 2. **kscreenlocker**: KDE's screen locker, integrated with the KDE Plasma desktop. 3. **light-locker**: A lightweight screen locker designed for the LightDM display manager. 4. **i3lock**: A simple screen locker designed for the i3 window manager. **Historical Context:** xscreensaver has been around since 1992, making it one of the oldest and most mature X11 applications still in active use. It was developed by Jamie Zawinski and has evolved significantly over the decades while maintaining backward compatibility and its core design principles. **Technical Details:** 1. **Architecture**: xscreensaver uses a client-server model, with the main daemon managing the screen and communicating with the various command and configuration interfaces. 2. **Display Modes**: xscreensaver supports different display modes, including random selection from available screensavers, specific selection, and "blank only" mode. 3. **Resources**: Some screensavers can be resource-intensive, particularly the 3D ones. xscreensaver includes settings to limit CPU usage and control other resource-related parameters. 4. **Extension Support**: xscreensaver can take advantage of various X extensions for better performance and more advanced visual effects. Overall, xscreensaver remains one of the most feature-rich and flexible screen saver and screen locker solutions available for Linux and Unix-like systems, offering a balance of security, customizability, and visual appeal.

    Related Commands

    These commands are frequently used alongside xscreensaver or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the xscreensaver command works in different scenarios.

    $ xscreensaver
    View All Commands