Wednesday, January 11, 2012

'BUDU AMMO' Mark in command prompt.

[:D ..... Exclamation mark "!"] It's a some kind of a recall command. We can use it to recall a command which we use earlier without typing its all things. [mm... you need an example. Right?]
OK.. lets say you use "ssh root@192.168.0.11" earlier to connect to another machine. And you have already disconnect from it. Again you need to connect to it. So simply what you need to do is type "!ssh" and press enter.
It will grab the rest of that command. You can use it to "cp", "mv" etc...

How it works.
It start to go through its history [means what we have entered previously. You can get it using "history" command. ;)] from bottom to up. [mm... last come first go] It check's whether there are commands start with the given letters. It will execute the first match.

Other ways...
You can use "Ctrl + R" shortcut at the command prompt. Then the prompt becomes like this
(reverse-i-search)`':
then you can start to type your command. It will automatically search a matching command from the history. When you got it, simply you need to press enter.

No comments: