Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
I expect you're using Unity but in XFCE the lock function is handled by /usr/bin/xflock4. That's a script you can edit to prioritize gnome-screensaver or xscreensaver (or others). I don't know if it exists in Unity systems but something similar must. – Sean Apr 12 '14 at 3:40
Thanks for the quick feedback, but in Unity there is no xflock4. changed my question to be more relevant to the actual problem. – Danatela Apr 12 '14 at 4:22
@Danatela - duplicate of this?… – fossfreedom Apr 12 '14 at 12:18
@fossfreedom no, sudo ln -s /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command doesn't work. – Danatela Apr 13 '14 at 7:00
what version of Ubuntu are you using? – fossfreedom Apr 13 '14 at 8:51
up vote 0 down vote accepted

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


case "$1" in
        xscreensaver-command -lock
        xscreensaver-command "$@"

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.