Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 language is bash written in?

981


How to open a read-only file in the shell?

1115


Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.

1139


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 ?

2134


How to get the first line from a file using just the terminal?

1100


How do I edit a .sh file?

1129


Write a script to print the first 10 elements of fibonacci series.

2327


What language is bash?

904


What is the difference between grep and egrep?

1115


What is console line?

952


What is bash shell command?

993


I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

1323


How to use arguments in a script?

1083


What is the use of break command?

1092


Is shell script a programming language?

1011