在 linux 中通过击键启动进程

Starting a process with a key stroke in linux

我想问一个刚刚想到的问题。我搜索了 google 和 Whosebug 都没有找到我的问题的答案,如果有的话请告诉我。

是否可以将进程绑定到击键组合?例如,我是否可以通过简单地按下按钮 ctrl + k 来启动我的程序,或者它可以是任何其他功能键。是否可以开始这样的过程?我知道我必须编译内核并在可能的情况下再次启动,但我找不到存储组合键含义的位置。

感谢您的帮助。

您可以为此使用 bind,即当按下 F12 时 运行 pwd

 bind '"\e[24~":"pwd\n"'

将你想要的程序移动到 运行 /usr/bin 或标准路径中的其他目录使用 bind 命令中的路径

 bind '"\e[24~":"absolute_path_to_program/program"'

https://unix.stackexchange.com/questions/89622/how-to-execute-a-script-in-shell-when-a-shortcut-key-is-pressed