You are not logged in.

#1 2012-05-06 13:27:57

Milad
Member
Registered: 2012-03-19
Posts: 9

[Solved] history -c won't work

I was trying to clear the bash history list using:

 history -c 

But it does not work. Actually when I close the terminal and reopen it the history is still there...

Last edited by Milad (2020-05-02 16:45:06)

Offline

#2 2012-05-06 14:26:27

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: [Solved] history -c won't work

Doesn't "history -c" just clear the history saved in RAM (not what's actually saved in ~/.bash_history)? Someone please correct me if I'm wrong here (not 100% sure of this).


Burninate!

Offline

#3 2012-05-06 14:54:12

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] history -c won't work

Gcool wrote:

Doesn't "history -c" just clear the history saved in RAM (not what's actually saved in ~/.bash_history)? Someone please correct me if I'm wrong here (not 100% sure of this).

The command will not work from a terminal emulator.  You still have bash running when you close the terminal emulator.  All you are clearing is that terminal instance's history.  To completely clear the history file with the command 'history -c', you need to run it from the login shell.

You could use this to clear the history file:

$ > ~/.bash_history

Offline

#4 2012-05-06 15:14:17

Milad
Member
Registered: 2012-03-19
Posts: 9

Re: [Solved] history -c won't work

Thank you so much. Marked as solved.

Last edited by Milad (2020-05-02 16:45:45)

Offline

Board footer

Powered by FluxBB