brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: pipe into clip to fill the Windows clipboard from the command line

Clipboard
~/tips/tip-windows-clip-command

dir | clip

Send output or a whole file to the clipboard without selecting.

Copying from a Command Prompt window by dragging a rectangle is nobody’s favourite. Windows ships a tiny command that does it for you.

dir | clip
ipconfig /all | clip
clip < readme.txt

Whatever comes through the pipe or the file ends up on the clipboard, ready for Ctrl+V in a ticket, a mail or a chat. It prints nothing, which is normal.

I’d use it any time someone asks me to send the output of a diagnostic command. It arrives complete, without the first lines scrolled off the screen.

It also works from Linux under WSL, because WSL can run Windows programs if you add the extension:

cat ~/.ssh/id_ed25519.pub | clip.exe

Read before you paste. Something like ipconfig /all includes machine names and network details that you may not want in a public forum post.

It only writes. There is no way to read the clipboard back with clip, so for that you need PowerShell’s Get-Clipboard. Text with accented or non Latin characters can come out garbled depending on the code page of your console, so check a sample before you paste it into something important. And each use replaces what was there before.

Further reading: clip command reference, Working across Windows and Linux file systems

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More Clipboard tips xclip -selection clipboard < ~/.ssh/id_ed25519.pub uname -r | wl-copy "+p paste from the clipboard Command-C copy on the Mac cat ~/.ssh/id_ed25519.pub | pbcopy All Clipboard tips (6) All topics

Link