shell - execute last output line of previous command in linux -


How to execute the last output line of the previous command in a Linux base terminal by a shortcut?

For example:

  $ tree The 'tree' is not currently installed. You can install it by running: sudo apt-get install tree  

I want to copy execution sudo apt-get install tree

If the last line is safe to run, there is a simple command, and does not contain any spaces or quotes Or something else will need to be parsed / understand if this should work (though you need to re-run the first command for this Is).

  $ (!! 2> Tail-N1)  

It is being said that I do not recommend it at all. If you copy and paste it or type it, then it is very simple (and supports more complex commands).

You can not get the last line of the displayed output, though you need to run the command again.

Your terminal can support shortcut, although you can copy and paste though GNU screen can do this I believe that rxvt- Unicode may be supported with this perl script.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -