Reviewing Your History

Each command you issue is an event that goes in your history list. To see what's in the list, use the history command. In csh, each output line displayed by history includes an event number and the command to which the event corresponds:

%  history
683  cd ˜/src/rtf
684  more Imakefile
685  make World >& make.world
686  more make.world
687  make clean
688  cd ..
689  tar cf rtf.tar rtf
690  gzip rtf.tar
691  ftp 144.92.43.19
692  uuencode rtf.tar.gz rtf.tar.gz > rtf.tar.gz.uu
693  mail -s 'New RTF distribution' rtf-list < rtf.tar.gz.uu
694  rm rtf.tar.gz*
etc.

In tcsh, history lines also include a time stamp.

Output from the history command grows quite long if you set the history variable to a large number. You can pipe the output through more or supply a numeric argument specifying how many lines to display:

% history | more           Display history using pager
% history 5                Display last five commands

tcsh and most versions of csh understand both commands shown above. Some versions of csh botch one command or the other, in which case you'll need to use the one that works.

Get Using csh & tcsh now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.