Last Review: May-11-2023

lfkey - key presser program

(lfkey - billentyű nyomó program)

spacerdownload lfkey

lfkey started with options
lfkey -program started with options (Picture © AJvG)


Recently I read an article on some Windows programs doing fake key presses. I thought, this should be available for Linux systems too, let's have a try.

The result was my lfkey program, which can be useful in several situations. Here is, what the program itself says (when called with the --help option):


                lfkey [OPTION]

-k (example: -k Num_Lock)set target key
-t (example: -t 2)set interval time
-vshow program version and exit
--help, -h or ?display this help and exit


l(inux)f(ake)key simulates key presses within an adjustable interval of
seconds. The target key must be given in xev-notation. This program is
useful for example to prevent desktop locking by rigidly configured
screensavers when running productive software with output that should
be watched, without worry about keyboard activity.
When called without any option the program asks for key name and
interval time. Entering no value(s) will set to defaults. While
there is a simple error handling for the interval time, this is
completely lacking for key names. So please take care to use
appropriate key names (which can be verified using the xev command).

This is a Linux only program. It depends from the xdotool package,
which should be installable within any X based environment. The program
will croak, if this package is missing.

lfkey was tested on a Debian based system running a bash shell.


This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see

Interactive mode

As mentioned above, lfkey can be started with or without options. When called without (or incomplete) options, lfkey will ask for missing data.

Hint: Selecting 'Num_Lock' or 'Caps_Lock' will give a feedback of key presses by LEDs (if your iron provides such feedback). Choosing one of the Windows keys ('Super_L' or 'Super_R') will result in key presses that do not interfere with further keyboard actions.

lfkey started with options
lfkey -program started without options (Picture © AJvG)


lfkey will run on any hardware that is able to execute a Linux operating system. Since it is written for bash, bash or a compatible shell is needed. Users should be familiar in basic use of the command line (terminal).

lfkey Download

lfkey download

lfkey is open source (GPL).


Yes - shit happens! So I have to deliver a version history, naming the changes made to lfkey when fixing errors in published versions. Please feel free, to e-mail me, if you find some quirks in lfkey...

lfkey version history
Feb-05-20230.3Release version, named fkey.
Feb-18-20230.4.1 Key ENTER now sets default values.

Unfortunately, browsing the web, I found pretty much fkey entries. So I decided, renaming the program in this early state of program history would'nt be a great issue. The new name is lfkey. Hopefully this will be unique enough for publishing purposes.
May-11-20230.4.2 Two lines of useless code deleted. Help text modified.