LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-02-2010, 06:32 AM   #1
sangupari
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 0
history clearance for a particular history number in linux


hi
history -c will clear the previous history.
~.bash_history will contain the history commands
I want to know how to delete the particular history using the history number.
For eg:
.
.
.
440 cd
441 ls
442 history

then to delete the 440 th history how can i do it from the command line
 
Old 03-02-2010, 06:53 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
You can use the '-d' flag
Code:
history -d 440

Last edited by neonsignal; 03-02-2010 at 06:55 AM.
 
Old 03-03-2010, 02:57 AM   #3
sangupari
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
thnx neon
how to delete a specific range of history?

from 440 to 442
the history has to be deleted...how to do that?
 
Old 03-03-2010, 03:08 AM   #4
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Quote:
from 440 to 442
the history has to be deleted...how to do that?
Code:
for i in {442..440}; do history -d $i; done
(note that the deletion is done in reverse)
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
tcsh: can you save the history from multiple shells to one history file? BrianK General 2 04-23-2009 05:19 AM
history in linux sunilvadranapu Linux - Newbie 3 06-26-2008 08:52 AM
The History of Linux: Did I get it right? tromboneman General 6 03-13-2007 09:26 AM
Download history and copy history? inverted.gravity Linux - Newbie 1 02-21-2006 12:31 PM
How to find back "history" database after "history -c" ? san_lss Linux - Newbie 1 01-07-2004 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:11 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
Open Source Consulting | Domain Registration