3. Copy and Paste with Terminals

It is often useful to copy+paste within and into terminals, for example when following the AFNI install instructions. This helps avoid many mistakes that can occur with typing (tyypos, mistaking “O” and “0”, etc.).

On many operating systems and in many applications, copying is done by highlighting text and typing “Ctrl+c”, and pasting to the cursor location is done by typing “Ctrl+v”. (On a Mac, these would be done with “Apple+c” and “Apple+v”, respectively.)

In all cases below, text is pasted at the location of the cursor within the terminal (and not necessarily at the location of the mouse.)

3.1. Linux Terminals (non-Windows)

Keyboard
Copy:

Highlight text with the mouse, and then type “Ctrl+Shift+c” (by default, “Ctrl+c” cancels an operation running in the terminal)

Paste:

Type “Ctrl+Shift+v”

Mouse (no scroll wheel/middle button)
Copy:

Highlight text with the mouse (that’s really it!).

Paste:

Press the middle button/scroll wheel (also fast!).

Mouse (no scroll wheel/middle button)
Copy:

Right-click, and select “Copy” in the small menu that appears

Paste:

Right-click, and select “Paste” in the small menu that appears

3.2. OS X Terminals (“Terminal” Application)

Keyboard
Copy:

Highlight text with the mouse, and then type “Apple+c”

Paste:

Type “Apple+v”

Mouse (no scroll wheel/middle button)
Copy:

Highlight text with the mouse (that’s really it!)

Paste:

Press the middle button/scroll wheel (also fast!)

NB: this mouse copy/paste only works within the terminal, not from other windows. Must use keyboard to/from other windows.

Mouse (no scroll wheel/middle button)
Copy:

Right-click, and select “Copy” in the small menu that appears

Paste:

Right-click, and select “Paste” in the small menu that appears

3.3. OS X Terminals (“Xquartz” Application)

We just note that there is some similar copy+paste behavior with the “Terminal” terminals above, but that there are also differences; behavior can also be adjusted in the Xquartz “Preferences”, so it is too difficult to generalize. But users can explore…

3.4. Ubuntu on Windows (WSL) Terminals

To be able to copy+paste, one must activate this functionality by right-clicking on the toolbar at the top of the panel, selecting Properties, and then enabling “QuickEdit mode” (as described here). After that:

Mouse
Copy:

Highlight text with the mouse (that’s really it!).

Paste:

Right-click