Operating System - HP-UX
1748181 Members
3835 Online
108759 Solutions
New Discussion юеВ

Re: RE : Repeat the last command type

 
SOLVED
Go to solution
Charles Ooi Chia Lun
Occasional Advisor

RE : Repeat the last command type

Hi Sir,
i've installe HP-UX on Hp integrity rx2600.
How to repeat the last command typed in HP-Ux?
Please advise , thanks.
6 REPLIES 6
Zigor Buruaga
Esteemed Contributor

Re: RE : Repeat the last command type

Hi,

Enable the shell history by adding these lines to your profile ( or /etc/profile if you want it for all users ):

HISTFILE=$HOME/.sh_history
HISTSIZE=1000
export HISTFILE HISTSIZE

Then log out and log on again. Press "Esc" key, and then "k" key to "navigate" through your previous commands.

Regards,
Zigor
Kurt Beyers.
Honored Contributor
Solution

Re: RE : Repeat the last command type

Charles,

Or just type 'ksh -o vi'.

The previous commands can be accessed by 'Esc - k'.

Kurt
lawrenzo
Trusted Contributor

Re: RE : Repeat the last command type

you can also add ksh -o vi to /home//.profile

so every time you login history is set

HTH
hello
MarkSyder
Honored Contributor

Re: RE : Repeat the last command type

If you're using a korn shell (as advised in previous replies) type the word history to see the last ten commands. The output will be similar to this:

121 cd
122 ll

(ten lines in all).

r 121 will repeat command number 121 (cd).

If you want more than 10 lines, type history -n, where n is the number of commands you want to see: e.g. history -20 will produce 20 lines.

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

Re: RE : Repeat the last command type

You have to setup history support with shell. Try to add in /etc/profile as,

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

and save it.

For future login, it will give you history of commands.

To get prev. command then,

a) Esc k
b) Esc /

hth.
Easy to suggest when don't know about the problem!
B. Hulst
Trusted Contributor

Re: RE : Repeat the last command type

In some shell the command:

!!

repeats the last command you typed.

Regards,
Bob