Re: shell history and page-up
On Mon, Apr 6, 2009 at 8:10 PM, Chris wrote: > On Tue, Apr 7, 2009 at 10:04 AM, Nick Guenther wrote: >> On Mon, Apr 6, 2009 at 7:54 PM, Chris wrote: >>> On Mon, Apr 6, 2009 at 6:13 PM, J.C. Roberts >>> wrote: If you are using ksh, and the above keys/key-combos do not work, then you have screwed around with the default ksh settings, or you are using a garbage terminal emulator that is screwing with the key-bindings. >>> >>> The problem was with "export EDITOR=vi" in ~/.profile. I removed it >>> and all good now. >>> >> >> ..huh? How? > > Not sure how but if I put "export EDITOR=vi" or "export > EDITOR=/usr/bin/vi" in .profile, page-up (or page-down) don't work > anymore. > And you really do mean page-up right? Not arrow-up? I just tried and you're right. The ksh manpage says: VISUAL If set, this parameter controls the command-line editing mode for interactive shells. If the last component of the path specified in this parameter contains the string ``vi'', ``emacs'', or ``gmacs'', the vi, emacs, or gmacs (Gosling emacs) editing mode is enabled, respectively. See also the EDITOR parameter, above. -Nick
Re: shell history and page-up
On Tue, Apr 7, 2009 at 10:04 AM, Nick Guenther wrote: > On Mon, Apr 6, 2009 at 7:54 PM, Chris wrote: >> On Mon, Apr 6, 2009 at 6:13 PM, J.C. Roberts >> wrote: >>> If you are using ksh, and the above keys/key-combos do not work, then >>> you have screwed around with the default ksh settings, or you are using >>> a garbage terminal emulator that is screwing with the key-bindings. >> >> The problem was with "export EDITOR=vi" in ~/.profile. I removed it >> and all good now. >> > > ..huh? How? Not sure how but if I put "export EDITOR=vi" or "export EDITOR=/usr/bin/vi" in .profile, page-up (or page-down) don't work anymore.
Re: shell history and page-up
On Mon, Apr 6, 2009 at 7:54 PM, Chris wrote: > On Mon, Apr 6, 2009 at 6:13 PM, J.C. Roberts wrote: >> If you are using ksh, and the above keys/key-combos do not work, then >> you have screwed around with the default ksh settings, or you are using >> a garbage terminal emulator that is screwing with the key-bindings. > > The problem was with "export EDITOR=vi" in ~/.profile. I removed it > and all good now. > ..huh? How?
Re: shell history and page-up
On Mon, Apr 6, 2009 at 6:13 PM, J.C. Roberts wrote: > If you are using ksh, and the above keys/key-combos do not work, then > you have screwed around with the default ksh settings, or you are using > a garbage terminal emulator that is screwing with the key-bindings. The problem was with "export EDITOR=vi" in ~/.profile. I removed it and all good now.
Re: shell history and page-up
On Mon, 6 Apr 2009 14:55:12 +1000 Chris wrote: > On Thu, Apr 2, 2009 at 3:00 PM, Nick Guenther > wrote: > > On Thu, Apr 2, 2009 at 12:58 AM, Chris wrote: > >> On Thu, Apr 2, 2009 at 3:55 PM, Nick Guenther > >> wrote: > >>> On Thu, Apr 2, 2009 at 12:52 AM, Chris wrote: > On Thu, Apr 2, 2009 at 3:46 PM, Nick Guenther > wrote: > > On Thu, Apr 2, 2009 at 12:37 AM, Chris > > wrote: > >> I am trying to get the shell history with page-up but looks > >> like it's not working. I'm running -current with the default > >> ksh and added HISTSIZE=50 and export HISTSIZE to ~/.profile. > >> > >> Does anyone know how to get it? > > > > I've never seen it not work. Does it work for you on -RELEASE? > > Does it work if you don't set HISTSIZE at all? > > No, it doesn't work either way. Maybe I should mention that it's > only a test machine so I didn't create a swap partition (it has > only one 6 GB / partition) - could this be the reason why? > > Thanks. > >>> > >>> > >>> I doubt it but I don't know the code off by heart. A more likely > >>> reason is your terminal settings, what's $TERM? > >> > >> You are right: it's something to do with the $TERM environment > >> variable. I ssh to the box from inside GNU screen so $TERM shows > >> screen; OTOH, if I log on to the box directly, $TERM shows vt220. > >> > >> Should I export term vt220 in .profile? > >> > > > > Oh you're using screen? Does the problem show up when you don't use > > screen? > > Yes, it does. I am ssh'ing to the OpenBSD box using Xterminal emulator > that comes with XFCE. When I log in, it shows terminal as xterm and > Page up don't work. If I change the terminal to vt220 (export > TERM=vt220 && echo $TERM), it shows vt220 but page up still doesn't > work. The only time page up works is when I log on via the physical > console. > In short, there is *no* default mapping in ksh for PageUp and PageDown. Surprisingly enough, your shell history, and how it is accessed, depends, for the most part, on the shell you are using. If you look at your configuration files for the C shell, ~/.login and ~/.chsrc, in the first you'll find 'savehist' and in the second you'll find the 'h' alias for accessing the shell history. The default shell on OpenBSD is no longer the C Shell, but instead is a variant of the Korn Shell (ksh). If you take the time to read the man page for ksh, you'll find that 'history' is just a *default* alias for the `fc -l` command. Your main problem is mistaken perception; you are expecting UNIX to behave like GNU crap (bash/screen/whatever). If you are running the default system shell, namely ksh(1), you can access the history, line by line, in two different ways: 1.) The Up-Arrow and Down-Arrow keys 2.) The CTRL-P (Previous, also known as "up-history") and CTRL-N (Next, also known as "down-history") key combinations. The ksh(1) man page even details the exact default key bindings used to make the Up and Down Arrow keys access the shell history. If you are using ksh, and the above keys/key-combos do not work, then you have screwed around with the default ksh settings, or you are using a garbage terminal emulator that is screwing with the key-bindings. The terminal emulator in XFCE is stupidly named "Terminal" and like all terminal emulators, has it's own set of quirks, conflicts and limitations. The "GNU screen" program is terminal multiplexer and has countless quirks, conflicts and bugs, in addition to a virus license. Unless you are using the default xterm(1), without modification, it's nearly impossible to tell what kind of remapping/rebinding your terminal emulator is doing, assuming it's doing any rebinding/remapping. None the less, in ksh you can set your own bindings. To get a list of existing bindings, just run the `bind` command without arguments. # UpArrow - up-history - works (default) # ^XA = up-history $ bind '^[[A'=up-history # DownArrow - down-history - works (default) # ^XB = down-history $ bind '^[[B'=down-history # RightArrow - forward-char - works (default) # ^XC = forward-char $ bind '^[[C'=forward-char # LeftArrow - backward-char - works (default) # ^XD = backward-char $ bind '^[[D'=backward-char These two are useful additions: # End Key - Goto Last Character In Line - works # ^XF = end-of-line $ bind '^[[F'=end-of-line # Home Key - Goto First Character In Line - works # ^XH = beginning-of-line $ bind '^[[H'=beginning-of-line Unfortunately, I've got no clue what the correct eXtra-key binding is for the PageUp and PageDown keys. I thought they were either ^XI and ^XG, or ^XJ and ^XK, but both of those combinations are wrong. # PageUp Key - broken # ^XI = up-history # ^XJ = up-history $ bind '^[[I'=up-history # PageDown Key - broken # ^XG = down-history # ^XK = down-history $ bind '^[[G'=down-history If you spend enough time digging through termcap/terminfo you'll probably figure out the correct magic for PgUp and
Re: shell history and page-up
On Thu, Apr 2, 2009 at 3:00 PM, Nick Guenther wrote: > On Thu, Apr 2, 2009 at 12:58 AM, Chris wrote: >> On Thu, Apr 2, 2009 at 3:55 PM, Nick Guenther wrote: >>> On Thu, Apr 2, 2009 at 12:52 AM, Chris wrote: On Thu, Apr 2, 2009 at 3:46 PM, Nick Guenther wrote: > On Thu, Apr 2, 2009 at 12:37 AM, Chris wrote: >> I am trying to get the shell history with page-up but looks like it's >> not working. I'm running -current with the default ksh and added >> HISTSIZE=50 and export HISTSIZE to ~/.profile. >> >> Does anyone know how to get it? > > I've never seen it not work. Does it work for you on -RELEASE? Does it > work if you don't set HISTSIZE at all? No, it doesn't work either way. Maybe I should mention that it's only a test machine so I didn't create a swap partition (it has only one 6 GB / partition) - could this be the reason why? Thanks. >>> >>> >>> I doubt it but I don't know the code off by heart. A more likely >>> reason is your terminal settings, what's $TERM? >> >> You are right: it's something to do with the $TERM environment >> variable. I ssh to the box from inside GNU screen so $TERM shows >> screen; OTOH, if I log on to the box directly, $TERM shows vt220. >> >> Should I export term vt220 in .profile? >> > > Oh you're using screen? Does the problem show up when you don't use screen? Yes, it does. I am ssh'ing to the OpenBSD box using Xterminal emulator that comes with XFCE. When I log in, it shows terminal as xterm and Page up don't work. If I change the terminal to vt220 (export TERM=vt220 && echo $TERM), it shows vt220 but page up still doesn't work. The only time page up works is when I log on via the physical console.
Re: shell history and page-up
Chris wrote: > I am trying to get the shell history with page-up but looks like it's > not working. I'm running -current with the default ksh and added > HISTSIZE=50 and export HISTSIZE to ~/.profile. > > Does anyone know how to get it? > > Thanks. $ grep HIST .profile HISTFILE=$HOME/.history HISTSIZE=1024 works. Arrow-up though, not page-up. /Alexander
Re: shell history and page-up
Chris wrote: > I am trying to get the shell history with page-up but looks like it's > not working. Do you really mean page-up, not cursor-up? -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: shell history and page-up
On 2 April 2009 c. 08:37:25 Chris wrote: > I am trying to get the shell history with page-up but looks like it's > not working. I'm running -current with the default ksh and added > HISTSIZE=50 and export HISTSIZE to ~/.profile. > > Does anyone know how to get it? >From the ksh(8): Note: If HISTFILE isn't set, no history file is used. This is different from the original Korn shell, which uses $HOME/.sh_history; in the future, pdksh may also use a default history file. And, BTW, you don't need to export those variables. -- Best wishes, Vadim Zhukov A: Because it messes up the way people read text. Q: Why is a top-posting such a bad thing?
Re: shell history and page-up
On Thu, Apr 2, 2009 at 12:58 AM, Chris wrote: > On Thu, Apr 2, 2009 at 3:55 PM, Nick Guenther wrote: >> On Thu, Apr 2, 2009 at 12:52 AM, Chris wrote: >>> On Thu, Apr 2, 2009 at 3:46 PM, Nick Guenther wrote: On Thu, Apr 2, 2009 at 12:37 AM, Chris wrote: > I am trying to get the shell history with page-up but looks like it's > not working. I'm running -current with the default ksh and added > HISTSIZE=50 and export HISTSIZE to ~/.profile. > > Does anyone know how to get it? I've never seen it not work. Does it work for you on -RELEASE? Does it work if you don't set HISTSIZE at all? >>> >>> No, it doesn't work either way. Maybe I should mention that it's only >>> a test machine so I didn't create a swap partition (it has only one 6 >>> GB / partition) - could this be the reason why? >>> >>> Thanks. >> >> >> I doubt it but I don't know the code off by heart. A more likely >> reason is your terminal settings, what's $TERM? > > You are right: it's something to do with the $TERM environment > variable. I ssh to the box from inside GNU screen so $TERM shows > screen; OTOH, if I log on to the box directly, $TERM shows vt220. > > Should I export term vt220 in .profile? > Oh you're using screen? Does the problem show up when you don't use screen?
Re: shell history and page-up
On Thu, Apr 2, 2009 at 3:55 PM, Nick Guenther wrote: > On Thu, Apr 2, 2009 at 12:52 AM, Chris wrote: >> On Thu, Apr 2, 2009 at 3:46 PM, Nick Guenther wrote: >>> On Thu, Apr 2, 2009 at 12:37 AM, Chris wrote: I am trying to get the shell history with page-up but looks like it's not working. I'm running -current with the default ksh and added HISTSIZE=50 and export HISTSIZE to ~/.profile. Does anyone know how to get it? >>> >>> I've never seen it not work. Does it work for you on -RELEASE? Does it >>> work if you don't set HISTSIZE at all? >> >> No, it doesn't work either way. Maybe I should mention that it's only >> a test machine so I didn't create a swap partition (it has only one 6 >> GB / partition) - could this be the reason why? >> >> Thanks. > > > I doubt it but I don't know the code off by heart. A more likely > reason is your terminal settings, what's $TERM? You are right: it's something to do with the $TERM environment variable. I ssh to the box from inside GNU screen so $TERM shows screen; OTOH, if I log on to the box directly, $TERM shows vt220. Should I export term vt220 in .profile? Thanks.
Re: shell history and page-up
On Thu, Apr 2, 2009 at 12:52 AM, Chris wrote: > On Thu, Apr 2, 2009 at 3:46 PM, Nick Guenther wrote: >> On Thu, Apr 2, 2009 at 12:37 AM, Chris wrote: >>> I am trying to get the shell history with page-up but looks like it's >>> not working. I'm running -current with the default ksh and added >>> HISTSIZE=50 and export HISTSIZE to ~/.profile. >>> >>> Does anyone know how to get it? >> >> I've never seen it not work. Does it work for you on -RELEASE? Does it >> work if you don't set HISTSIZE at all? > > No, it doesn't work either way. Maybe I should mention that it's only > a test machine so I didn't create a swap partition (it has only one 6 > GB / partition) - could this be the reason why? > > Thanks. I doubt it but I don't know the code off by heart. A more likely reason is your terminal settings, what's $TERM? -Nick
Re: shell history and page-up
On Thu, Apr 2, 2009 at 3:46 PM, Nick Guenther wrote: > On Thu, Apr 2, 2009 at 12:37 AM, Chris wrote: >> I am trying to get the shell history with page-up but looks like it's >> not working. I'm running -current with the default ksh and added >> HISTSIZE=50 and export HISTSIZE to ~/.profile. >> >> Does anyone know how to get it? > > I've never seen it not work. Does it work for you on -RELEASE? Does it > work if you don't set HISTSIZE at all? No, it doesn't work either way. Maybe I should mention that it's only a test machine so I didn't create a swap partition (it has only one 6 GB / partition) - could this be the reason why? Thanks.
Re: shell history and page-up
On Thu, Apr 2, 2009 at 12:37 AM, Chris wrote: > I am trying to get the shell history with page-up but looks like it's > not working. I'm running -current with the default ksh and added > HISTSIZE=50 and export HISTSIZE to ~/.profile. > > Does anyone know how to get it? I've never seen it not work. Does it work for you on -RELEASE? Does it work if you don't set HISTSIZE at all? -Nick
shell history and page-up
I am trying to get the shell history with page-up but looks like it's not working. I'm running -current with the default ksh and added HISTSIZE=50 and export HISTSIZE to ~/.profile. Does anyone know how to get it? Thanks.