fortypoundhead.com

Linux Command History Feature

Posted On 2007-05-29 by FortyPoundHead
Keywords:
Tags: Linux Commandline Tutorial Linux
Views: 1797


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.

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.

You still have to press enter, but if you remember this nifty feature, you can save a lot of keystrokes and pretend that the computer is actually reading your mind!


About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.158.195.221

Before you can post, you need to prove you are human. If you log in, this test goes away.



Recent Forum Posts

Malicious IP Checker Companion Tool
dwirch posted on August 12, 2017 at about 20:24 in Site News

Job Spammer: Steve Adams
dwirch posted on August 8, 2017 at about 7:44 in Spammers

New security implemented
dwirch posted on August 8, 2017 at about 6:43 in Site News

New security implemented
dwirch posted on July 23, 2017 at about 6:58 in Site News

Fold Code Manager into main KB?
VB6Boy posted on July 22, 2017 at about 14:42 in Site News

Fold Code Manager into main KB?
dwirch posted on July 22, 2017 at about 14:41 in Site News