betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

16 October 2008

Shellfun: Let the past come to haunt you!

Using history-search in ksh

OpenBSD's standard ksh shell has a feature I didn't learn for a long time: It allows you to search through past used commands (the "history" - Other modern shells have similar mechanisms, I'll follow OpenBSD's ksh here anyway.). Most people are familiar with using the arrow keys to go step by step back through the history to re-use a command you used a while ago, instead of typing it in again and again.

But it could get tiresome when you would have to step through a lot of commands to find that clever assortment of pipes and redirections with just the right set of parameters on that command you used 4 hours ago. What you can do there is what man ksh describes as "search-history". You pull it up with ^R (control-r) and start typing a few characters that you remember from your command line. "search-history" will then start to autocomplete with what it finds from your command history. Typing ^R again will get you the "next find" in the list, ^C will cancel the search and of course you can edit the line that you got. As usual, man ksh has a bit more information (grep for "search-history" in there).

Posted by betabug at 09:51 | Comments (0) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< Blow Me Away! | Main | bookstop: An Addition to my Athens bookshop list >>
There are no comments.
You can trackback to:
There are no trackbacks.
Leave a comment