Executing last command in ksh

11,865

Solution 1

r, or Control + P. Korn shell doesn't implement csh/bash-style history, but you can manipulate the command history with fc (r is an alias for an fc invocation), or with set -o emacs or set -o vi you can use editor commands to search and modify previous commands.

Solution 2

Use fc -s (SOME letter of last executed command)

like if the last executed command was cat sample.txt

use fc -s ca

Share:
11,865
n-2r7
Author by

n-2r7

Updated on June 27, 2022

Comments

  • n-2r7
    n-2r7 almost 2 years

    I am running Solaris and I was wondering how to run the last command with ksh. I know that in bash/sh you can do "!!" for the last command and !-N for "N minus the last command." What is the equivalent in KSH? Thank you in advance.