The easy way: try to put in your "~/.profile" this lines:
If this wouldn't work there is always a hard way.
1. You should know what key sequence your cursor keys send. The most terminal emulators send
<ESC>[A - up
<ESC>[B - down
<ESC>[C - right
<ESC>[D - left
But it may be different for your terminal (and they are very different, for example, for PgDn, PgUp, etc.)
Another variant they cand send <ESC>OA, <ESC>OB, etc...
You can try to check this pressing <CTRL>V key and then <Up> cursor key. If it doesn't work (but I believe it should) you can try run "cat" and use the same combination (it's necessary that your kernel supports lnext control character - maybe you can see this with "stty -a" command). The last resort is to use "vi" and use again this combination in input mode.
If you see some output after this key pressing it is should be like this: "^[[A" The first two keys are actually the one <ESC> key.
2. Then you need to learn what file you can use to write your settings. This is really depends on your shell. If you login in text console then to change ".profile" in your home directory would be enough. But if you use some kind of DE, then it may be ".kshrc" (for the latest ksh93) or ".mkshrs" (for mksh) or more likely you need to set your ENV variable to the name of your .rc (run commands) file in your .profile or something else (it depens on you system - it can be "~/.pam_environment", for example). Try to add this in your "~/.profile":
Then relogin and see what "echo $ENV" prints.
3. Now the final part. At the first add to your "rc" or ".profile"
Then your keys in ksh will act like keys in emacs editor. This mode is much more intuitive for novices. Even if you know or learn vi, emacs mode for shell is better choice. And I believe it is more hard (if possible) to assign cursor keys to work in ksh vi mode.
I assume that your attempt with "alias __A" doesn't work. So you should use some black magic:
Of course, you should change $'\e[A' to $'\eOA' if your terminal send these key sequences for cursor keys.
Hope, this can help.
Regards, yazu.
PS You can try to learn your ksh version using this keys: <ESC> and then <CTRL>V.
Last edited by yazu; 08-07-2011 at 02:25 AM..
Reason: PS
Hi,
I remember in my previous project, I used UP arrow button to recall previous unix commands (using putty on Sun OS), which I am not able to do in my new project... I do not know if this is some project specific settings or not...
when I press UP arrow button, all I get is ^. I have to... (3 Replies)
Hi Guys,
I am running RHEL5, I am trying to find out the history of the cammands that were executed on my server.
I have files that are missing I just want to find out what happened to them.
I used history | more but I can't find anything related to my query.
I also checked... (1 Reply)
i have several boxes running either ubuntu, redhat or solaris.
there are multiple people with root access on these boxes. i really dont like people looking through my command history, is there a way i can prevent this?
what files do i have to edit to prevent anyone from being able to see what... (7 Replies)
Hello every body,
Kindly inform me How Do i find out the time I executed a command previously on UNIX Solaris??
To be more specific and more clear about what i want to know is that I want a command the enables me to know the history and which command i run at this history/time.
FYI I used... (5 Replies)
Hi Solaris guys,
I just have my solaris 10 setup on x86 old box...
How can i get history key?
eg.
Linux using up/down arrow key to call history command...
HPUX using Esc-k
How can i do the samething in Solaris?
Thanks in advanced!
Regards,
gary (3 Replies)
I would like to log all the commands I type (on the terminal) to a file. The command "history" does this only for current terminal only. I typically keep around 10 terminals open.
Thanks,
j
Note: I do not have root access. (2 Replies)
how do I make my arrow keys behave like they are on DOS.
ALSO i need editing on command promt like it is on DOS on my UNIX prompt
can anyone help pl.. (11 Replies)