1821402 Members
2767 Online
109633 Solutions
New Discussion юеВ

Deleting command history

 
lydi
Occasional Contributor

Deleting command history

In order to delete command history, I delete .sh_history file....but I still seeing my comman history when I type ctrl-k...how can I do to avoid than ctrl-k show my last commands ????

6 REPLIES 6
Victor BERRIDGE
Honored Contributor

Re: Deleting command history

Hi,
Im not sure what you are doing (ctrl-k ??) but I tell you it would anoy me if you see Esc-k working after doing:
>.sh_history
If it does, then you messed the .sh_history of someone else...
(Be sure to be in you home directory first...)


All the best
Victor
lydi
Occasional Contributor

Re: Deleting command history

yes I'm in my home directory...and ..sorry it is not ctrl-k it's ESC-k.

I can run "pbrun ksh" to have root privileges

Wouter Jagers
Honored Contributor

Re: Deleting command history

I think your last history is saved when you log out of your shell.

Try to log off, log on again and then clear the file. Relog again and try.

If all is well, only the 'clearing the file' command should be in your history.

Cheers
an engineer's aim in a discussion is not to persuade, but to clarify.
lydi
Occasional Contributor

Re: Deleting command history

thanks a lot !!

Wouter Jagers
Honored Contributor

Re: Deleting command history

No problem :-)

If we helped, feel free to assign us some points ;-)

Cheers
an engineer's aim in a discussion is not to persuade, but to clarify.
Bill Hassell
Honored Contributor

Re: Deleting command history

The .sh_history file actually contains some binary codes and will be opened by all shells logged in as this user. So zeroing .sh_history will remove the file contents but other open shells may still have cached data available. Removing the contents of .sh_history is not a normal task so the behavior can be a bit unpredictable.

If you do not want a shell history to be kept at all, you can use a (poor) workaround in .profile:

export HISTFILE=/dev/null

then login again.


Bill Hassell, sysadmin