LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-15-2002, 04:46 AM   #1
explorer1979
Member
 
Registered: Aug 2001
Location: Hong Kong, China
Distribution: CentOS, Red Hat, Mandrake, Debian
Posts: 88

Rep: Reputation: 15
Question How to del all history in Linux


Hi all,

I am a system administrator in Linux in my company.

Now, after I login to root, I just discovered that Linux will remember what I enter ask for it to do in the history. Whatever I logout and login again the history still in here.

How to del all history before logout?

My Linux is Red Hat 7.2

Thanks
 
Old 10-15-2002, 05:58 AM   #2
bah
Member
 
Registered: Apr 2001
Posts: 38

Rep: Reputation: 15
The default file for saving the command history in bash is ~/.bash_history
 
Old 10-15-2002, 08:39 AM   #3
Flibble
Member
 
Registered: Mar 2002
Distribution: Redhat 9.0, Debian, Knoppix, YellowDog
Posts: 142

Rep: Reputation: 15
and not .bash_profile

Don't laugh. Let this be a lesson to people never to be logged in as root and tired at the same time. ;>

Luckily I back things like that up.

Flibble
 
Old 10-15-2002, 10:09 AM   #4
sandy
Member
 
Registered: Aug 2002
Location: Mumbai,India
Distribution: Linux Mint 12, Gentoo
Posts: 230

Rep: Reputation: 30
Re: How to del all history in Linux

Quote:
Originally posted by explorer1979
Hi all,
I am a system administrator in Linux in my company.
Now, after I login to root, I just discovered that Linux will remember what I enter ask for it to do in the history. Whatever I logout and login again the history still in here.
How to del all history before logout?
Why do you hate history?
 
Old 10-16-2002, 08:22 PM   #5
explorer1979
Member
 
Registered: Aug 2001
Location: Hong Kong, China
Distribution: CentOS, Red Hat, Mandrake, Debian
Posts: 88

Original Poster
Rep: Reputation: 15
Your mean is just need del ~/.history_* file then all the command history will del?
 
Old 10-16-2002, 08:31 PM   #6
bah
Member
 
Registered: Apr 2001
Posts: 38

Rep: Reputation: 15
Nope. ~/.bash_history
 
Old 10-16-2002, 08:36 PM   #7
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
I guess you're comming from Windows/DOS world, and this is your first *NIX encounter.
del, well there is no del command in *NIX you can mimic it by aliasing 'rm -f' command though.
rm -f ~/.*_history
will remove history file for the current user only.
 
Old 10-16-2002, 08:44 PM   #8
bah
Member
 
Registered: Apr 2001
Posts: 38

Rep: Reputation: 15
Yup. Although I probably wouldn't put the wildcard in. Lots of programs use hidden files in your home directory, and wiping out everything that ends in _history is a bit too heavy handed to my way of thinking.
 
Old 10-16-2002, 08:50 PM   #9
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Yep, possible.
 
Old 10-16-2002, 08:57 PM   #10
explorer1979
Member
 
Registered: Aug 2001
Location: Hong Kong, China
Distribution: CentOS, Red Hat, Mandrake, Debian
Posts: 88

Original Poster
Rep: Reputation: 15
Yes, thanks all of suggestion

And, yes, I am from Windows move to *NIX base and still a newbie in Linux system administrator la, since my company is just small business in IT :-)
 
Old 10-16-2002, 09:20 PM   #11
jetblackz
Member
 
Registered: Mar 2002
Location: Debian Galaxy
Distribution: Debian
Posts: 711

Rep: Reputation: 30
history -c

Tricky, when will you let me take over?
 
Old 10-16-2002, 09:22 PM   #12
adam_boz
Member
 
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538

Rep: Reputation: 30
You can write a bash script to do that job every time you turn off the computer too, maybe something like this:

#!/bin/bash
rm /root/.bash_history

*** you might want to also do something like:
touch /root/.bash_history

to make it an empty file after you remove it.

if you write that as a text file, then make it executable, you can add it to your boot scripts so that it will be run on startup/shutdown

good luck
 
Old 10-17-2002, 06:22 AM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Another way, if you don't mind having *no* history as root whatsoever, is a var called HISTSIZE, export from /etc/profile:
if [ "$UID" = "0" ]; then export HISTSIZE="0"; fi, or just link the trashcan: if [ "$UID" = "0" ]; then ln -sf /dev/null /root/.bash_history; fi or use your /root/.bash_logout to rm -f /root/.bash_history

Mind you, if you're hiding stuff and have people in the wheel group you'd better use secure wipe because if one has privileges to dd the partition chances are they can retrieve at least parts of any file deleted as well.
 
Old 10-17-2002, 08:35 AM   #14
adam_boz
Member
 
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538

Rep: Reputation: 30
how about using "shred"... will that keep people away from his stuff?

(just curious)
 
Old 10-17-2002, 10:04 AM   #15
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Yeah, if you use secure delete apps, overwrite with data, mind the exeptions and don't have fragments of the file on swap etc etc, yeah I guess you can be sure ppl will have a very hard time reconstructing it. Tho if you start shredding files *now* there's still a chance there are fragments around from older "versions" of the file which could be retrievable with, say, TCT.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to del the history shadowsurfer Linux - Newbie 2 09-19-2004 11:27 AM
ctrl+alt+del for linux? webazoid Linux - Software 9 06-30-2004 11:19 PM
ctl-alt-del equivalent in linux? pekuekfir Linux - General 14 09-20-2003 12:14 PM
DEL linux? JreL Linux - Software 2 08-14-2003 12:50 PM
ctrl, alt, del in Linux psyklops Linux - General 5 04-23-2002 06:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:17 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