Sunday 29 September 2013

Tips & Tricks to be comfortable on KSH

IBM AIX has ksh as the default shell. I found tremendous few unknown features in ksh.

Set the following on the command line or in your .profile file.

"set -o emacs"

    -- Allows for commands filenames & command completion with "[ESC] [ESC]" ( Hit [ESC] twice).
    -- History of commands can be accessed with "[CTRL]+p" and "[CTRL]+n" key combinations.

"set -o vi"

    -- Allows for commands filenames & command completion with "[ESC] \"(backslash).
    -- History of commands can be accessed with [ESC] once then "k" any number of times for previous command.
    -- History of commands can be accessed with [ESC] once then "j" any number of times for next command.
    -- Press "v" for editing the whole command in a VI editor.
    -- [ESC]-/string - where string is the text string you’re searching for. You can also use the “N” and “n”    to move forward and backward in your searches, respectively.
    -- All other vi keys will work like "^" for starting of the command, "$" for end of command line.

"fc" Operator

    -- IBM AIX has the "r" alias pointing to "fc -e -". Repeat the last command by simply typing the "r" and      the starting part of the previous command.

    -- Example you have used a command "find /var -name '*log*'" And want to execute it again. Simply      type "rf", you will get that command being executed.

"stty erase ^H"

    -- Can be used to set the backspace as the standard CLI deleting key stroke.(To get the ^H, simply type backspace)


1 comment: