LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 10-27-2011, 03:48 PM   #1
daisychick
Member
 
Registered: Nov 2006
Location: Texas
Distribution: ubuntu 12.04 LTS
Posts: 154

Rep: Reputation: 0
clear multiple lines from bash_history


So I've been googling like mad and I can't seem to find a good way to clear multiple lines from the bash_history. I should note, I don't just want to delete it from the actual file but from ram as well. typing history -d 100 times isn't something I really want to do. Anyone have any other suggestions?
 
Old 10-27-2011, 04:29 PM   #2
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
You can delete the entire history with
Code:
history -c
- will that meet your needs?

If not, I think you would have to close the current terminal (bash session) to clear the memory list and then edit ~/.bash_history in a GUI editor or non-bash shell.
 
Old 10-27-2011, 05:57 PM   #3
daisychick
Member
 
Registered: Nov 2006
Location: Texas
Distribution: ubuntu 12.04 LTS
Posts: 154

Original Poster
Rep: Reputation: 0
yah, the -c deletes everything. I'll just have to wait for everyone to logout.
 
Old 10-28-2011, 01:42 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Tell me you're not sharing your login!!
 
Old 10-28-2011, 03:20 AM   #5
daisychick
Member
 
Registered: Nov 2006
Location: Texas
Distribution: ubuntu 12.04 LTS
Posts: 154

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
Tell me you're not sharing your login!!
Dude... seriously... Don't get me started. I am the first real linux admin to work at this business and I just started Monday. They've been doing everything themselves for a while now. First thing I did, login and users.... root, root, username, root, root, username. I almost quit right there. Essentially they're all logging in as root. It's a fricken nightmare. Needless to say, this WILL be changing ASAP.
 
Old 10-28-2011, 04:17 AM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Quote:
Originally Posted by daisychick View Post
Essentially they're all logging in as root. It's a fricken nightmare. Needless to say, this WILL be changing ASAP.
Ahh! Change the root password immediately, then only give it to those who really need it. Better yet setup sudo allowing them to only run the programs they absolutely have to run as root.

If you must to give the root password to some people, (assuming they don't have console access) set "PermitRootLogin no" in /etc/ssh/ssd_config so they have to first have to login with their normal user account and you can see in the log who su's to root.

Evo2.
 
1 members found this post helpful.
Old 10-28-2011, 08:24 AM   #7
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Holy Windows mentality ...

Are they all sharing /root/ for their home directories?

You should delete /root/.bash_history as well.

Even better, say you found a virus and have to do a complete reinstall. ( <-- NOT SERIOUS - for any future readers )
 
Old 10-28-2011, 03:08 PM   #8
daisychick
Member
 
Registered: Nov 2006
Location: Texas
Distribution: ubuntu 12.04 LTS
Posts: 154

Original Poster
Rep: Reputation: 0
yeah, I already setup sudo. I'll be changing the password monday. Good call on that ssh config. I'll get right on it.
 
  


Reply


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
bash_history file and running bash on multiple windows Uqbar Linux - General 3 03-11-2015 10:46 AM
[SOLVED] CAT command | multiple lines to multiple lines udiubu Programming 11 10-28-2011 07:09 AM
SED multiple lines masterdam79 Linux - Newbie 6 10-29-2009 05:25 AM
Hw to clear the selected lines from History? linuxxx123 Linux - Newbie 6 01-08-2009 04:56 PM
AWK/SED Multiple pattern matching over multiple lines issue GigerMalmensteen Programming 15 12-03-2006 06:08 PM


All times are GMT -5. The time now is 10:38 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration