History and using old commands
Creating, viewing, and using history
- Typing 'set history=20' (or some other number) or having it in your .dot files will allow you to use
previous commands
- For example, suppose $history = 4, and I type 'history' at the prompt. then I will see something like
33 ls
34 cc test.c > test.out
35 vi test.c
36 history
- Once I have a history (whether or not i display it), I can re-execute commands using a ! special
character
!! re-executes the last command
!33 would re-execute command 33
!cc would re-execute the last command starting with 'cc'
- (in either of the last two cases, get a 'not found' error if there is no such command in the history)
!33 -lga
!34 || !35 (tell me)
!34 & & !33 (tell me)
- I don't think !33t would invoke a command 'lst' (if there were one) but you could check.