Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using the ksh shell. I am not getting any impact of these following commands. It is executing without any error but it is not giving the proper results.

export HISTTIMEFORMAT='%F %T '

Use the Up arrow to view the previous command and press enter to execute it.

Type !! and press Enter from the command line.

Type !-1 and press Enter from the command line.

Press Control+P will display the previous command, press Enter to execute it.

Basically I am not to do anything other than basic history command.

share|improve this question
    
So what happens when you do this? What did you expect to happen? What is not working as expected? Your question is incomprehensible. –  Gilles Feb 8 '13 at 22:50
    
For the information of all.. I am new to UNIX and Linux. I dont know why this question has been treated as not real.. Strange.. –  viswad0Dine Feb 13 '13 at 16:41
    
Look below the question: “It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete (…) and cannot be reasonably answered in its current form”. Edit your question to answer my clarification requests, and we can reopen it. –  Gilles Feb 13 '13 at 17:36
add comment

closed as not a real question by Mikel, rahmu, Gilles, Renan, Mat Feb 9 '13 at 14:38

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 1 down vote accepted

Did you find these commands here: how to find result of last command? Do you realize that is not a correct answer? Do you realize it's talking about bash, not ksh?

To answer the question you asked:

Which version of ksh do you have? You can find out by pressing Ctrl+V or EscCtrl+V, or by running echo $KSH_VERSION.

Why do you think these actions will work? !! and !-1 are for bash, zsh, and csh, not for ksh.

For Ctrl+P to do anything, ensure you are using emacs editing mode by running set -o emacs.

For making the up arrow key work, there are several Google results. Try e.g. this one Make Arrow and Delete keys work in Korn Shell, which says how to do it using the alias command.

share|improve this answer
    
Thanks for this.. I was new to linux and unix world. so I was struggling to articulate this question.. Now I am learning the Linux... Now I have understood these things.. Nw it seems simple.. anyhow thanks for your answer @mikel –  viswad0Dine Mar 21 '13 at 11:44
add comment

Basically, that depends on the particular ksh implementation. For pdksh, for example, the history is enabled by default and is not stored in a file. For some UNIX ksh implementation it requires HISTFILE to be set to enable history. You may try setting it, or check your particular ksh implementation's manual.

Also, depending on the implementation you will or will not be able to use up arrow and other fancy ways to access previous commands. Sometimes you will only have emacs or vi mode and will be able to scroll through history with respective editor's commands.

And just to add, HISTTIMEFORMAT looks more like a bash extension…

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.