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
What language is bash written in?
How to open a read-only file in the shell?
Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.
Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?
How to get the first line from a file using just the terminal?
How do I edit a .sh file?
Write a script to print the first 10 elements of fibonacci series.
What language is bash?
What is the difference between grep and egrep?
What is console line?
What is bash shell command?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
How to use arguments in a script?
What is the use of break command?
Is shell script a programming language?