Mastering Copy and Paste in Ubuntu: GUI, Terminal, and Virtual Environment Guide

目次

1. What Is Copy & Paste in Ubuntu? [Basic Knowledge and Environment Differences]

Why Copy & Paste Is Important in Ubuntu

In Linux-based systems like Ubuntu, using the terminal and switching between multiple applications are common. In such workflows, the ability to perform “copy and paste” operations smoothly has a major impact on efficiency.

Especially when entering commands in the terminal or reusing code snippets from the web, being able to copy and paste effectively determines productivity. Users accustomed to Windows or macOS may feel puzzled — “Why can’t I copy and paste in Ubuntu?” — because the operations differ slightly. Once you get used to it, the system becomes very intuitive.

Operations Differ Depending on the Environment

Copy and paste behavior in Ubuntu varies depending on your environment. The main types are as follows:

1. Desktop Environment (GUI)

This is the most visual, window-based interface. You can use the mouse or shortcuts (Ctrl+C / Ctrl+V) just like on Windows or macOS.

Examples:

  • Copying and pasting files
  • Moving text in an editor
  • Transferring data between browser tabs

2. Terminal Environment (CLI)

The terminal, a “black screen” favored by developers and advanced users, uses unique shortcut keys that require some familiarity.

  • Copy: Ctrl + Shift + C
  • Paste: Ctrl + Shift + V

Ctrl+C ends a process, so it cannot be used for copying.

3. Virtual or Mixed Environments

In some setups, additional configuration is required.

  • Ubuntu on VirtualBox (shared clipboard with host OS)
  • Windows ↔ Ubuntu copy-paste in WSL (Windows Subsystem for Linux)

In these virtual environments, normal copy-paste operations may fail unless properly configured.

Check Your Environment if Copy-Paste Fails

If copy and paste don’t work, first identify which environment you are in:

  • GUI or terminal?
  • Virtual or physical environment?

Understanding your environment is the first step toward smooth Ubuntu workflows.

2. How to Copy & Paste in the Desktop Environment (GUI)

Ubuntu’s graphical desktop environment (GUI) lets you perform copy and paste operations much like in Windows or macOS. Here’s how to handle files and text.

Copy & Paste Files

In Ubuntu’s file manager (often “Nautilus”), you can use drag-and-drop, right-click menus, or shortcuts.

Mouse Method

  1. Right-click the file you want to copy.
  2. Select “Copy.”
  3. Open the destination folder, right-click, and choose “Paste.”

Keyboard Shortcuts

  • Copy: Ctrl + C
  • Cut: Ctrl + X
  • Paste: Ctrl + V

Note: “Copy” duplicates a file, while “Cut” moves it. Both use Ctrl + V for pasting.

Copy & Paste in Text Editors

In editors such as Gedit, Pluma, or Kate, shortcuts are similar to other OSes.

Basic Shortcuts

  • Copy: Ctrl + C
  • Cut: Ctrl + X
  • Paste: Ctrl + V

Mouse Method

  1. Select the text you want to copy.
  2. Right-click → “Copy” or “Cut.”
  3. Right-click the destination → “Paste.”

Tip: In Ubuntu, simply selecting text can automatically copy it. You can then paste it with the middle mouse button (wheel click). This feature works in the terminal and some apps.

Copy & Paste Between Applications

In the GUI, cross-application copy-paste (browser → editor, etc.) works smoothly.

  • Copy code from a browser → Paste into a text editor
  • Copy from a PDF → Paste into an email

Some apps may have clipboard restrictions. If pasting fails, consider using terminal tools such as xsel or xclip.

Get Comfortable with GUI First

For new Ubuntu users, mastering copy-paste in the GUI is essential. It’s intuitive and helps build the foundation for more advanced operations later.

3. How to Copy & Paste in the Ubuntu Terminal (CLI)

The terminal is an essential part of Ubuntu for installing software, configuring systems, and checking logs. However, copy and paste work differently here, which often confuses beginners. Let’s review the correct methods and customization tips.

