How to remove the entries in the "history" file from the command line

Ou company allows several users access to the root user on our systems.  The problem I am havong is they are "experimenting" with commands that I have had to use to correct errors.  How can I either 1) prevent logging from specific users or 2) erase the history log.  I prefer option 1.
LVL 1
gordonmannAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TintinCommented:
Do the users login directly as root or do su -

To remove the bash history, just do

rm -f ~/.bash_history

You can have separate history files based on whatever criteria you come up with (eg: login name, terminal name, IP address etc).

For example, to have a separate history file based on the tty name, put the following in ~/.bash_profile

export HISTFILE=$HOME/.bash_history-$(tty|sed #/#-#g)
0
gordonmannAuthor Commented:
Everyone su to root

What if I just want a separate history file for myself BUT still want the ability to view what other users have done while logged in as root.
0
TintinCommented:
In that case, put:

export HISTFILE=$HOME/.bash_history-$LOGNAME

in the root .bash_profile

then everyone will have their own history file based on their login name.  The bash history file is a simple text file, so you view it as per any other text file.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gordonmannAuthor Commented:
Great help!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.