UTERMINAL
TERMINAL
NEXT
$V1$
PAUSE
PAGETURNER
BOTCLEAN
CLEAN
ENCORE
BOX
COMMAND
GO
history
FUNCTION
history is not a stand-alone command, but rather a
facility within the csh. The history mechanism is
normally used to recall and reuse entire command lines or
some or all of the arguments on previous command lines.
The history mechanism keeps a list of recently used command
lines. A history variable determines how many commands
will be preserved in this list. Each command line has a number.
First let's set the history variable to remember the previous
20 commands.
To tell the C-Shell to remember the last
20 commands, you need to set the C-shell
history variable to 20, e.g.:
set history = 20
Please try typing this command.
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Please type set history = 20
Please type set history = 20
I guess I must type this for you:
$PROMPT$
FORGET4
set history = 20
Observe the result on the terminal.
$PROMPT$
The history mechanism has several special features
which will now be demonstrated. Assume that
the last command you executed was:
ls -l *wonder*
$PROMPT$ls -l *wonder*
To repeat the last command you can simply type !! .
Please try this!
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Try !!
Please type !!
I guess I must type this for you:
$PROMPT$
FORGET3
$PROMPT$!!
Observe the result on the terminal. (No filenames contain the word "wonder".)
$PROMPT$!!
ls -l *wonder*
$PROMPT$
Another history feature is the ability to regenerate
a previous command in the history list that started with
a particular letter by typing ! followed by the first
letter of the desired command. Let's see what would be
produced on your terminal if you typed !l (that's the
letter "el") followed by a carriage return.
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Try !l
Please type !l
I guess I must type this for you:
$PROMPT$
FORGET2
$PROMPT$!l
Observe the result on the terminal:
ls -l *wonder*
$PROMPT$
You can reuse the last argument on your previous command line
under the C-Shell by using !$ . For example, after you have
issued the command: ls -l *wonder*
you may use !$ as a shorthand for the last argument,
*wonder*, to issue a pr command:
pr !$ | lpr
Please enter the last command at the prompt.
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Try pr !$ | lpr
Try pr !$ | lpr
I guess I must type this for you:
$PROMPT$
FORGET1
$PROMPT$pr !$ | lpr
Observe the result on the terminal.
pr *wonder* | lpr
$PROMPT$
The entire argument list of the last command can be substituted by:
!*
Please try this by typing the command chmod 644 !*
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Please type chmod 644 !*
Please type chmod 644 !*
I guess I must type this for you:
$PROMPT$
FORGET5
chmod 644 !*
Observe the result on the terminal.
chmod 644 *wonder*
$PROMPT$
Finally let us get the entire history of the last
commands in this session by typing history.
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Please type history
Please type history
I guess I must type this for you:
$PROMPT$
FORGET6
$PROMPT$history
Observe the result on the terminal.
1 set history = 20
2 ls -l *wonder*
3 ls -l *wonder*
4 ls -l *wonder*
5 pr *wonder* | lpr
6 chmod 644 -l *wonder*
7 history
$PROMPT$