The C shell, Korn shell, and bash
automatically save
a history of the commands you type.
You can add your own commands to the csh
and bash
history lists
without retyping them.
Why would you do that?

You might have a set of commands that you want to be able to recall
and reuse every time you log in.
This can be more convenient than aliases because you don't have to think
of names for the aliases.
It's handier than a shell script if you need to do a series of commands
but they aren't always in the same order.

You might have several shells running (say, in several windows) and want to
pass the history from one shell to another shell (11.11
)
.

Here's an example.
Use the csh
command history -h
,
or the bash
command history -w
,
to save the history from a shell to a file.
Edit the file to take out commands you don't want: