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 |
How to add some content in any file at some desired location without using VI or some other editor in UNIX
How to debug the problems encountered in the shell script/program?
How do I start a shell script?
How can I send a mail with a compressed file as an attachment?
What is the syntax of "nested if statement" in shell scripting?
is there any command to find user password?
Can we run shell script in windows?
What is a batch file used for?
Why do we write bin bash in shell scripts?
What is the best scripting language?
State the advantages of shell scripting?
how will you find the total disk space used by a specific user?