pcopy is a tool to copy/paste across machines. It can be used from the web UI, via a CLI or without a client by using curl. It can also be used as a self-hosted NoPaste or as a temporary file hosting service.
After installing the pcopy server, you can use the pcopy
command line tool to copy from STDIN (pcp < file.txt
) and
paste on any connected machine to STDOUT (ppaste > file.txt
). If you don't have pcopy installed, you can also use its
super simple REST API to copy/paste, e.g. via curl
.
The web UI allows you to paste text or upload files (even if they are gigabytes in size), and generates temporary links you can share with others.
To see what else pcopy can do, check out the live demo (aka nopaste.net) or the videos.
Features:
- ๐ Copy/paste across computers (via STDIN/STDOUT)
- ๐ HTTPS secure server (via cert-pinning)
- ๐ Clipboards can be password-protected, or they can be open for everyone
- ๐ Support for multiple clipboards (e.g. personal, work, ...)
- ๐ Simple Web UI for uploading text snippets or large files
- ๐ Direct temporary links to clipboard content (with TTL/expiration)
- ๐ป No-install usage via curl (
curl nopaste.net
) and netcat (echo help | nc -N nopaste.net 9999
) - ๐๏ธ Browser-only links that store your data in the URL fragment
Binaries can be found on the releases page.
Debian/Ubuntu (from a repository):
curl -sSL https://archive.heckel.io/apt/pubkey.txt | sudo apt-key add -
sudo apt install apt-transport-https
sudo sh -c "echo 'deb [arch=amd64] https://archive.heckel.io/apt debian main' > /etc/apt/sources.list.d/archive.heckel.io.list"
sudo apt update
sudo apt install pcopy
Debian/Ubuntu (manual install):
wget https://github.com/binwiederhier/pcopy/releases/download/v0.6.1/pcopy_0.6.1_amd64.deb
dpkg -i pcopy_0.6.1_amd64.deb
Fedora/RHEL/CentOS:
rpm -ivh https://github.com/binwiederhier/pcopy/releases/download/v0.6.1/pcopy_0.6.1_amd64.rpm
Homebrew for MacOS: Brew package is managed semi-automatically by nwithan8
brew tap nwithan8/tap
brew install pcopy
Docker (see detailed instructions):
docker run --rm -it binwiederhier/pcopy
Go:
# requires Go 1.16
go get -u heckel.io/pcopy
Manual install (any x86_64-based Linux):
wget https://github.com/binwiederhier/pcopy/releases/download/v0.6.1/pcopy_0.6.1_linux_x86_64.tar.gz
sudo tar -C /usr/bin -zxf pcopy_0.6.1_linux_x86_64.tar.gz pcopy
After installation, you may want to check out the Bash/ZSH autocomplete instructions.
To setup a new pcopy server, simply run sudo pcopy setup
(see server setup demo):
sudo pcopy setup
sudo systemctl enable pcopy
sudo systemctl start pcopy
This will walk you through an interactive setup wizard and place a config file at /etc/pcopy/server.conf
(see
sample config). The wizard will set up a pcopy user and a systemd service. Once the service
is started, it listens on port 2586 by default.
If you've enabled the Web UI, you can browse to it an paste text snippets or upload files to it (see live demo).
To join an existing clipboard, you may use pcopy join
:
pcopy join private.example.com
pcopy join work.mycorp.com work
pcopy list
You can join multiple clipboards and give each of them an optional alias (see work
clipboard above). Each
clipboard has its own config file, either in ~/.config/pcopy
or in /etc/pcopy
(for root). You can list connected
clipboards with pcopy list
.
Now you can start copying and pasting by using pcp
(short for: pcopy copy
) and ppaste
(short for: pcopy paste
).
Any connected client, regardless of what computer it's on, can copy/paste like this (see copy/pasting videos):
pcp < foo.txt # Copies foo.txt to the default clipboard
pcp bar < bar.txt # Copies bar.txt to the default clipboard as 'bar'
echo hi | pcp work: # Copies 'hi' to the 'work' clipboard
echo ho | pcp work:bla # Copies 'ho' to the 'work' clipboard as 'bla'
pcp : img1/ img2/ # Creates ZIP from two folders, copies it to the clipboard
ppaste # Reads from the default clipboard and prints its contents
ppaste bar > bar.txt # Reads 'bar' from the default clipboard to file 'bar.txt'
ppaste work: # Reads from the 'work' clipboard and prints its contents
ppaste work:ho > ho.txt # Reads 'ho' from the 'work' clipboard to file 'ho.txt'
ppaste : images/ # Extracts ZIP from default clipboard to folder images/
The server can be configured via the well-documented config file /etc/pcopy/server.conf
(see sample config).
Here are a few highlights:
When you set up a new clipboard via pcopy setup
, you can enter a password. That derives a key, which is stored in the
config file (see Key section).
To add a password after initial setup, use the pcopy keygen
command.
When joining a clipboard with pcopy join
, you'll be asked for a password. When using curl
, you can provide the
password via -u :<password>
(see curl usage).
You can provide an (optional) alias to a clipboard when you pcopy join
it (see join).
You may then later reference that alias in pcp <alias>:..
and ppaste <alias>:..
(see copy/paste).
To list all your connected clipboards, simple type:
$ pcopy list
Clipboard Server address Config file
--------- --------------- ----------------------------
work 10.0.160.67 ~/.config/pcopy/work.conf
default nopaste.net:443 ~/.config/pcopy/default.conf
pcopy comes with a Web UI. You can check out the demo.
(Note: I am not a web guy. I could use some help here!)
If you don't want to install pcopy
on a server, you can use simple HTTP GET/PUT/POSTs, e.g. via curl
. There's an entire
curl
help page available too if you just type curl <hostname>
. You may use -u :<password>
to provide the clipboard
password (if any). Here's an example for the demo clipboard:
# Show curl help page
curl nopaste.net
# Copy/upload to clipboard (POST/PUT both work)
curl -d Howdy nopaste.net/hi-there
curl -T germany.jpg https://nopaste.net/germany
# Paste/download from clipboard
curl https://nopaste.net/hi-there
Similar to the curl
API, you can upload files via netcat (nc
). There's a detailed help page available by typing echo help | nc <hostname> <port>
, e.g. echo help | nc -N nopaste.net 9999
. Unlike the curl-API, the netcat usage is limited to uploading files only.
# Show nc help page
echo help | nc -N nopaste.net 9999
# Upload to clipboard
echo check this out | nc -N nopaste.net 9999
cat dog.jpg | nc -N nopaste.net 9999
# Upload with TTL
(echo "pcopy:?t=30m"; cat dog.jpg) | nc -N nopaste.net 9999
If you have particularly large files to send across, and you know you only want to send them to exactly one server,
you can use pcp --stream
. It creates a FIFO device (mkfifo
) on the server side, and will wait until a reading
client (ppaste
or curl ..
) is connected before sending.
# On machine 1
yes | pcp --stream # Will block until 'machine 2' is connected
# On machine 2
ppaste | pv > /dev/null
You can generate temporary links to clipboard entries with pcopy link
. You can send this link to someone and they
can download the clipboard content without downloading the client or using any command line tools:
$ pcopy link hi-there
# Direct link (valid for 2d, expires 2021-01-29 22:35:09 -0500 EST)
https://nopaste.net/hi-there?a=SE1BQyA
# Paste via pcopy (you may need a prefix)
ppaste hi-there
# Paste via curl
curl -sSL 'https://nopaste.net/hi-there?a=SE1BQyAxNjA'
You can limit the clipboard usage in various ways in the config file (see config file), to avoid abuse:
ClipboardSizeLimit
: Limits the total size of the entire clipboard (size of all files)ClipboardCountLimit
: Limits the number of clipboard filesFileSizeLimit
: Limits the per-file sizeFileExpireAfter
: Limits the age of a file (after which they will be deleted)
The demo clipboard uses these settings very restrictively to avoid abuse.
Inspired by nopaste.ml and paste, pcopy also supports links that
store all data in the URL fragment/anchor (the part in the URL after the #
) and not on the server.
When the "Client-side" checkbox is checked in the Web UI, pcopy compresses the text in the editor using LZMA and then
encodes the result using Base64, e.g. https://nopaste.net/#XQAAAQAKAA...
. As long as you have this link, this text can
never be deleted and never expires.
Here's an example.
When you open the link, pcopy reads, decodes, and decompresses whatever is after the #
, and displays the result in the editor.
This process is done entirely in your browser, and the web server hosting pcopy never has access to the fragment.
The link is also compatible with the original implementations. Here's the same example for nopaste.ml and for topaz's paste.
You can also generate the links from the command line (thanks to nopaste.ml for this):
# Linux
echo -n 'Hello World' | lzma | base64 -w0 | xargs -0 printf "https://nopaste.net/#%s\n"
# Mac
echo -n 'Hello World' | lzma | base64 | xargs -0 printf "https://nopaste.net/#%s\n"
# Windows / WSL / Linux
echo -n 'Hello World' | xz --format=lzma | base64 -w0 | printf "https://nopaste.net/#%s\n" "$(cat -)"
To use the pcopy image, simply pull it and set up a few shell aliases to simplify local usage:
docker pull binwiederhier/pcopy
alias pcopy="docker run --rm -v ~/.cache/pcopy:/var/cache/pcopy -v ~/.config/pcopy:/etc/pcopy -p 2586:2586/tcp -it binwiederhier/pcopy"
alias pcp="pcopy copy"
alias ppaste="pcopy paste"
This maps the following folders and ports (you may choose different host folders):
- Config folder:
/etc/pcopy
(image) to~/.config/pcopy
(host) - Clipboard folder (only for server usage):
/var/cache/pcopy
(image) to~/.cache/pcopy
(host) - Service port (only for server usage): 2586 (both image and host)
You can then use pcopy just like it was installed on your host system. To use it as a client, run
pcopy join
(see join instructions). To set up a server, run
pcopy setup
pcopy serve
Tab completion is available for Bash and ZSH. For Bash, when installed via rpm/deb, autocomplete is immediately available. ZSH autocomplete installation is manual.
Bash (only if not installed via rpm/deb):
sudo wget -O /etc/bash_completion.d/pcopy https://raw.githubusercontent.com/binwiederhier/pcopy/master/scripts/autocomplete_bash
sudo ln -s /etc/bash_completion.d/pcopy /etc/bash_completion.d/pcp
sudo ln -s /etc/bash_completion.d/pcopy /etc/bash_completion.d/ppaste
ZSH:
mkdir -p ~/.config/pcopy
wget -O ~/.config/pcopy/autocomplete_zsh https://raw.githubusercontent.com/binwiederhier/pcopy/master/scripts/autocomplete_zsh
for p in pcopy pcp ppaste; do echo "PROG=$p source ~/.config/pcopy/autocomplete_zsh" >> ~/.zshrc; done
I run a small nopaste service on nopaste.net that you can play with. It has quite a few limits in place, but you'll be able to get a feel for it:
- To join via the command line:
pcopy join nopaste.net
(see join instructions) - Or use the web UI (this is work in progress, I'm not a web designer, please help!)
- Or simply type
curl nopaste.net
(see curl usage) - Or simply type
echo help | nc -N nopaste.net 9999
(see netcat usage)
Limits:
Since nopaste.net is publicly available, I put quite strict limits in place. It is limited to
2 GB total, 500 KB per file, 10,000 files. Files expire after 2 days. Also, overwriting files is disabled (which, if
you use it as a personal clipboard, is quite nonesensical, but it makes sense for a nopaste).
I also made a couple more videos to show what else pcopy can do.
![]() |
![]() |
![]() |
|
Simple copy & paste | Setting up a new server | Copying entire folders | |
![]() |
![]() |
![]() |
|
Creating a link to a password-protected clipboard | Copying/uploading through the Web UI | Copy/pasting with `curl` |
Each command has a detailed help page. Simply type pcopy -help
, pcp -help
, etc. Here's the main help page:
$ pcopy --help
NAME:
pcopy - copy/paste across machines
USAGE:
pcopy COMMAND [OPTION..] [ARG..]
COMMANDS:
Client-side commands:
copy, c Read from STDIN/file(s) and copy to remote clipboard
paste, p Write remote clipboard contents to STDOUT/file(s)
join, add Join a remote clipboard
leave, rm Leave a remote clipboard
list, l Lists all of the clipboards that have been joined
link, n Generate direct download link to clipboard content
Server-side commands:
serve Start pcopy server
setup Initial setup wizard for a new pcopy server
keygen Generate key for the server config
Try 'pcopy COMMAND --help' for more information.
Building pcopy is dead simple, however it does need Go >=1.16, because it uses embed. Here's how you build it:
make build-simple
# Builds to dist/pcopy_linux_amd64/pcopy
To build releases, I use GoReleaser. If you have that installed, you can run make build
or
make build-snapshot
.
I welcome any and all contributions. Just create a PR or an issue, or talk to me on Slack.
Thanks nakabonne for making pbgopy, and for posting it on Reddit. It inspired me to make pcopy.
The Web UI as well as the client-side mode are inspired by nopaste.ml.
As many may instantly notice, pcopy is similar to pbcopy/pbpaste. However, pcopy can copy/paste across the network. You can copy on your laptop and paste on your servers.
pcopy may also replace scp or rsync in simple cases, when you just want to copy a file or folder across to another computer.
Made with โค๏ธ by Philipp C. Heckel, distributed under the Apache License 2.0.
Third party libraries:
- github.com/urfave/cli/v2 (MIT) is used to drive the CLI
- CryptoJS (MIT) is used for key derivation and such in the Web UI
- LZMA-JS (MIT) is used for client-side mode to compress text
- Lato Font (OFL) is used as a font in the Web UI
- GoReleaser (MIT) is used to create releases
Code and posts that helped:
- Drag & Drop (CC BY-SA 3.0)
- Progress indicator (Apache 2.0)
- Rate limiting (MIT)
- Find common directory (GFDLv1.2)
- Full page centering
- Human readable file sizes
- Unzipping files
- HTTP server routing
- HTTP server error handling
- Google Webfonts Helper