Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

You probably encuntered the case where a package was not installed and the system was recommending you to install it using apt-get install mypackage.

I am looking for a quick keyboard shortcut for executing this last line. Obviously UP arrow would not bring it because it was not a command executed by you and only the last output line of the previous executed program.

Any ideas on how to get this behaviour in bash?

share|improve this question
By default the output isn't "stored" anywhere. You might be able to hack together a solution… see here: automatically capture output of last executed command into a variable –  slhck Nov 23 '13 at 8:04
what's wrong with copy and paste? –  MariusMatutiae Nov 23 '13 at 11:04
this is not an easy thing to accomplish.... falunk.com/?p=12 –  DragonZero Nov 23 '13 at 13:56
@MariusMatutiae that's what I did for years, but it requires me to switch from keys to pointing device select, copy, click, paste, clearly a "complex" process. Maybe I will endup implementing a shortcut my in the terminal (iTerm2). –  sorin Nov 24 '13 at 15:36

Your Answer


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

Browse other questions tagged or ask your own question.