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 is the syntax of while loop in shell scripting?

1056


How do I start a shell script?

1221


What is sudo command?

1071


What is shell prompt?

1027


What is batch file programming?

1169


how will you find the total disk space used by a specific user?

1058


How to use arguments in a script?

1119


Explain about login shell?

1130


What are zombie processes?

1038


What is scripting autism?

1225


What command needs to be used to take the backup?

1001


Explain about stdin, stdout and stderr?

1188


Given a file find the count of lines containing the word "abc".

1564


How can you find out how long the system has been running?

910


I want to connect to a remote server and execute some commands, how can I achieve this?

1032