News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Command History and Editing

Started by thiruvasagamani, Sep 29, 2008, 10:31 AM

Previous topic - Next topic

thiruvasagamani

Can I Recall Previous Commands?

Command History and Editing

Bash remembers what commands you've recently entered so that you can recall and issue them again easily. If you press the up-arrow key, bash places the contents of the previous command on the command line. Repeatedly pressing the up or down arrow naviga tes through the command history; you can even modify the text in the recalled commands with the left and right arrows, as well as the insert and delete keys, before pressing enter to issue the recalled command.
   
Command Completion: Linux Can Even Read Your Mind

If you're a lazy typist, you'll love this feature. Let's say you have a directory containing the following files:

cars-are-fun
cats-are-bad
dogs-are-good
birds-have-lips

Typing rm cat and then pressing the tab key magically expands your command line to

rm cats-are-bad

matching a file in your current directory that starts with the word cat. The shell looks at what you've typed so far and then checks to see if there is a single file that starts with those characters. If there is, the shell finishes typing that file name for you. If there isn't such a file, nothing happens. If multiple files match, a beep will sound. You can then press tab twice to see all the matches, or just keep typing the filename.

Thiruvasakamani Karnan