Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

!! in bash runs last command. I find it too difficult to type given how much I use it. alias to the rescue, I presumed.

Or not. I tried:

$ alias dl='!!'               # Aliasing
$ echo Testing123             # Here's something to test on
$ dl                          # Testing alias
bash: !!: command not found
$                             # I AM DISAPPOINT

Without quotes also fails.

What's up?

share|improve this question
Aliases usually shorten the length of frequently typed commands, or adding frequently used switches. What's the point of even needing an alias for !!? – bsd Mar 8 '12 at 19:44
@bdowning, presumably so you don't have to hit Shift and reach up in the corner of the keyboard. – cjm Mar 8 '12 at 19:51
@bdowning As cjm; my Shift-finger wants a break. – Anko Mar 8 '12 at 19:53
@bdowning: according to "Why QWERTY was invented", slowing you down was not a design objective of querty, but reducing clashes (of course, keyboards don't clash at all, so other layouts might be more favourable) – sr_ Mar 9 '12 at 13:27
@sr_ The clashes occurred because of the speed of typists. If you wish to continue this I suggest we move to a chat room. I don't care to continue, the less typing the better :) – bsd Mar 9 '12 at 13:30
up vote 13 down vote accepted
alias dl='fc -s'

See http://www.gnu.org/software/bash/manual/bashref.html#Bash-History-Builtins

share|improve this answer
Works! Still curious though: What makes !! un-aliasable? – Anko Mar 8 '12 at 19:57
I can't find anything quickly in the manual but I'm guessing that bash performs any history expansions before substituting aliases. So the shell only sees the command "!!" which clearly doesn't exist. – glenn jackman Mar 8 '12 at 20:17

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.