When you enter a long command into the Terminal window that you found on the web or in a document, you can save yourself some time by easily copying and pasting the command at the prompt.
Update: Read our in-depth guide to copy-pasting text at the Linux command-line for more detailed tips and tricks.
To begin, highlight the text of the command you want on the webpage or in the document you found. Press Ctrl + C to copy the text.
Press Ctrl + Alt + T to open a Terminal window, if one is not already open. Right-click at the prompt and select “Paste” from the popup menu.
The text you copied is pasted at the prompt. Press Enter to execute the command.
The command is executed like you typed in yourself.
You can also copy text from the Terminal window to paste into other programs. Simply highlight the text, right-click on it, and select “Copy” from the popup menu. You can paste this text into a text editor, word processor, etc.
When pasting a copied command into the Terminal window, you can use the arrow keys to navigate through the command and use the backspace key to delete text and retype it, if desired. This is useful if you want to copy a long command that has placeholders for certain parts of the command. You can easily change those to customize the command to your needs.