command history

command history

Post by Paul Hasting » Sat, 18 Aug 2001 01:04:09



On 4.3.2, is there a way to use the arrow keys to recall the last few
commands entered, so that you do not have to retype a long string over and
over?
 
 
 

command history

Post by nos.. » Sat, 18 Aug 2001 01:22:50



> On 4.3.2, is there a way to use the arrow keys to recall the last
> few commands entered, so that you do not have to retype a long
> string over and over?

That's not an AIX thing, it's a shell thing. Most shells today can do
command line recall/editing. Which one are you using? What's the
output of 'echo $0'?

 
 
 

command history

Post by Matthew Land » Sat, 18 Aug 2001 03:17:45



> On 4.3.2, is there a way to use the arrow keys to recall the last few
> commands entered, so that you do not have to retype a long string over and
> over?

For KSH shell (default for AIX), you can try one of the following
methods.

1) If you are a VI person,  put `set -o vi` in the .profile.  Then you
can use all the standard VI commands on the command line.  To go up one
line hit `ESC k`.  Then just 'k' each time after that.  Note VI uses
ESC to get into command mode and doesn't need ESC again until
in edit mode.

2) If you uare an emacs person, `set -o emacs` in the .profile.  Then you
can use the standard emacs commands on the command line... Ctrl-p Ctrl-N,
etc.

3) If you are neither a VI person nor an emacs person and all you want
is to be able to use the arrow keys, you can do the following:

#edit your .profile with VI.  You need to use VI since it can easily
# type ^X as one char (i.e. Ctrl-V Ctrl-P).  Emacs will do cursor movement.
set -o emacs
alias __A='^P'  # up      <Ctrl>P  NOT ^ then P
alias __B='^N'  # down    <Ctrl>N  NOT ^ then N
alias __C='^F'  # right   <Ctrl>F  NOT ^ then F
alias __D='^B'  # left    <Ctrl>B  NOT ^ then B
alias __H='^A'  # home    <Ctrl>H  NOT ^ then H
alias __K='^E'  # end     <Ctrl>E  NOT ^ then E

 - Matt

--
_______________________________________________________________________

  IBM High Speed Interconnect - Fibre Channel I/O Dev/Test/Support
   << Comments, views, and opinions are mine alone, not IBM's. >>

 
 
 

command history

Post by Michael Jooste » Tue, 21 Aug 2001 23:28:14



> 3) If you are neither a VI person nor an emacs person and all you want
> is to be able to use the arrow keys, you can do the following:

> #edit your .profile with VI.  You need to use VI since it can easily
> # type ^X as one char (i.e. Ctrl-V Ctrl-P).  Emacs will do cursor movement.
> set -o emacs
> alias __A='^P'  # up      <Ctrl>P  NOT ^ then P
> alias __B='^N'  # down    <Ctrl>N  NOT ^ then N
> alias __C='^F'  # right   <Ctrl>F  NOT ^ then F
> alias __D='^B'  # left    <Ctrl>B  NOT ^ then B
> alias __H='^A'  # home    <Ctrl>H  NOT ^ then H
> alias __K='^E'  # end     <Ctrl>E  NOT ^ then E

Slight addition: What ^V is for VI, is ^Q (mnemonic: quote) is Emacs. So
you'd use ^Q^P to insert a ^P here.

--

Fuerstenallee 11, 33094 Paderborn, Germany
Phone: +49 5251 606127, Fax: +49 5251 606065
C-LAB is a cooperation of University Paderborn & SIEMENS

 
 
 

1. Date stamping commands in the shell command history file

Hi All,

I need to date stamp commands in the history file as the subject says.

I am using the Korn shell with the default history file (.sh_history and
size of 128.

I have tried things like PS1='$(date>>$HOME/.sh_history)\$' in the
profile.  This works when you log in but doesn't work after that.

How can I get it to work every time the prompt is displayed??

I presume that I'm on the right track trying to modify the primary prompt.
I know that I could do an alias for each command and script for the 30 - 40
that we commonly use but that wouldn't cover all commands.

Any help is much appreciated.

TIA
Craig

2. Ftape I/O error??

3. ksh: 2 Q's, command completion & command history?

4. Linux And Windows 95

5. no command history with ksh as root?

6. Apache 1.3.6 strange DNS Behavior

7. tcsh - command history between shells

8. Installation of JDKEE on Redhat 7.2

9. TCSH command history editing

10. Born shell (sh) commands history

11. Need help with scrooling back through command history

12. HELP! Command History in csh

13. Adding date/time information to unix command history