Disabling the laptop keyboard in ubuntu 20.0.4

Adarsha Regmi
2 min readAug 7, 2021

This is common problem we face during lockdown where keyboard starts to start working by its own. We need to disable the connected device and use only the external keyboard. The first command to list the input devices

xinput –list

listing the inputs

the one that we need is

our keyboard device where id is 16

Disabling the keyboard

In order to disable the keyboard run the following command

xinput set-int-prop 16 "Device Enabled" 8 0

where 16 is the id for the input device

Enabling back the keyboard

In order to enable the keyboard back on run the following command

xinput set-int-prop 16 “Device Enabled” 8 1

Long term

In case of on start locking up we need to change the grub file

vi /etc/default/grub

try opening with sudo command for write mode.

grub file

check for this line

replace with following code

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash i8042.nokbd”

and then update the grub with command


After this we dont need to disable keyboard again.

# follow the guide with video

Disabling the code

view keycodes first

xev -event keyboard

after checking keycode

xmodmap -e ‘keycode 81=~’