Control+K saves text in the Readline
's buffer.
Control+Y extracts text from that buffer.
Each Bash instance has own buffer.
I suppose that you want to run a previous command as root
. Try sudo !!
. Details in Understanding the exclamation mark (!) in bash
Use tmux for a complex copypasting across sessions/shells etc:
tmux # Start tmux session
echo some-text
some-text
...
bash # Start new bash
...
Hm, I want to copy echo
output from the outer session.
Control+b,[ - Enter copy mode to copy text or view the history
Control+r, some
, Enter - Search some
Control+Space - Start selection
Control+e - Select to the end of line
Esc+w - Copy selection
Control+b,] - Paste the most recently copied buffer of text
.bashrc
or.inputrc
inside/root
to see whether they are set correctly. – Hongxu Chen Jun 28 '15 at 08:21sudo su
. Just runsudo -i
orsu
if you have enabled the root account. – terdon Jun 28 '15 at 08:27