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


Please Help Members By Posting Answers For Below Questions

What are "c" and "b" permission fields of a file?

564


Explain about return code?

633


What does $@ mean in shell?

592


shell script for reverse the string

919


How do I run a script from command prompt?

562






How to redirect both standard output and standard error to the same location?

635


What is meant by dos operating system?

575


What are the different variables present in linux shell?

613


What does $@ mean bash?

669


How can the contents of a file inside jar be read without extracting in a shell script?

594


What language is shell scripting?

581


What are the disadvantages of shell scripting?

638


Is shell scripting difficult?

559


How do I open a jshell in cmd?

598


What are the different commands available to check the disk usage?

495