LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-18-2009, 12:15 AM   #1
curos
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 72

Rep: Reputation: 15
Unhappy clear command history in tcsh


How do you clear your command history? I don't mean the history you get when you run
Code:
history
and that you can delete with
Code:
history -c
I mean the history you get when you press up on your keyboard and it shows you the last few commands that you have run (and allows you to reexecute them if you want to).

I noticed a file in my home directory ~/.history
It contained the history of my commands. I tried deleting the file, but when I logout and log back in, the .history file is recreated with all the history still there. I guess it must store it in memory. So how do you go about clearing the command history?

btw, I'm using tcsh

Last edited by curos; 12-18-2009 at 12:46 AM. Reason: Made it clearer in post title that this is for tcsh
 
Old 12-18-2009, 12:20 AM   #2
sumeet inani
Member
 
Registered: Oct 2008
Posts: 881
Blog Entries: 26

Rep: Reputation: 47
I have bash.I do as follows BUT there is tip for you at end to locate corresponding file.
Code:
Edit your file ~/.bashrc
There must be a line 
shopt -s histappend
comment it by prefixing with #
now open a terminal & run history -c.
Your history will be permanently erased 
& even if you press up key just hear a beep.
search in your home for file that contains word histappend to replace ~/.bashrc.
Try
Code:
find ~ -type f -exec grep -l -i  histappend '{}' ';'
I can explain command if you are interested to know.
if you find this post useful than thank me by pressing thumbs up button.Thank You.

Last edited by sumeet inani; 12-18-2009 at 01:09 AM.
 
Old 12-18-2009, 12:44 AM   #3
curos
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: 15
Sorry, but I'm not running bash, so shopt is not an available command and would not affect tcsh.

I actually found out how to do it from reading http://forums11.itrc.hp.com/service/...hreadId=957353

basically, i did:

Code:
set history=0
logged out and then logged back in. Good as new!
 
Old 12-18-2009, 01:17 AM   #4
sumeet inani
Member
 
Registered: Oct 2008
Posts: 881
Blog Entries: 26

Rep: Reputation: 47
can you show output of this command
Code:
find ~ -type f -exec grep -l -i  histappend '{}' ';'
just i would like to know if there is a similiarity between config of bash & tcsh.
 
Old 12-18-2009, 01:26 AM   #5
curos
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: 15
hi sumeet. I ran the command, but there was no output.

EDIT:
and i understand what the command does; do a grep on all files for the substring histappend and print the file if it contains that string. ignore case.

Last edited by curos; 12-18-2009 at 01:28 AM. Reason: added what the command meant
 
Old 12-18-2009, 04:38 AM   #6
sumeet inani
Member
 
Registered: Oct 2008
Posts: 881
Blog Entries: 26

Rep: Reputation: 47
Another things to note in my code was
-l --stop search in file when you find first match & also instead of mentioning the whole line just give file name.
Actually first I had tried
grep -ir 'histappend' *
but I think in this case files with . at beginning are excluded so I had to go for -exec option in 'find' command.
Looks like you also know a lot about commands.
Pleased to meet you.

Last edited by sumeet inani; 12-18-2009 at 04:39 AM.
 
  


Reply

Tags
command, history, tcsh


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
clear history "last" command nistelrooy Linux - Newbie 10 11-03-2010 01:09 PM
How to clear the output of history command jeff80 Linux - Newbie 10 08-02-2009 03:04 PM
How to clear history hi_msh Linux - Newbie 2 01-12-2006 06:40 AM
history clear command suguname Linux - Newbie 5 03-05-2005 10:32 AM
Clear History Mystified Linux - Newbie 1 03-25-2002 10:27 AM


All times are GMT -5. The time now is 11:41 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration