Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

common commands

How to copy and paste on command prompt and Git Bash


Copy and paste are the most used and most common commands computer users see themselves using every day. This particular shot is of great importance to me as I found out that I was unable to do this common task on my CMD and Git Bash. Strange right? So, I thought some people out there could really use help on how to do this.

Getting started

To follow the instructions in this shot, use Windows. However, as long as you use a terminal, no matter the OS, you can follow along. You will have a need for these instructions because the same rules apply.

The “ctrl+c” and “ctrl+v” commands we normally use for copying and pasting are used for different purposes on the windows CMD and Git Bash. For example, “ctrl+c” will interrupt a running process on CMD or Git Bash.

Let’s get started on how to copy and paste on CMD.

Copying from an external file

If you wish to copy and paste from the web or an external file, use the normal method of highlighting the text and hitting the copy option, or ctrl+c shortcut, to copy the said text.

Head straight to your CMD or Git Bash and hover your mouse pointer over the window and right-click. From the pop-up options, choose paste to paste your text at your preferred position, which you have indicated by the placement of your cursor.

Copying from the command line

Things get a little bit trickier when you wish to copy a line from your command prompt or Git Bash.

  • Once again, hover over your open CMD window and right-click.

  • From the options, select “mark”. Then you will see a blinking position cursor on the CMD window.

  • Now using your up, down, right, and left arrow keys, move the blinking cursor to the position where you wish to start copying

  • When at your start point, hold down the Shift key and once more use your left or right direction arrow key to move the cursor over the line to be copied. The line gets highlighted by doing this. Or, you can simply use your mouse to choose a line by holding down the left button and dragging your cursor over line.

  • After successfully highlighting, press the Enter key to copy the highlighted text.

Pasting text

To paste the copied text, make sure your cursor is placed at the point you wish to insert copied text. Right-click and choose “paste” from the options to paste copied text. The same thing applies to Git Bash, only that you don’t need to select “mark” from the right-click options. You can just highlight with any of the highlighting methods, then right-click and choose “copy”. You can also right-click and choose “paste” from the displayed options to paste the text.


Okay, let’s do a little practice.

  1. Copy the text in the blockquote below. This is like copying from an external source.

  2. Use the terminal provided and try doing a “ctrl+v”. Surely it won’t work. So, right-click on the terminal and choose “paste” to paste your copied text wherever your cursor is placed.

  3. Now, try highlighting the text to be copied and hit “ctrl+c” to copy it. You will notice it didn’t copy. Just right-click on the terminal once more and choose “copy” to grab the text. Now it is surely copied.

The terminal below has been provided for practice. Try more copy and paste commands on your personal Windows or Linux machine.

Terminal 1

In summary

We use a lot of CMD and terminal while writing codes. You may need to copy and paste some commands on your CMD, especially during installations and setup. This surely will make it much more fun.


common commands

View all Courses

Keep Exploring