0

AFAIK alias is usually used to make 'shortcut' for long command. But what to do if I want to alias one command to another?

I need this because I replaced gnome-screensaver with xscreensaver, so the lock screen button does not work.

How to alias gnome-screensaver-command -l to be resolved into xscreensaver-command -lock?

Danatela
  • 13,384

1 Answers1

0

It was easier than I thought. I had to create such shell script:

#!/bin/bash

case "$1" in
    -l)
        xscreensaver-command -lock
        ;;
    *)
        xscreensaver-command "$@"
        ;;
esac

Saved it as /usr/bin/gnome-screensaver-command and added execute permission:

sudo chmod +x /usr/bin/gnome-screensaver-command

Now, executing gnome-screensaver-command -l launches xscreensaver-command -lock and locks my screen.

Danatela
  • 13,384