Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Deleting Terminal History

Oct 9, 2005 2:46PM PDT

Hi, I'm just wondering how you can delete Terminal history? I have googled it but found nothing really relavent. I want to make it so that when you press the up arrow you can't see any entries that have been entered.

Discussion is locked

- Collapse -
Have not
Oct 9, 2005 9:53PM PDT

come across this little gem, yet.
Is there any relevance to wanting to delete the history? Prying eyes should have an account that does not include Terminal

P

- Collapse -
I'm thinking something like '.bashhistory'
Oct 10, 2005 12:13AM PDT

From the Unix/Linux world, the history is in a simple .text file of similar name in the home directory of the user. To remove this history is easy.

Bob

- Collapse -
It's got to be somewhere
Oct 10, 2005 9:04AM PDT

but it does not appear to be in the Home directory of this user (me)
Still looking though


P

- Collapse -
It appears to be .history or .tcsh_history
Oct 10, 2005 9:59AM PDT

"If you set the savehist shell variable (by simply typing set savehist), the shell will save its history list to the file ~/.history when you log out. The next time you log in, this file is read and the list is placed into the new shell's history list. If savehist is not given an argument, the entire list is saved to ~/.history; if you give it a value (which should be less than the value of $history), it will save that many of the most recent commands."
- http://www.macobserver.com/tips/macosxcl101/2002/20021122.shtml

cat ~/.tcsh_history

- Collapse -
Thanks,
Oct 10, 2005 9:49PM PDT

I'll give that a read

P

- Collapse -
Thankyou guys...
Oct 11, 2005 11:38AM PDT

I have found out how to clear the history. You either go rm /~/.Bash_History or history -c in Terminal (I use the Bash shell not tsch).. I found this out from posting this same question in the Apple Discussions. Thankyou for the help anyways.

- Collapse -
Can I ask?
Oct 11, 2005 11:39AM PDT

Is "something like bashhistory" not close enough for us to find the answer?

Bob

- Collapse -
(NT) just type "history -c" in the terminal without double quotes
Nov 27, 2011 11:27PM PST
- Collapse -
I think Bob was referring to the fact
Nov 28, 2011 4:27AM PST

that he mentioned .bashhistory in his first post and that you did not follow up on it

P