1832666 Members
3164 Online
110043 Solutions
New Discussion

Command History

 
Frank,Hong
Occasional Advisor

Command History

Dear all again:
How can I get the command history by pressing UP key or others?
I connect to the OVO server by Reflection X,does it work?
4 REPLIES 4
Muthukumar_5
Honored Contributor

Re: Command History

Which shell you are using.? Is it ksh?

Do find it then,

in shell prompt,

# echo $SHELL

if it is ksh then,

use as,

# /
# /

hth.
Easy to suggest when don't know about the problem!
MarkSyder
Honored Contributor

Re: Command History

If you're using korn shell:

esc k gives you the last command

history gives you (by default) the last ten commands.

history -n gives you the last n commands: e.g. history -20 gives you 20 commands.

The output will be similar to this:

121 cd
122 ll

You can then run r 121 to repeat the cd command.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Muthukumar_5
Honored Contributor

Re: Command History

Is history enabled on your machine.? Check as by executing,

# history (in shell prompt)

If it is showing then no problem.

Else,

# export -o vi
# export HISTFILE=$HOME/.sh_history
# export HISTSIZE=2500

in command line or put it in,

$HOME/.dtprofile file

hth.
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Command History

Its depends on which shell you use. If you have bash installed, you can get it by UP keys.

http://hpux.connect.org.uk/hppd/hpux/Shells/bash-3.00.16/

or, in KSH, you have to enable history option in your .profile

export -o vi
export HISTFILE=$HOME/.sh_history

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"