Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When you delete characters on the command line using readline commands (e.g. Ctrl-U, you can paste using Ctrl-y, but where does it get stored? It does not seem to use X11 clipboard at all.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

It goes into a kill-ring, just like in Emacs. From the GNU Readline docuementation:

When you use a kill command, the text is saved in a kill-ring. Any number of consecutive kills save all of the killed text together, so that when you yank it back, you get it all. The kill ring is not line specific; the text that you killed on a previously typed line is available to be yanked back later, when you are typing another line.

Source: http://www.gnu.org/software/bash/manual/html_node/Readline-Killing-Commands.html

The kill ring is stored in memory allocated via malloc to a char pointer. From kill.c of the readline source:

/* Where to store killed text. */
static char **rl_kill_ring = (char **)NULL;
share|improve this answer
    
Check out my comment to vonbrand's answer. –  Emanuel Berg Mar 14 '13 at 1:42
    
@EmanuelBerg I would assume it's stored in memory. The GNU readline source is the best place to find that answer. –  jordanm Mar 14 '13 at 1:47
    
@EmanuelBerg I had a look at the source and update the answer. –  jordanm Mar 14 '13 at 2:02

readline is a library for tty use (at least originally), it is completely oblivious to any graphics environment (thus X clipboard or whatnot).

share|improve this answer
    
Do you know where the kill ring is actually stored? Is it a stack (LIFO file) or something else? Can I examine it first hand? –  Emanuel Berg Mar 14 '13 at 1:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.