1823990 Members
3885 Online
109667 Solutions
New Discussion юеВ

Command History

 
ketan_5
Valued Contributor

Command History

I have rx2600 with 11i version 2. Like in DOS we have 'doskey' memory resident program so that we can call previous commands just by pressing arrow keys and will reduce time spent in typing long repeated commands.
Is it possible in HP Unix ? I am new to unix so pls give complete procedure.

Thanks/Regards,
Ketan
5 REPLIES 5
RAC_1
Honored Contributor

Re: Command History

Check /etc/profile file.

You have to set two things.

HISTFILE=$HOME/.sh_history
HISTFILESIZE=3000

There is no substitute to HARDWORK
Brian Markus
Valued Contributor

Re: Command History

You need to do a few things. You need to add these entries to either your /etc/profile or your ~/.profile

export HISTFILE=$HOME/.sh_history
export HISTFILESIZE=9000

The recall functions will be dependent on your shell. If you are using the POSIX sh that comes with HP-UX by default, at the command prompt you hit escape "k" (no quotes) then keep hitting "k" to scroll through the history. You can also type history at the prompt to view the history of commands. In addition, there will be a ~/.sh_history file with your history of commands in it.

You can also search through the history by hitting the / key after you hit esc-k the first time. Just type a part of a word you've typed before and it will search your history and bring up the closest match.


Hope this helps

-Brian.

When a sys-admin say's maybe, they don't mean 'yes'!
Graham Cameron_1
Honored Contributor

Re: Command History

This came up yesterday...

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=264348

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
MarkSyder
Honored Contributor

Re: Command History

Korn shell specific.

If you type in the command "history" you will be shown the most recent 10 commands. If you want more you can type (e.g.) "history -20" to see the most recent 20 commands. If you want to see so many commands they scroll off the top of the page you would write (e.g.) "history -50|pg".

There are then three ways you can select a command to repeat:

1. Each command will have a number next to it. If you want to repeat command number 123 you would type "r 123".

2. If you wanted to repeat the most recent command that started with the letter p you would type "r p". Please note that you can use more than one letter: if the most recent command that started with p was ps and you wanted to repeat a pg command you could write "r pg".

3. r on its own repeats the last command.

The "escape k" method suggested earlier has the advantage that you can edit the line (especially useful if you made a typo in a long line of text). You cannot edit with "r".
The triumph of evil requires only that good men do nothing
Fabio Ettore
Honored Contributor

Re: Command History

Hi Ketan,

the following actions should satisfy your request:

export HISTFILE=$HOME/.sh_history
export HISTFILESIZE=1000
set -o vi

Also another change is needed. When you login in CDE you should uncomment the following line in $HOME/.dtprofile of user:

DTSOURCEPROFILE=true

Default it is commented.

I hope this helps you.

Bets regards,
Ettore
WISH? IMPROVEMENT!