I can highlight text I've entered in the terminal with my mouse and then use ctrl + shift + c to copy to the clipboard and that was fine for a while. But I've tried highlighting text by pressing shift and ctrl + shift like you can do in text editors. Neither seems to work. Having a keyboard shortcut for copying terminal commands I've entered would be much easier than dragging the mouse everytime I want to copy something. Is there any way to do that using the keyboard? I've tried using ctrl + u followed by ctrl + y, but that doesn't copy text to the clipboard, so I can't use that anywhere but the terminal.
Ubuntu – Terminal – Selecting commands I’ve entered using the keyboard
command lineshortcut-keys
Related Question
- Ubuntu – Using the SHIFT key in Terminal
- Ubuntu – How to efficiently send text entered on the command line to the system clipboard without using the mouse
- Ubuntu – Keyboard shortcut for pasting on the GNOME Terminal
- Ubuntu – Selecting text in the terminal without using the mouse
- Ubuntu – Select/copy/paste in terminal using only the keyboard
- Ubuntu – How to copy text from xfce4 terminal emulator to the clipboard
- Ubuntu – text highlighting (select to copy) stopped working in the terminal
- Ubuntu – How to copy terminal command in clipboard without using mouse
Best Answer
There is a set of shortcuts for terminal , and they are organized around the current cursor position.
These two are pretty useful in particular when you want to either copy the command or its arguments.
If you are proficient with
vim
text editor, you can edit the command you want in a more powerful way by evokingvim
withfc
command.For using the command outside the terminal, you might want to use
xclip
command (not installed by default) . For instance,Once you have
xclip
you can add the following function to your.bashrc
fileWhat this does is it will copy whatever you put in front to clip board. You can use that in combination with the shortcuts above to cut test, paste it in front of the function, and it will be added to your clipboard. Small example