I use this everyday
About this video
NetworkChuck shows how to get Mac-style pbcopy and pbpaste commands working in a Linux or WSL terminal so command output can be piped straight to the clipboard and clipboard contents piped into other commands. He demonstrates the payoff first: catting a large file into the clipboard, and piping a whole web article into Fabric for summarisation. Macs have these commands built in; on Linux he installs a small command-line clipboard utility with apt, then tests copying with its input/clipboard form and pasting with its output form. Because those commands are long, he shortens them with aliases defined at the top of ~/.bashrc, aliasing pbcopy and pbpaste to the utility’s copy and paste forms, then reloads the shell with source ~/.bashrc and verifies echo piped into pbcopy comes back via pbpaste. He then extends the setup to remote servers: install the same utility on the server, confirm X11 forwarding is set to yes in /etc/ssh/sshd_config (editing and restarting SSH if not), add the same aliases on the server, disconnect, and reconnect with ssh -X so X11 forwarding carries the clipboard. He notes this works Linux-to-Linux and WSL-to-Linux, but not from plain Windows, and says he uses it daily, especially with Fabric.
Key takeaways
- pbcopy and pbpaste are built into macOS but must be recreated on Linux and WSL with a command-line clipboard utility
- Pipe any command output into pbcopy, and use pbpaste to send clipboard contents into a file or another command like Fabric
- Define pbcopy/pbpaste as aliases in ~/.bashrc and run source ~/.bashrc to activate them
- For remote servers: install the utility there, enable X11 forwarding in sshd_config, add the aliases, and reconnect with ssh -X
- The remote trick works Linux-to-Linux and WSL-to-Linux, but not from plain Windows into Linux
Episode details: published May 17, 2024 · 6:25 long. Summary written by Self Growth Videos from the episode itself. Business results and any income figures mentioned are NetworkChuck’s own claims, shared for education — they are not typical or guaranteed.
← Previous: monitor all your stuff RIGHT NOW!! · Next: You’ve been using AI Wrong →
All NetworkChuck videos · NetworkChuck profile · NetworkChuck on YouTube





