Setleds command

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to: navigation, search

The setleds command is used to report and change the led flag settings of a VT i.e. NumLock, CapsLock and ScrollLock keys. Without any command line arguments, setleds displays the current settings about VT. With arguments you can set or clear the indicated flags for VT.

Display Current VT Settings

Type the following command:

setleds

Turn on Numlock For All VTs

You can use bash for loop to turn NumLock leds for all VTs as follows:

#!/bin/bash
_input=/dev/tty[1-8]
for t in $_input
do
  setleds -D +num < $t
done

See also