LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-17-2008, 01:32 PM   #1
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Rep: Reputation: 46
bash command history, page-up


Hey, I am a gentoo guy, but recently I have had to use debian for work.

On gentoo if I start to type a command and hit page up it will look through my history and go to the most recent command I types that started the same way, if I hit page up again it goes to the next, etc. This is not the same as the up and down arrows which just cycle the command history.

On debian however page-up does nothing on the command line.

So, how do I enable the page-up for history fill in on other distros (not just debian, but any) is there a command or something I need to put in bashrc?
 
Old 04-17-2008, 03:19 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
I've not tested this is bash, but it works in tcsh. You would put this in your resource file (so .bashrc or .profile or .login)

Code:
bindkey -k up history-search-backward
bindkey -k down history-search-forward
that will do your described behavior with the up/down arrows rather than pageup/pagedown keys. If you start to type a command then hit up arrow, it will find the last command that started the same way. If you hit the up arrow without typing anything new, it will cycle through the history as expected.

of course, this requires that bindkey is installed

Last edited by BrianK; 04-17-2008 at 03:20 PM.
 
Old 04-17-2008, 06:24 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,805

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
In Kde, you can go to Control Center - Regional & Accessibility - Keyboard Shortcuts and click on the Application shortcuts tab to define your chosen shortcuts. Scroll down to the Text Completion section.
 
Old 04-17-2008, 08:28 PM   #4
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Original Poster
Rep: Reputation: 46
Thank you for the kde response, but

I have 3 reasons for having X.

1) Multiple terminal windows open
2) Media programs like mplayer, audacious, gimp, etc.
3) Web browsing

1 of those and Everything else is command line.

Desktop/wm of choice: fluxbox, cause it stays out of my way.

So no kde, gnome or X solutions please, but I do appreciate the response :-).
 
Old 04-17-2008, 08:39 PM   #5
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
no work in Bash

Quote:
Originally Posted by BrianK View Post
I've not tested this is bash, but it works in tcsh. You would put this in your resource file (so .bashrc or .profile or .login)

Code:
bindkey -k up history-search-backward
bindkey -k down history-search-forward
that will do...
Brian & all -- this is a cool idea, and would give the functionality that the TAB key does not (ie returning a whole line, based on the starting text, rather than just one command at a time with TAB).
However I tried the above suggestion in Bash, and it told me command not found; same for 'bindkeys'.. I tried the man -k for bindkey, but nothing relevant turned up.

Any other idea anyone?

EDIT -- Looks like the section for "READLINE" in the Bash man page has the answer (if there is an answer).. Reading now..

Last edited by GrapefruiTgirl; 04-17-2008 at 08:50 PM.
 
Old 04-17-2008, 10:28 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Bless the good old search ... :D
http://www.linuxquestions.org/questi...rminal-604446/


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where's my bash history? subnet_rx Red Hat 6 02-07-2007 07:35 PM
LXer: CLI Magic: Using command history in the bash shell LXer Syndicated Linux News 0 07-03-2006 01:54 PM
F8 for command history in bash titanandrews Linux - General 7 10-15-2004 04:25 PM
Wiping bash command history? skewer Linux - General 3 07-30-2003 03:33 PM
bash command history problem crabboy Slackware 1 10-17-2002 08:55 PM


All times are GMT -5. The time now is 10:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration