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

Is it possible to use an alias within a custom shortcut?

For example, suppose I have the alias

alias cal="google-chrome --new-window"

Can I create a custom shortcut that binds "Ctrl+Alt+C" to "cal"?

I have tried but it doesn't seem to work.

share|improve this question

No, the commands run by keyboard bindings are not parsed via a shell. Your best bet is to create a directory bin in your homedir (mkdir -p ~/bin). Write a script named cal that runs your command, save it in ~/bin and make it executable.

$ mkdir -p ~/bin
$ cat > ~/bin/cal << 'EOF'
exec google-chrome --new-window
$ chmod +x ~/bin/cal

If you didn't have a bin directory in your homedir already, you need to log out and back in again for it to be added to your PATH. Once that is done, binding a keyboard binding to run "cal" should do what you want.

share|improve this answer

a quick alternative, in case it helps anyone in the future

to add a "Save Image As.." keyboard shortcut to Chrome as Shift-Ctrl-S

command: bash -c "xdotool click 3 && sleep 0.5 && xdotool key v;"

also, if you're organized enough to keep a separate file with your shortcuts & then sourcing it at the end of ~/.bashrc for example, the following works & can comes in handy ;)

command: bash -c ". /tmp/keyboardShortcutsFcns && tefAliasFcn"

content of the "/tmp/keyboardShortcutsFcns" file from the above example:

# test fcn to be called ( maybe ? ) from a keyboard shortcut tefAliasFcn(){ notify-send "tef alias function called succesfully !"; }

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.