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 01-12-2010, 01:50 PM   #1
sd||
Member
 
Registered: Oct 2009
Distribution: Arch Linux
Posts: 89

Rep: Reputation: 18
How to delete bash terminal history upto certain no. of commands


i want to delete some say 10 previous commands in bash shell!! what shud i do??
 
Old 01-12-2010, 01:55 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Why would you be wanting to cover your tracks like that?
 
Old 01-12-2010, 01:57 PM   #3
bobshaffer2
LQ Newbie
 
Registered: Mar 2005
Location: Ohio
Distribution: Several (Gentoo, Red Hat/Fedora, HP-UX, Helix)
Posts: 26

Rep: Reputation: 17
Try editing ~/.bash_history. If that doesn't work, IDK. I think there is a way to get bash to not add it to history at all, but I don't recall exactly how it's done. I stumbled upon it once by accident...
 
Old 01-12-2010, 02:13 PM   #4
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by sd|| View Post
i want to delete some say 10 previous commands in bash shell!! what shud i do??
'should'.


Bash history is usually stored in ~/.bash_history but it's location can be controlled by setting $HISTFILE
The history file is only written when the shell exits, so you can delete the last ten lines from a history file but that might not be what you want.
You can prevent anything from being written to the history file by setting the value of $HISTSIZE to 0. Or I guess you could set $HISTFILE to /dev/null.

See also http://www.faqs.org/docs/bashman/bashref_106.html
 
  


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 delete command from bash itself ashishag Linux - Software 6 05-02-2010 03:39 AM
Can't delete old history in gstreamer lrusso Linux - Newbie 1 08-17-2009 01:30 PM
Delete history does not work patsyking Linux - Newbie 30 01-04-2009 06:57 PM
Missing commands in Bash/Terminal cferris Red Hat 3 10-12-2003 11:13 PM
delete konqueror history ? qwijibow Linux - Newbie 1 08-22-2003 03:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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