second previous command execution
-
19-09-2019 - |
Question
In Unix, !!
is an alias for the previous command:
indibm202 21: date
Tue Nov 10 17:38:13 IST 2009
indibm202 22: !!
date
Tue Nov 10 17:38:16 IST 2009
indibm202 23:
What is the alias for the second most previous command?
Solution
If tcsh
is anything like csh
(and I think it is), you should be able to just use:
!-2
to execute the second-to-last command (!!
is shorthand for !-1
).
Alternatively, you could use history
to check out your last few commands and then use:
!N
where N
is the command number for the command you want to re-execute.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow