LinuxCommandLibrary

ledctl

Control LEDs connected to a system

TLDR

Turn on the "Locate" LED for specified device(s)

$ sudo ledctl locate=[/dev/sda,/dev/sdb,...]
copy

Turn off the "Locate" LED for specified device(s)
$ sudo ledctl locate_off=[/dev/sda,/dev/sdb,...]
copy

Turn off the "Status" LED and "Failure" LED for specified device(s)
$ sudo ledctl off=[/dev/sda,/dev/sdb,...]
copy

Turn off the "Status" LED, "Failure" LED and "Locate" LED for specified device(s)
$ sudo ledctl normal=[/dev/sda,/dev/sdb,...]
copy

SYNOPSIS

ledctl [options] [arguments]

PARAMETERS

--help
    Display help information and exit.

--version
    Display version information and exit.


    The name of the LED device to control (e.g., led0, phy0-led). You can usually find the device names in /sys/class/leds.

brightness
    Set the brightness of the LED to the specified . The range of valid values depends on the LED device.

max_brightness
    Display the maximum brightness value supported by the LED.

delay_on
    Set the delay, in milliseconds, for the 'on' state of a blink pattern.

delay_off
    Set the delay, in milliseconds, for the 'off' state of a blink pattern.

trigger
    Set the trigger for the LED. Triggers define how the LED will be controlled automatically by the kernel. Common triggers include 'none', 'timer', 'heartbeat', and 'disk-activity'.

default_trigger
    Display the default trigger for the LED.

remove
    Removes specified device only for debug purposes

DESCRIPTION

ledctl is a command-line utility designed to control the behavior of LED (Light Emitting Diode) devices connected to a Linux system. It allows users to query the capabilities of LEDs and set their properties, such as brightness, color, and blinking patterns.

The command operates by interacting with the Linux LED subsystem, which provides a standardized interface for controlling LEDs regardless of their underlying hardware implementation. This allows ledctl to work with a wide variety of LED devices, including those found on network cards, hard drives, and system panels.

ledctl is primarily used for diagnostic purposes, system monitoring, and visual indication of system status. It can be scripted to create custom LED behaviors based on system events or application states. The command provides a flexible and powerful way to interact with LEDs from the command line, allowing for fine-grained control over their appearance.

DEVICE DISCOVERY

LED devices are typically represented as files in the /sys/class/leds directory. You can use commands like 'ls /sys/class/leds' to list available LED devices on your system.

TRIGGER DETAILS

Triggers are kernel-level mechanisms that automatically control LEDs based on system events. The 'timer' trigger causes the LED to blink at a specified rate, while the 'heartbeat' trigger makes the LED blink to simulate a heartbeat. 'disk-activity' triggers when I/O is made to a block device.

PERMISSIONS

You might need root privileges (using 'sudo') to control some LED devices.

HISTORY

The Linux LED subsystem and its associated tools, including ledctl, were developed to provide a standardized way to control LEDs in a variety of hardware devices. The initial goal was to create a consistent interface for userspace programs to interact with LEDs, regardless of the underlying hardware. ledctl was created as a utility to take advantage of this system and provide a user-friendly command-line interface for controlling LEDs. Over time, it has been expanded to support various LED behaviors and triggers, making it a valuable tool for system administrators and developers.

SEE ALSO

find(1), ls(1), echo(1)

Copied to clipboard