cmd:bash history usage 

Usage 

$ /bin/echo a1 b2 c3 d4
a1 b2 c3 d4

pick some word 

$  echo !:0
 echo /bin/echo
/bin/echo
$  echo !:1
 echo a1
a1
$  echo !:2
 echo b2
b2

pick range of words 

$  echo !*
echo a1 b2 c3 d4
a1 b2 c3 d4

— all previous parameters

ls -f a1 b2 c3 d4 &
$ ls !:1-
ls -f a1 b2 c3 d4

— all previous parameters except last, best for & sign

$ echo A /a/b/c.d.e
A /a/b/c.d.e
$ echo B !:2*
echo B /a/b/c.d.e
/a/b/c.d.e

— omit some leading parameters

Help 

Event Designators
    An  event  designator  is  a reference to a command line entry in the
    history list.
!      Start a history substitution, except when followed by a blank,
       newline, = or (.
!!     Refer to the previous command.  This is a synonym for `!-1'.
!n     Refer to command line n.
!-n    Refer to the current command line minus n.
!string
       Refer to the most recent command starting with string.
!?string[?]
       Refer to the most recent command containing string.
^string1^string2^
       Quick   substitution.   Repeat  the  last  command,  replacing
       string1 with string2.  Equivalent to ``!!:s/string1/string2/''
       (see Modifiers below).
!#     The entire command line typed so far.
Word Designators
    A  :  separates the event specification from the word designator.  It
    can be omitted if the word designator begins with a ^, $,  *,  or  %.
    Words  are  numbered  from  the beginning of the line, with the first
    word being denoted by a 0 (zero).
0 (zero)
       The zeroth word.  For the shell, this is the command word.
n      The nth word.
^      The first argument.  That is, word 1.
$      The last argument.
%      The word matched by the most recent `?string?' search.
x-y    A range of words; `-y' abbreviates `0-y'.
*      All of the words but the zeroth.  This is a synonym for `1-$'.
       It  is  not an error to use * if there is just one word in the
       event; the empty string is returned in that case.
x*     Abbreviates x-$.
x-     Abbreviates x-$ like x*, but omits the last word.
Modifiers
    After the optional word designator, you can add a sequence of one  or
    more of the following modifiers, each preceded by a `:'.
h      Remove a trailing pathname component, leaving only the head.
r      Remove  a  trailing suffix of the form .xxx, leaving the basename.
e      Remove all but the trailing suffix.
t      Remove all leading pathname components, leaving the tail.
p      Print the new command but do not execute it.
q      Quote the substituted words, escaping further substitutions.
x      Quote the substituted words as with q, but break into words at
       blanks and newlines.
s/old/new/
       Substitute new for the first occurrence of old in the event
       line.  Any delimiter can be used in place of /.  The final
       delimiter is optional if it is the last character of the event
       line.  The delimiter may be quoted in old and new with a
       single backslash.  If & appears in new, it is replaced by old.
       A single backslash will quote the &.
&      Repeat the previous substitution.
g      Cause changes to be applied over the entire event line.   This
       is  used  in  conjunction  with `:s' (e.g., `:gs/old/new/') or
       `:&'.  If used with `:s', any delimiter can be used  in  place
       of  /,  and  the final delimiter is optional if it is the last
       character of the event line.