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 can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?
How are shells born?
How to calculate the number of passed arguments?
What makes c shell a more preferable option than the bourne shell?
What are the advantages of using shell scripts?
Write down the syntax of "for " loop
Explain about login shell?
How will you copy a file from one machine to other?
What is a shell environment?
Explain about sourcing commands?
How would you compare the strings in a shell script?
Determine the output of the following command: [ -z “” ] && echo 0 || echo 1
Explain about return code?
What is the difference between bash and shell?
Tell something about the super block in shell scripting?