Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This is a little embarrassing but I'm unable to delete the root user shell history from a FreeBSD 10.0 server. The root user is using the default csh.

I've tried the classic history -c command to clean up the history and it works... until I logout and login on the server again.

Tried to remove the ~/.history file without success too.

Any ideias of what to do?

share|improve this question

5 Answers 5

This command:

rm /root/.history

should do what you're after, though it may be getting written back out when you logout. If you simply want history never stored, you could do this:

echo > /root/.history
chflags schg /root/.history

which empties the file then sets it immutable.

share|improve this answer
I'm voting up your answer, but I've already done the rm option and it was no effect, which is insane to me. I've tried even rewriting the history file with not effect. –  Vinícius Ferrão Jul 4 '14 at 2:51
You must remove the history file and clear your shell's history; otherwise the shell will write out to the history file everything it read in when it initialized. Making the file immutable is overkill. Additionally, the variable histsize can be set to zero to disable history. –  Michael Lowman Dec 30 '14 at 0:50

Not 100% sure if HISTSIZE variable exists in (t)csh, but it might.

So try with

setenv HISTSIZE 0
rm -f /root/.history

And see if it helps.

share|improve this answer

This might works for you too not sure for (t)csh shell

history -w


rm .bash_history
share|improve this answer

If you are looking to clear your history (On FreeBSD 10.1 w/ (t)csh).

echo > /root/.history && history -c

share|improve this answer

To disable history for tcsh/csh type the following:

unset history; unset savehist

or you can also do the following:

set history = 0; set savehist = 0

Either one will disable history from being saved.

You can also edit the ~.cshrc file and change the following:

set history = 1000 
set histsave = 1000


set history = 0 
set histsave = 0

Then everytime you login to your server it will keep history commands from being saved.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.