Basic Shortcuts in the Terminal

Ubuntu terminals (like GNOME Terminal) use slightly different key combinations from GUI applications.

Correct Shortcut Keys

  • Copy: Ctrl + Shift + C
  • Paste: Ctrl + Shift + V

Adding “Shift” prevents conflict with terminal commands.

Why You Can’t Use Ctrl + C

Ctrl + C is reserved in Linux for terminating a running process. Using it for copy could interrupt your program, so it’s disabled for that purpose.

Using the Mouse for Copy & Paste

If you prefer mouse operations, they also work in the terminal.

Steps

  1. Select the text you want to copy with the left mouse button.
  2. Right-click and choose “Copy.”
  3. Right-click again at the destination and choose “Paste.”

Note: In some apps, selecting text automatically copies it. You can then paste it with the middle mouse button (wheel click). However, this is not always reliable across all terminal types.

Customizing Terminal Shortcuts

You can customize shortcuts if you prefer different key combinations.

How to Change (GNOME Terminal Example)

  1. Open the terminal.
  2. Go to “Preferences.”
  3. Select your profile → “Shortcuts” or “Keybindings.”
  4. Assign your preferred keys for Copy/Paste.

Example:

  • Change copy to Alt+C or Super+C (recommended)
  • Avoid Ctrl+C to prevent interrupt conflicts

Mastering Copy & Paste Is the First Step

Becoming comfortable with copy and paste in the terminal is key to learning Ubuntu efficiently. Copying commands from the web and testing them speeds up your workflow dramatically.

Next, we’ll explore how to use command-line tools like xsel and xclip to manipulate the clipboard directly.

4. Clipboard Management via Command Line (xsel / xclip)

As you get more advanced, you may want to copy command output or pass data between scripts. The xsel and xclip tools let you do exactly that.

xsel — A Simple Clipboard Tool

xsel is a lightweight tool that reads from and writes to the X Window System clipboard. You can pipe text or files to it for quick clipboard control.

Install

sudo apt update sudo apt install xsel

Basic Usage

  • Copy text to clipboard:
echo "Hello Ubuntu" | xsel --clipboard
  • Copy file contents to clipboard:
xsel --clipboard < sample.txt
  • Display clipboard contents:
xsel --clipboard

Main Options

  • --clipboard: Standard clipboard (Ctrl+C/V)
  • --primary: Selection clipboard (middle-click paste)

Tip: Using --clipboard helps synchronize with GUI applications.

xclip — Alternative Clipboard Tool

xclip works similarly but uses slightly different syntax.

Install

sudo apt install xclip

Examples

echo "Testing xclip" | xclip -selection clipboard
xclip -o -selection clipboard

Practical Use Cases

  • Copy command results automatically:
date | xsel --clipboard
  • Send the latest log errors to clipboard:
cat /var/log/syslog | grep error | tail -n 20 | xclip -selection clipboard
  • Use clipboard data in a script:
CLIP=$(xclip -o -selection clipboard) echo "Copied: $CLIP"

When xsel or xclip Doesn’t Work

  • No GUI (e.g., servers or WSL without X)
  • Missing X server support

For WSL, use clip.exe (Windows clipboard) instead.

CLI Clipboard = Power User Skill

Mastering xsel and xclip lets you automate copy-paste tasks and move data seamlessly between GUI and CLI. This boosts your Ubuntu workflow speed.

5. Copy & Paste in Virtual Environments and WSL

Ubuntu is often used inside VirtualBox, VMware, or WSL. Clipboard behavior depends on host–guest integration. Below are the essential configurations.

Enable Copy & Paste in VirtualBox

Install Guest Additions

  1. In VirtualBox menu: “Devices” → “Insert Guest Additions CD Image.”
  2. Run the installer:
sudo apt update 
sudo apt install build-essential dkms linux-headers-$(uname -r) 
sudo sh /media/$USER/VBox_GAs_*/VBoxLinuxAdditions.run
  1. Reboot Ubuntu.

Enable Shared Clipboard

  1. Shut down the VM.
  2. Open “Settings” → “General” → “Advanced.”
  3. Set “Shared Clipboard” → “Bidirectional.”

Now you can copy text between host and guest freely.

Copy & Paste in WSL (Windows Subsystem for Linux)

  • Copy: Ctrl + C (standard Windows method)
  • Paste: Right-click or Ctrl + Shift + V

Behavior depends on your terminal type (PowerShell, CMD, or Windows Terminal).

Windows Terminal Settings

  1. Click “▼” → “Settings.”
  2. Select “Ubuntu” profile.
  3. In “Actions,” confirm Ctrl+Shift+C/V is enabled.

Using clip.exe in WSL

Copy data from WSL to Windows clipboard:

echo "From WSL to clipboard" | clip.exe

Key Notes

  • Images and files may not copy properly across OS boundaries.
  • Keyboard shortcuts can conflict between host and guest.
  • Full-screen mode can destabilize mouse focus.

In virtual setups, correct configuration is vital for reliable copy-paste.

6. Common Problems & Solutions

“Ctrl + C” Doesn’t Copy in Terminal

Cause: It stops processes instead. Fix: Use Ctrl + Shift + C/V.

Right-Click Menu Missing

Cause: Disabled in some terminals or virtual setups. Fix: Enable right-click in preferences or use keyboard shortcuts instead.

WSL Clipboard Doesn’t Work

Fix: Use Windows Terminal and update WSL. For reliability, use clip.exe or PowerShell’s Get-Clipboard.

xsel / xclip Not Found

Fix: Install manually via sudo apt install xsel or xclip. Not available on headless servers without X support.

Clipboard Content Overwritten or Lost

Ubuntu maintains two clipboards:

  • PRIMARY: auto-copy on select
  • CLIPBOARD: Ctrl+C content

Fix: Use xsel --clipboard explicitly to avoid confusion.

VirtualBox Copy-Paste Doesn’t Work

Fix: Install Guest Additions and enable “Bidirectional Clipboard.”

Unstable Clipboard

Fix: Switch session type: Wayland → Xorg. Restart the terminal or app.

7. FAQ

Q1. Why doesn’t Ctrl+C copy in Ubuntu Terminal?

A: It interrupts processes. Use Ctrl + Shift + C/V instead.

Q2. “command not found: xsel” — What to do?

A: Install it:

sudo apt update 
sudo apt install xsel

Or use xclip as an alternative.

Q3. How to fix copy-paste between VirtualBox and Ubuntu?

A: Install Guest Additions and enable “Bidirectional Clipboard.”

Q4. Why does selecting text automatically copy it?

A: Linux uses a separate “PRIMARY” clipboard. Paste with the middle mouse button.

Q5. How to copy from WSL to Windows?

A: Use clip.exe:

echo "text" | clip.exe

Q6. Clipboard not pasting?

A: Possible causes: unsupported app, middle-click disabled, or mixed clipboard types.

Q7. How to view clipboard contents?

A:

xsel --clipboard xclip -o -selection clipboard

8. Conclusion | Master Ubuntu Copy & Paste

Copy and paste in Ubuntu may seem tricky at first, but once mastered, it becomes a powerful workflow tool. Whether you use GUI, CLI, or virtual environments, understanding the correct method for each is essential.

Quick Recap

  • GUI: Use Ctrl+C/V or right-click.
  • Terminal: Use Ctrl+Shift+C/V.
  • CLI tools: Use xsel or xclip.
  • VirtualBox: Enable Guest Additions and bidirectional clipboard.
  • WSL: Configure Windows Terminal or use clip.exe.

These steps transform copy-paste from frustration into efficiency. Once familiar, you’ll find Ubuntu’s flexibility unmatched for both developers and power users.