LinuxCommandLibrary

setleds

Control keyboard LED indicators on consoles

TLDR

Turn on NumLock LED

$ setleds +num
copy
Turn off CapsLock LED
$ setleds -caps
copy
Turn on ScrollLock LED
$ setleds +scroll
copy
Set NumLock as default (persists after reset)
$ setleds -D +num
copy
Report current LED status
$ setleds
copy
Change LEDs only without affecting key state
$ setleds -L +num
copy
Set LEDs for a specific TTY
$ setleds -D +num < /dev/tty1
copy

SYNOPSIS

setleds [-v] [-L] [-D] [-F] [{+|-}num] [{+|-}caps] [{+|-}scroll]

DESCRIPTION

setleds controls the keyboard LED indicators (NumLock, CapsLock, ScrollLock) on Linux virtual consoles. Without arguments, it reports the current LED and flag settings.
The command manipulates both the virtual terminal flags (which affect keyboard behavior) and the physical LED states. Use -F to change only VT behavior, -L to change only LEDs, or -D to set persistent defaults.
This is commonly used in /etc/rc scripts to set the initial NumLock state for console logins.

PARAMETERS

+num / -num

Set or clear NumLock
+caps / -caps
Set or clear CapsLock
+scroll / -scroll
Set or clear ScrollLock
-F
Only change VT flags (default); LEDs may reflect the change
-D
Change flags and defaults; changes persist after console reset
-L
Only change LEDs without affecting VT flags
-v
Verbose mode; report changes

CAVEATS

setleds affects only virtual consoles (TTYs), not graphical environments (X11/Wayland) where the desktop environment manages keyboard LEDs. Requires appropriate permissions for the target terminal device. Part of the kbd package.

HISTORY

setleds is part of the kbd package, a collection of keyboard utilities for Linux console management. It provides low-level control over keyboard indicators that predates modern desktop environments.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community