How can I run the most recent command again from history in AIX Server? And how to edit the most recent command and run it again in AIX?
what shell are you using?
to edit the command try using fc - it will used the $EDITOR env variable and open up the editor. For example if it's vi then it'll open vi with the command and when you save exit (ZZ or wq) it'll run it.
With bash, you can try
to replay the last command you used. Don't know if it works with Korn.
If you comfortable using vi, the best way is to set your shell editor to vi by running command:
set -o vi
esc-k will give you the last run command
subsequent presses on keys "j" and "k" (both lower case) will take you up and down in the command history.
if you want to edit a line, use keys "h" and "l" (lower case again) to move "left" and "right" respectively. Use "x" to delete character under cursor. Hit "i" to go into insert mode to add characters and words, hit esc again to go back to cursor moving mode. I know it sounds complex and archaic, but if you know vi, these actions come to you like a second nature (and in my opinion, every UNIX sysadmin should learn vi at least in a moderate level)
Having said all of this, you can use the command
set -o emacs
and recall the command history with cursor up/down keys and edit the line with cursor left/right keys. Use backspace and delete keys just like you use them in a DOS prompt. But this requires that you are using a good terminal emulator (PuTTY is fine by the way) and emacs application to be installed properly (most of the time it is fine as it comes with the OS)
I am not sure which one is better for you and which one is more applicable in your case.