In a single command how do you run the previous command in
the command prompt.
Answers were Sorted based on User's Feedback
Answer / kalaivani
type "r". It will execute the last executed command
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / anjan raha
!!
It will display previous executed command
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / namrata
Using Dot(.)It will execute the last executed command.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / joker
!! will execute the last command
!-1 will execute the 2nd command from last
Few other tricks:
-----------------
If you are not sure you can see what is the command rather than executing by
!!:p
!-2:p
and later just do !!
If you want to run the last command with little modification use substitution
!!:s/old/new
example:
>vim test
>!!:s/test/abcd/:p
vim abcd
Thanks,
Joker
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the use of a shebang line?
What is a program shell?
What is awk script?
What is shell terminal?
What does it mean to debug a script?
What is difference between bash and shell?
How to get script name inside a script?
how to delete all the files with extension .dat rom a directory tree from root to third level in a single unix command?
What is meant by $1 in shell script?
How to change our default shell?
Given a file find the count of lines containing the word "abc".
What is an inode block?