• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

xclip: command not found

by admin

Linux provides a command, xclip, that connects X selections to stdin and stdout. You can therefore insert copy and paste operations into pipelines and other combined commands. For example, you may have copied text into an application like this:

  • Run a Linux command and redirect its output to a file.
  • View the file.
  • Use your mouse to copy the file’s content to the clipboard.
  • Paste the content into another application.

With xclip, you can shorten the process considerably:

  • Pipe a Linux command’s output to xclip.
  • Paste the content into another application.

If you encounter the below error while running the xclip command:

xclip: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
OS X brew install xclip
Debian apt-get install xclip
Ubuntu apt-get install xclip
Alpine apk add xclip
Arch Linux pacman -S xclip
Kali Linux apt-get install xclip
Fedora dnf install xclip
Raspbian apt-get install xclip

xclip Command Examples

1. Copy the output from a command to the X11 primary selection area (clipboard):

# echo 123 | xclip

2. Copy the output from a command to a given X11 selection area:

# echo 123 | xclip -selection primary|secondary|clipboard

3. Copy the output from a command to the system clipboard, using short notation:

# echo 123 | xclip -sel clip

4. Copy the contents of a file into the system clipboard:

# xclip -sel clip input_file.txt

5. Copy the contents of a PNG into the system clipboard (can be pasted in other programs correctly):

# xclip -sel clip -t image/png input_file.png

6. Copy the user input in the console into the system clipboard:

# xclip -i

7. Paste the contents of the X11 primary selection area to the console:

# xclip -o

8. Paste the contents of the system clipboard to the console:

xclip -o -sel clip

Filed Under: Linux

Some more articles you might also be interested in …

  1. bspc Command Examples in Linux
  2. st Command Examples in Linux
  3. battop Command Examples in Linux
  4. aurman Command Examples
  5. CentOS / RHEL : Resize (extend) non-root EXT3/4 filesystem on non-LVM device (hard disk partition)
  6. grub-mkconfig Command Examples in Linux
  7. How to schedule Jobs with Cron in Linux
  8. dockerd: command not found
  9. squeue Command Examples in Linux
  10. blkdiscard Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • diffstat: Create a histogram from the output of the diff command
  • diffoscope: Compare files, archives, and directories
  • diff-pdf: Tool for comparing two PDFs
  • dict: Command line dictionary using the DICT protocol

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright