This is one of those things you didn't know you needed, but you'll end up using it every day. Copy and paste in the terminal. Now, I know it sounds stupid, but seriously, it's so cool. So in this five minute Friday, I'm going to show you how to copy and paste in your terminal. Now you're probably thinking, Chuck, we already have this solved. We can already copy something and paste it right into our terminal, and we can also copy from our terminal control shift C and I got it. So what am I talking about? Maybe I want to do this cat a large file. This is a transcript of one of my YouTube videos and pipe that sucker right into my clipboard just like that and paste it anywhere I want. That's a lot of stuff. Or maybe I want to copy everything from this article right here, the entire page, which if I normally pasted that into my terminal, it would be, yeah, based. Anyway, chaos. Stop it. Stop. I can just do this and pipe that into any command I want, like maybe fabric to summarize the article for me, which by the way, fabric is amazing. Go watch my video on that right now. Now, this doesn't happen by default, these commands, PB copy and PB paste, they don't exist, at least not on Linux or Windows. They do exist on Mac and they're amazing. So if you're a Mac user tutorial over what I just showed you, you can do it right now. You're welcome. Walk away, get some coffee. I'll see you later. But if you're a Linux user or a Windows user using WSL, I found a way to make this magic happen. Now because this is a five minute Friday, I got to move fast. Oh, and by the way, I'm doing five minute Fridays. If you like these. Let me know if you have any suggestions for content. Comment below. Also, have you hacked the YouTube algorithm today? Have you not? Let's make sure you do hit that like button subscribe. Comment. You got to hack YouTube today, ethically, of course. Anyways, enough With that, we're going to launch our terminal. If you're on Linux, just launch the terminal. If you're on Windows, launch your WSL terminal. The first thing we'll do is install something called Excel. No, not Excel. Excel. It's a command line program used to access and manipulate the clipboard. So we'll install that with a PT. Install, Excel, the little pseudo action at the beginning. And when that's done, you're pretty much done. And we can throw stuff on the clipboard like this. Let's do a little, you name dash R, and we'll pipe that out to this command Excel dash input dash dash clipboard. Let's see if it worked. Bam, there it is. Or I can copy something and I can paste it in with Excel dash output, dash clipboard. I can save it to a file. Let's say file txt and there it all is, but we don't want to type that in every time. These commands are long, so we'll make an alias or a nickname for this command. To do that, we'll jump into our bash RC file, nano tilda slash bash rc. And right up here at the top, you can put this really anywhere you want. We can define our aliases. We'll type in alias, and we'll say PB copy. That will be our command. And we'll say equals this command opening. Single quote, we'll say Excel, dash dash input dash dash clipboard. We'll do the same thing for PB paste. Alias pb paste equals Excel output dash clipboard, and that's pretty much it. We'll hit control x, Y and enter to save. We'll type in source tilda slash RC to refresh our terminal and start using that file. Now, let's try it out. We'll echo, Hey, does this work? And we'll pipe that into PB copy and let's see if it did. Awesome. It totally did. Let's put it right back in PB paste. Boom. There it is. Now you can make these commands, whatever you want it to be. You can make it simply copy and paste. I did this because I have a Mac and I don't want to get confused. Now, you might be done, but what if you want to log into a remote server, another Linux server and still have this clipboard action? You can do that. Just a few simple steps. Now, keep in mind this scenario only works for Linux servers logging into another Linux server. You can also do this with WSL, which is Linux logging into a Linux server. What doesn't work is Windows logging into a Linux server. You can try to make it work. It's not a good time, just don't even think about it. And we only have to do two things to make this work. And it's all going to be on the remote server. One, we have to make sure that Excel XL is installed on your remote server. Two, you got to make sure X 11 forwarding is enabled on that remote server, which is a really cool feature that allows you to run a program on one server, but display the graphics on another. We're going to use that to do some clipboard magic. Thankfully, it's kind of enabled by default, but we'll check to make sure. So first I'm going to get logged into my remote server. I'll jump into my AI server. Terry. First thing we'll do is make sure we have X Excel installed. Pseudo A PTI install Excel. I already do. Step one is done. Now let's check step two. Let's make sure X 11 forwarding is enabled. Let's quickly cat this file. We'll CAT E-T-C-S-S-H-S-S-H-D underscore config, and we'll GRE for X 11 just like this. And if you're new to Grip, all that did is simply search the file and output only lines with X 11 in it. And we can see right here we have X 11 forwarding yes, and it's not commented out. Notice this one down here, X 11 forwarding no is commented out. So it's not an active config. Now if you don't see the yes, you'll need to jump into that file with nano and edit that. So we might say nano Etsy, SSH, SSH D config. Make sure this line of config exists. Control X, Y enter to save, and then we'll do a pseudo system, CT L, restart, SS H, and that may log you out. And you know what? I lied. There is a third thing we might want to do, and that's set up our aliases because our aliases exist on our host system either in WSL or Linux, but they don't exist on the new system. We'll have to add those there as well. So same story, nano, Tilda, Matilda, anyone do that in their head when they say that? Anyways, bash RC and I already have mine here. But go ahead and add yours just like this. Once you have all that config there, we're going to actually disconnect from the server. So just type in exit. We're back in our host system, and this time we're going to connect back to it with a special switch. So we'll do s, s, H, and here's the difference. We'll do dash capital X, which will force us to use X 11 forwarding, and then business as usual network, Chuck, or whatever your username is at your server. So now I can copy and paste on a remote server with no problems. Let's try a copy real quick. Yep, like. A five minute Friday. Was that five minutes? It probably wasn't. I'm sorry, but I hope this was helpful. I seriously use this every single day, especially when I'm playing with fabric. And I would love to hear if you install this or if you have any tips or tricks for me, or if you have an amazing tip, I would love to share that. And also, if you want to support what I do and learn some cool stuff along the way, check out network. Chuck Academy, link below. That's my baby, my project. I'm pouring all of my energy into it, and it's a place where we can hang out. So I hope to see you there. That's all I got. I'll get you next time.