cmd:tcsh history 

*Tags*: tcsh history key

the history shell variable can be set to a number to save that many commands.

The histdup shell variable can be set to not save duplicate events or consecutive duplicate events.

If the histlit shell variable is set, commands that display and store history use the literal form.

Any input line which contains a history substitution is printed before it is executed.

A  history  substitution  may  have  an ``event specifica-
tion'', which indicates the event from which words are  to
be  taken, a ``word designator'', which selects particular
words from the chosen event, and/or a ``modifier'',  which
manipulates the selected words.
An event specification can be
n       A number, referring to a particular event
-n      An offset, referring to the event n before the
        current event
#       The current event.  This should be used  care-
        fully  in  csh(1), where there is no check for
        recursion. tcsh allows 10 levels of recursion.
        (+)
!       The previous event (equivalent to `-1')
s       The  most recent event whose first word begins
        with the string s
?s?     The  most  recent  event  which  contains  the
        string s.  The second `?' can be omitted if it
        is immediately followed by a newline.
   11  8:36    vi wumpus.man
History references may be insulated from  the  surrounding text with braces if
necessary.`!{v}doc' would expand unam- biguously to `vi wumpus.mandoc'.
To select words from an event  we  can  follow  the  event
specification  by  a  `:' and a designator for the desired
words.  The words of an input line are  numbered  from  0,
the  first (usually command) word being 0, the second word
(first argument) being 1, etc. The basic word  designators
are:
0       The first (command) word
n       The nth argument
^       The first argument, equivalent to `1'
$       The last argument
%       The word matched by an ?s? search
x-y     A range of words
-y      Equivalent to `0-y'
*       Equivalent  to  `^-$',  but returns nothing if
        the event contains only 1 word
x*      Equivalent to `x-$'
x-      Equivalent to `x*', but omitting the last word
        (`$')
 9  8:30    nroff -man wumpus.man
10  8:31    cp wumpus.man wumpus.man.old
11  8:36    vi wumpus.man
12  8:37    diff wumpus.man.old wumpus.man
Selected  words  are  inserted into the command line sepa-
rated by single blanks.  For example, the  `diff'  command
in  the  previous  example  might have been typed as `diff
!!:1.old !!:1' (using `:1' to select  the  first  argument
from  the  previous event) or `diff !-2:2 !-2:1' to select
and swap the arguments from the `cp' command. If we didn't
care  about  the  order  of  the `diff' we might have said
`diff !-2:1-2' or simply `diff !-2:*'.  The  `cp'  command
might  have  been  written `cp wumpus.man !#:1.old', using
`#' to refer to  the  current  event.   `!n:-  hurkle.man'
would  reuse  the first two words from the `nroff' command
to say `nroff -man hurkle.man'.
host:~/doc/tdoc>alias tt echo '1 \!\!:1 2 \!\!:2'
host:~/doc/tdoc>tt aa bb
1 aa 2 bb
host:~/bin>dir *log
host:~/bin>dir *at?
host:~/bin>wipetmp a::b !!$ !-2:$
wipetmp a::b *at? *log
host:~>pushd bin
~/bin ~ /home/comp/dsilver/C45/UNIX
host:~/bin>!p- doc
pushd doc
~/doc ~/bin ~ /home/comp/dsilver/C45/UNIX