LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   how to search command history beginning with what you type (http://www.linuxquestions.org/questions/linux-desktop-74/how-to-search-command-history-beginning-with-what-you-type-789471/)

xiawinter 02-16-2010 07:51 AM

how to search command history beginning with what you type
 
in opensuse (from version 10.3 to newest), it supports shift + up/down when typing command in the terminal, which prompts the command history beginning with the typed words. The feature comforts the experience navigating in the command history, but it differs from CTRL +R. I dislike it.

Does it achieved from alias in bashrc? how can it be enabled in ubuntu?


I moved to ubuntu because of driver(wireless) problems, but I'm missing it whenever I type a word in the terminal.

Thanks for your helps.

Updated: How can we search the command history beginning with the typed words in the terminal?

pixellany 02-16-2010 08:13 AM

"shift + page up" normally is used for paging in a terminal. I have never seen the behavior you are describing.

What terminal program were you using in SUSE?

xiawinter 02-16-2010 08:26 AM

sorry for the confusion. I didn't mean page up, but the up arrow.

I used gnome-terminal on opensuse 10.3,11.0, but this feature is not available on ubuntu/debian gnome-terminal.

thanks for quick replys.

pixellany 02-16-2010 08:30 AM

On my system(KDE/Konsole), "shift + up arrow" moves up one line. "up arrow" alone steps thru the command history. (the latter is the same on all terminals I have ever used.)

Have you tried looking in the preferences for gnome-terminal?

xiawinter 02-16-2010 08:39 AM

no, I didn't and I can't now because I don't have a suse installed computer.

I think it's something set in alias.

so let me change the question to "how to search command history beginning with the typed words in the terminal?"

pixellany 02-16-2010 08:45 AM

Quote:

I think it's something set in alias.
probably not--alias is not used for configuring the behavior of key combinations.
Quote:

so let me change the question to "how to search command history beginning with the typed words in the terminal?"
You are looking for "tab completion". Type a few letters and then hit the tab key.

xiawinter 02-16-2010 09:12 AM

it should be not the tab key, which I use quite a lot to complete the command.

for example, I previously typed a command

Code:

ssh -D 1234 abc@host.com
and while I'm typing ssh in the terminal, the idea comes to my mind that I have ever used a ssh command, so instead of typing -D continually, I type shift +up to recall the full command.

CTRL +r doesn't help when you have words typed in the terminal except repeating typing the search keywords and ctrl r to retrieve from the command history.

I think the feature I'm expecting is something like
Code:

!ssh
but I want the alternatives because the types words are not unique.

cmsuser 02-17-2010 10:26 AM

ubuntu
 
Quote:

Originally Posted by pixellany (Post 3865594)
On my system(KDE/Konsole), "shift + up arrow" moves up one line. "up arrow" alone steps thru the command history. (the latter is the same on all terminals I have ever used.)

Have you tried looking in the preferences for gnome-terminal?

when i login as another user and I press up I don't get my command history, vs when I'm logged in as the "main" user on my system. do you know what configuration I'm missing?

tredegar 02-17-2010 03:12 PM

..
Quote:

when i login as another user and I press up I don't get my command history..[SNIP].. do you know what configuration I'm missing?
Yes, there is nothing missing.

This is normal behaviour.

history is user-specific. It gives the command history for the current user.

If you log in as another user, you'll get their history, not yours

When you think about it, this is very sensible behaviour.

Welcome to LQ, but in future, please start a new thread when you have a new question, don't "hijack" an established thread (even though it might seem to be related). This just keeps the threads tidy and easier to follow.

simeos 10-05-2010 03:58 AM

Quote:

Originally Posted by xiawinter (Post 3865605)
so let me change the question to "how to search command history beginning with the typed words in the terminal?"

I search to do the same thing, I found somewhere that you can add :
Code:

# MATLAB style search
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char

to your /etc/inputrc.
With this you can found in your command history a command beginning with what you typped, by using up and down arrows. That the behaviour of Matlab command line.

hope it helps


All times are GMT -5. The time now is 05:19 AM.