Tip: Drag and Drop text in Terminal

griz

Registered
I happened across a nifty shortcut today while using the terminal. If you would like to copy and past a filename from one place in the terminal into the command line, rather than selecting the text and using copy/paste, you can select the text and grab it and drag it just a little ways down in the window, about one or 2 lines is all it takes and the selected text will be inserted at the command line.
This action is very similar to dragging a file from the finder into the terminal window which fills in the file path. This also works for copying text from one terminal to another.
 
Yes. And if you drag a file or folder into a terminal window it will print the full path to it where the cursor is. And you can drag highlighted text outside of the terminal windows into other things, like a URL into your browser, into a text clipping on the desktop, etc. Very handy.
 
And.... Pressing Command-Shift-V in the Terminal will copy and paste whatever text is currently selected without polluting the clipboard.
 
Back
Top