Disable touchpad on Ubuntu Linux

Quite annoyingly, I was unable to disable touchpad on laptop through the dedicated fn combination. Bit of googling brought results fast, here’s a simple script I use now for switching on and off.

if [ "$1" = "off" ]; then
    sudo modprobe -r psmouse
elif [ "$1" = "on" ]; then
    sudo modprobe psmouse
    echo "usage: $0 [on|off]"

Update: you can also use the following “toggle” script, if you want to avoid having to specify on/off each time:

lsmod | grep psmouse &> /dev/null
if [ "$?" = "1" ]; then
    modprobe psmouse
    modprobe -r psmouse

3 responses to “Disable touchpad on Ubuntu Linux

  1. Thanks.

    This script changes the value of “Enable mouse clicks with touchpad” when executed. It can be run with a keyboard combination set in gnome-keybinding-properties:


    mode=”$(gconftool-2 -g /desktop/gnome/peripherals/touchpad/tap_to_click)”

    if [ $mode == “true” ] ;
    gconftool-2 -s -t bool /desktop/gnome/peripherals/touchpad/tap_to_click false
    gconftool-2 -s -t bool /desktop/gnome/peripherals/touchpad/tap_to_click true

  2. the toogle script is working , but it requires sudo to be executed , so it won’t be practical to assign it to a shortcut keys.
    i don’t want to type my password each time i want to disable the touchpad.

    any way thanks for the nice tip 🙂

  3. #!/bin/bash
    enabled=`xinput –list-props “PS/2 Generic Mouse” | grep -e “Device Enabled\ (126):\s*1″`

    if [ -n “$enabled” ]; then
    xinput –set-prop “PS/2 Generic Mouse” “Device Enabled” 0
    xinput –set-prop “PS/2 Generic Mouse” “Device Enabled” 1

    that worked for me on Dell N5110

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s