Operating System - Tru64 Unix
1752767 Members
4985 Online
108789 Solutions
New Discussion юеВ

How to clean .sh_history

 
SOLVED
Go to solution
Bruno Vilardo
Regular Advisor

How to clean .sh_history

Hello All,

How do i clean up .sh_history file ?

TIA

Bruno

6 REPLIES 6
Joris Denayer
Respected Contributor

Re: How to clean .sh_history

Bruno,

As this is a regular file, I do not see big problems to clear this file with the normal commands as rm, or > or ...

but

What do you really want to accomplish ?
Why do you want to clear your historyfile ?

Maybe this can help us to give you an answer for your problem.

Joris
To err is human, but to really faul things up requires a computer
Bruno Vilardo
Regular Advisor

Re: How to clean .sh_history

I want to empty this file because i dont want other users to see the commands that are logged into this file.
I want to leave it there but i want to empty it.

If i use rm , i am going to delete this file.
is it going to be created again ?

Thanks a lot


Bruno
Hein van den Heuvel
Honored Contributor

Re: How to clean .sh_history

Like Joris said. Just blow it away with with for example:
echo "none of your business" > .sh_history

or vi

or rm and touch

or rm, issue a command and exit


Hein.
Mobeen_1
Esteemed Contributor
Solution

Re: How to clean .sh_history

Bruno,
If you don't want to live any evidence :)), just use any of the means like

Edit the file and delete the lines/commands in there and save it.

Create a new file with the same name

rgds
Mobeen
Michael Schulte zur Sur
Honored Contributor

Re: How to clean .sh_history

Hi Bruno,

in case it is getting too big, you may also rename it and when the last one using it exits, delete or zip it. Any first new login will create a new one.

greetings,

Michael
Nicolas Dumeige
Esteemed Contributor

Re: How to clean .sh_history

If you're using ksh, you can own you own history file :

HISTFILE=~/.hist$$

You can also automaticaly delete the file when logging of with the trap function and ^D for instance.



All different, all Unix