Get all your news in one place.
100’s of premium titles.
One app.
Start reading
Windows Central
Windows Central
Technology
Richard Devine

Like me, you might not have known this handy Windows 11 clipboard terminal trick for PowerShell and WSL

Piping the contents of a .bashrc file to the Windows 11 clipboard from WSL.

The terminal is one of those places that looks scary to many, though it really isn't. But others absolutely live in there, be that for work such as system admin, or you might just be a massive nerd (like me) who finds it weirdly enjoyable. Or any number of reasons in between. The terminal is a powerful tool in any PC user's arsenal. 

You'll always learn something new, too, like this little nugget shared on Reddit by Microsoft's Jen Gentleman

It details sending the outputs of commands entered into the terminal directly to the Windows 11 clipboard, where you can then paste to any other app you need to. If you know you're going to be outputting a lot of text, this is a handy time saver. Here's how to do it. 

Tip of the week: Use clip to pipe the output of your command to the clipboard from r/Windows11

How to copy command outputs to the clipboard from PowerShell, Command Prompt and WSL 

The best part of this is that it doesn't matter whether you're using PowerShell, Command Prompt or the Windows Subsystem for Linux (WSL), it all works the same. All you have to use is "Clip" after the command, which will send its output directly to the clipboard. 

There are mild differences between PowerShell/Command Prompt and WSL, though. In the first two, you would pipe to clip after the command. In WSL, you need to pipe to clip.exe, which tells Linux to interact with the clipboard on the host system. 

So, for example, if I'm in WSL and I wanted to quickly copy the contents of my .bashrc file to the clipboard, I'd enter this in the terminal: 

cat ~/.bashrc | clip.exe

When the text has been copied to the clipboard you can quickly paste it into any app, no need for trying to select and copy text. As long as you remember the all important pipe (|) it'll get sent straight to the clipboard. 

Personally, it's not something I'll need all the time, but there have been occasions I've really needed something like this and never knew it existed. I like to keep a backup of changes I've made to my .bashrc file, for example, and this will definitely help with that. Hopefully it'll help out a few of you, too!

Sign up to read this article
Read news from 100’s of titles, curated specifically for you.
Already a member? Sign in here
Related Stories
Top stories on inkl right now
One subscription that gives you access to news from hundreds of sites
Already a member? Sign in here
Our Picks
Fourteen days free
Download the app
One app. One membership.
100+ trusted global sources.