LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Closed Thread
  Search this Thread
Old 07-30-2004, 12:26 PM   #1
ibrahimt
LQ Newbie
 
Registered: Jul 2004
Location: nigeria
Distribution: mandrake
Posts: 4

Rep: Reputation: 1
How do I clear history in Linux


Hello all,

Please can anybody help me with a command to clear history of all the command I ever typed from command prompt in Linux. I share a system with a number of people that access the system with the same username. I wouldn't want somebody to re-execute a command that I had already executed before either by mistake or intentionally.

I have tried using "man history" on mandrake 9.1 but did not give me any result. I also searched the web without success.

Thanks in advance

Ibrahim
 
Old 07-30-2004, 12:49 PM   #2
Ankheg
Member
 
Registered: Jul 2004
Location: Woodland Hills, CA
Distribution: Debian/Mandrake
Posts: 37

Rep: Reputation: 15
Depends on which shell you use...but the most common is bash, and I believe it is the default... Chances are, anyway.

If you change to your home directory, and do:
ls -al

You should see a file called: .bash_history

That file will contain all (maybe just most, can't remember what the cap is, if any) of the command line history.

To clear it, like you want, you can simply delete that file.
 
Old 07-30-2004, 12:51 PM   #3
rgiggs
Member
 
Registered: Apr 2004
Location: berkeley, ca
Distribution: slk10, winxp
Posts: 313

Rep: Reputation: 30
if you use bash, there's .bash_history in your home directory, remove it. if you use another shell, look for a similar file.

--posting at the same time--
 
Old 08-03-2004, 12:36 AM   #4
Sabicas
Member
 
Registered: Aug 2004
Distribution: Slackware 10
Posts: 110

Rep: Reputation: 15
I personally like to set an alias to do this it's always set as...

alias history="rm .bash_history"
 
Old 08-03-2004, 07:14 AM   #5
liinux
LQ Newbie
 
Registered: Aug 2004
Location: US
Posts: 27

Rep: Reputation: 16
use history -c to clear everything
 
1 members found this post helpful.
Old 08-03-2004, 07:20 AM   #6
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
edit your .bashrc and add

HISTFILESIZE=0
HISTSIZE=0

Of course, you will not be able to use the up-arrow to retrieve your previous command. OR set HISTSIZE to something that will allow minimum exposure.
 
Old 08-03-2004, 09:44 AM   #7
ibrahimt
LQ Newbie
 
Registered: Jul 2004
Location: nigeria
Distribution: mandrake
Posts: 4

Original Poster
Rep: Reputation: 1
Thanks all,

all the suggestions worked as explained. I found "history -c " command most straight-forwad. Thaks to everybody once again

IbrahimT
 
1 members found this post helpful.
Old 07-14-2009, 02:09 AM   #8
dr.ash
LQ Newbie
 
Registered: Jul 2009
Posts: 1

Rep: Reputation: 2
Thumbs up

Quote:
Originally Posted by liinux View Post
use history -c to clear everything
Thanks alot, it's really helpful
 
2 members found this post helpful.
Old 07-14-2009, 02:15 AM   #9
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by dr.ash View Post
Thanks alot, it's really helpful
dr.ash, please don't resurrect dead threads.

BTW, there's a Thanks button attached to every post, for when you are feeling thankful.
 
1 members found this post helpful.
  


Closed Thread



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
history clear command suguname Linux - Newbie 5 03-05-2005 09:32 AM
How do I clear all my RedHat 9 History? PionexUser Linux - General 1 11-20-2003 10:42 AM
How do I clear the Dictionary's history? PionexUser Linux - Software 4 11-03-2003 03:18 AM
How does one clear Konqueror's history? forand Linux - Software 9 10-10-2003 01:11 AM
Clear History Mystified Linux - Newbie 1 03-25-2002 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration