Copy File Name
In the image below, the ls command is used to list the contents of the current Git folder in Kali Linux i.e., “works”. To copy the name of the TestFile.sh file, use the right mouse button to select the line, then hold the Shift key, and then use the right or left arrow keys on the keyboard to select the file’s name followed by hitting the Enter button. On the screen, you can notice the highlighted file name i.e., “TestFile.sh” from many of the other files and folders in “works”.
Example 01: Use of Ctrl+Shift+V
Now, it’s time to paste the copied file name into the Kali Linux shell. So, we have tried to input the cat instruction in the picture below, then space and hold the Ctrl+Shift+V to paste the name of the file we copied earlier on the terminal window. The name of a file has been pasted successfully. After running this instruction, it prints the contents of the script file we gave it as an argument on our shell screen.
What If the Control + Shift + V Command Fails?
If this command fails, check the “Use Ctrl+Shift+C/V as a Copy/Paste” option in the terminal or shell properties and click the OK button. See the screenshot below. It also indicates that we can copy the text from the terminal by pressing the Ctrl+Shift+C keys on the keyboard.
Example 2: Using the Insert Key on the Keyboard
We may also use the Control + Insert key from the keyboard to copy the text we want in the Git Bash terminal. To copy the text from the Git Bash terminal, pick and highlight the text as shown in the previous example. When you hit the Control+Insert, the highlighted text is de-highlighted, indicating that the text has been copied. Paste the copied content into the Git Bash terminal using the Shift + Insert keyboard shortcut.
Example 3: Using the Quick Edit Mode Option
Navigate to the Options tab by right-clicking on the Git Bash terminal. Click on the OK option to enable the Quick Edit Mode. You can now paste into the Git Bash using right-click, including the passwords for online pushes, something you couldn’t do before with Insert. This also makes copying simple. Show the Git folder in the shell first, then create a new text file and display its data or paste it.
Example 4: Copy & Paste the Text from External File to Git Bash Terminal
Use the conventional procedure of highlighting the text and selecting the copy option, or the Ctrl+C shortcut, to copy and paste the text from the web or an external file. Go to Git Bash and right-click the window while hovering your mouse pointer over it. Select Edit from the pop-up choices, and then paste your text where you want it, as indicated by your cursor location.
Example 5: Copy and Paste in Nano Editor
Let’s look at a case where we wish to copy and paste the text into a nano editor file that is open in editing mode. Use the following steps to copy and paste:
- Either uses the Shift + arrow keys or the mouse to highlight the required text.
- Then, simultaneously hit the Alt+6 keys. When the text becomes non-highlighted, the selected text is copied to the clipboard.
- Locate the text you want to paste in a file and paste it there.
- To paste the content, press Ctrl+U at the same time.
- Once you’ve made the necessary adjustments, you’ll see the text pasted and can close the file.
The 4th line is pasted using the Ctrl+U keys on the keyboard, as shown in the screenshot below. Highlight the text to copy using SHIFT and ARROW keys.
Example 6: Copy and Paste in VIM Editor
Copying, cutting, and pasting the text is one of the most common tasks when dealing with text files. However, there are a lot of ways to do that. So, in the example below, we use the VIM editor to copy and paste into a Bash (.sh) file. Use the shown below command starting with the keyword “vim” followed by the space and the name of the file. Open this file in the VIM Editor.
The file is open in editing mode, as shown in the VIM editor interface above. To copy the text, place the cursor where you want it to be copied and then hit the “y” key while following the mouse’s movement commands. The text that has been highlighted will be copied to the clipboard. Now, move the cursor to the chosen place in the VIM editor and press P to insert (paste) the yanked or deleted text just after the mouse pointer or P to put (paste) the text that is before the mouse cursor.
This is all about the use of different methods to paste something in Git Bash. We have tried the Ctrl+Shift+V to copy any filename from the Kali Linux shell and paste it into another query area for execution. After this, we have discussed how an insert key, and quick edit mode can be utilized to do the same thing. We have discussed how a user can paste from an external source to Git Bash and also discussed VIM and Gnu nano editors to make use of them in copy and paste.