You are not logged in.

#1 2012-09-29 02:56:30

cavity
Member
Registered: 2012-09-27
Posts: 3

clean up the history from xterm?

Why doesnt history -c doesnt work in bash as described in this page? I get the same list of commands in history either i use history, history -h or history -c. And last command i used still appends to history file. And history list doesnt return numbered lines associated with listed commands.

To override this behavior i can edit my ~/.ash_history file but if i try editing in nano (xterm) Alt+A combination doesnt work as starting markup for text selection. How to issue Alt+ commands from xterm when working in nano?

Is there a way to have fixed collection of commands collected in history for reuse?

Offline

#2 2012-09-29 03:30:59

cavity
Member
Registered: 2012-09-27
Posts: 3

Re: clean up the history from xterm?

cavity wrote:

To override this behavior i can edit my ~/.ash_history file but if i try editing in nano (xterm) Alt+A combination doesnt work as starting markup for text selection. How to issue Alt+ commands from xterm when working in nano?

I worked that out by reading Esc+Esc sequence in help. Every Alt+ command in console mode must be previously Esc and then used Alt+ command unlike the eal terminal where Esc could be omitted.

Offline

#3 2012-09-29 21:30:09

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: clean up the history from xterm?

cavity wrote:

Why doesnt history -c doesnt work in bash as described in this page? I get the same list of commands in history either i use history, history -h or history -c. And last command i used still appends to history file.

You link to a man page for bash 3.0 from 2004.  This is 2012 and Arch offers bash version 4.2. Try 'info bash' and search for the section on command line history.  '-h' is not a valid option for the history command.

For the '-c' option, take a look at an answer I posted in a previous thread: https://bbs.archlinux.org/viewtopic.php … 7#p1097997

cavity wrote:

And history list doesnt return numbered lines associated with listed commands.

Are you saying that when you type the command, 'history', with no options, a numbered list is not printed?  I certainly don't have that.  If I wish to view the whole history without printing line numbers using the 'history' command, I have to pipe the output to 'cut' or 'sed' or 'awk'.  Or I can send the output to a file using:

history -w hist.txt

One way to tag command lines saved in the history file is to use command line comments.  I often have a pdf book that I will want to return to reading.  I'll enter the command as:

mupdf ~/books/pdf/a_sale-of_two_titles.pdf  27  ## SALE pgs off by 18

To return to the book I can use Ctrl-R to search through history for 'SALE', then edit the page number once the command has been recalled.

There are many good guides to using the bash history.  One I liked was http://www.catonmat.net/blog/the-defini … e-history/.

Offline

Board footer

Powered by FluxBB