/dev/clipboard: The most Unixy thing on Windows/Cygwin

James Smith


For a long time, I have relied on the Cygwin environment to emulate a Unix-like experience on Windows. Cygwin provides not only some common Unixy command line utilities but also a Linux-like file system hierarchy that includes /dev and /proc. For example, copying a CD-ROM is simply cat /dev/cdrom >file.iso

One of the special files in /dev is /dev/clipboard, which allows you to read and update the Windows clipboard as if it were a local file. Many of my workflows include /dev/clipboard. A concrete example is copying a column in Excel, transforming it in the command line, and pasting it back.

# View the clipboard
cat /dev/clipboard
# Find something on the clipboard
cat /dev/clipboard |grep something
# Transform the clipboard data in-place
cat /dev/clipboard |sed ... |tee /dev/clipboard

And many of my scripts take /dev/clipboard as the input/output, such as launching Google to search the clipboard.

AFAIK, this thing hasnโ€™t been replicated on Linux. Maybe someone could implement it with FUSE.

Welcome to build-your-own.org.

A website for free educational software development materials.


for updates and new books.

Build Your Own X From Scratch Book Series:

Build Your Own Redis
Build Your Own Database
Build Your Own Compiler
Build Your Own Webserver