In a single command how do you run the previous command in
the command prompt.
Answer Posted / 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 |
Post New Answer View All Answers
How to get the last line from a file using just the terminal?
What are the different types of shell scripting?
What are the different variables present in linux shell?
What does $@ mean bash?
Given a file find the count of lines containing the word "abc".
What are the zombie processes?
Tell something about the super block in shell scripting?
What is the difference between break and continue commands?
What does it mean to debug a script?
How would you compare the strings in a shell script?
What is another name for a bash shell script that you might see?
What is shell terminal?
How does ls command work?
How to check if the previous command was run successfully?
Explain about debugging?