 Hi, I'm Denji and in today's video, we're gonna be taking a look at some rare Linux tricks. So the first one is actually something I see quite a lot being done in a quote-unquote wrong way. Some people wanna run two commands in the same line on the terminal. They tend to do this. They tend to, I don't know, run yay dash SYU. That's the command to update everything on my system. And then what they do is they type and and, and then they type another command like I don't know, echo done. So I run that over there. It's gonna start updating all my packages and doing everything. And then once that's all done, it's gonna echo done right over there. Now, this is a good way of doing things if you're aware of what and and actually does. And what it actually says is that if this command over here, yay dash SYU was a success, then you can run the next command. But if the command over here fails, then it won't run the next command. Now, there's a far better way of doing this if all you want is to run two commands in the same line. And that would be just use the colon key. You can just type that in and then boom, run another command like echo done, like that. And then as you can see, it does the exact same thing. So instead of doing shift seven seven, which is a bit inconvenient on the keyboard, you can just press the colon key spam it as many times as you want. All right, moving on to tip two. This is actually related to package management. I'm gonna give the example here on Arch Linux, but I'm pretty sure there's a tool like this for Debian as well. I think it's called apt-file, if I remember correctly. But basically, let's say we have a file on the computer like where is netstat? There it is, user bin netstat right over there. We wanna be able to see what package owns this file. Now with pacman, we can do that quite easily. We can do sudo pacman-qo user bin netstat. And just like that, it says that this file, the netstat command is owned by net tools. Now there's a similar thing you can do for commands that aren't on your system. So let's say, let's just remove the net-tools package over there. Let's say we want to install the netstat command, but we don't know what that belongs to. We try to install netstat. That's not a package that exists in the repository. It couldn't find it because that's not the name. So how do we find the name of that package that contains that specific program? Well, it's quite simple. We can run sudo pacman-f and then search for the file that we want. So in this case, it's gonna be netstat. And as you can see, it's searched through the repos and we found user bin netstat under the net-tools package. So this is a good way this dash-f command to find whether a specific file is owned by a package in the repositories, even if you don't have that package installed. Okay, this next step is actually gonna be for SSH users. I have a server, it's wiki.denshi.org. That's where the denshi wiki is hosted. So I'm just gonna quickly SSH into it and here we are, we have a little devian server. Now one little-known function that SSH has is the dash-d option. The dash-d option allows you to have a SOX5 proxy in SSH. So if you run dash-d, then give it a port like let's say 9006, just an arbitrary port on my computer, it's gonna start a SOX5 proxy on that port. And as you can see in my U-terminal over here, I'm running Chromium, the Chrome browser with the proxy server option set to SOX5 localhost 9006. So if you run this over here and then check my IP in doc.go, as you can see it's in Rome and I'm definitely not in Rome now. That's the IP to the wiki. So in this way, you can have your own little proxy, your own little pseudo VPN just by having SSH installed. But there's no need to install OpenVPN or WireGuard if all you need is a SOX5 proxy. Okay, this next thing will be a little bit more obscure, but basically I'm gonna be taking a look at this image over here. It says text on an image. This is an image file, it's a JPEG and as you can see it as text. Now we can read this and transcribe it. We can write text on an image and stuff. We can read this. But what if I had like a big image file and I had a bunch of text in it and I wanted some way to get all the text out of it? Well, there's a great program called Tesseract that can do that. The way you use this is if you run Tesseract, then the name of the image, so textimage.jpeg and then the name of the file, let's say text, right? And press Enter. We can then check that file, text.txt and as you can see it has the same text as the image from before. So this might seem like a pretty trivial thing for just a small image like that, but if you have a big image or like a video with many frames and things like that and you wanna recognize text in it using this program, Tesseract is a great way of doing that. This final tip is gonna seem a little bit more obscure, but let me just explain where I'm coming from with this. So let's say we have a program like KISS. Now, I don't have it installed over here, but basically KISS is a package manager for the KISS Linux distribution. Most package managers and things, they have something called the noconfirm option. So if everyone yay dash s, I don't know, a program like Grubb and run it with dash dash, noconfirm, it will not ask for my confirmation when installing packages. It's gonna go straight to doing it. And of course, that's useful if you want things to be automated, but not all package managers have this functionality. And the same applies to lots of other things in Unix. There's many moments in which you do not have an option to skip something. And for that, there's a program called yes. And I'm sure you all are familiar with this. If you run yes, it just outputs Y to standard output. And that's all useful, right, for some programs that accept it. But you can make yes output literally anything. So let's say you want it to output hello world. It will output hello world to new lines constantly. And we give you the same with new lines. So if you run yes, and then I think it's this, and then this, as you can see, it's constantly outputting new lines. So let's take a look at a practical application when it comes to the KISS package manager. So we're here in KISS Linux, right? So everyone KISS, as you can see it, it has all those functionalities. Let's say I wanted to update my system, right? It's gonna start going through the update process. And it asks me to continue over here to press enter. Now let's say I didn't want that prompt. Well, there's no options in the actual KISS program to do that. There's many other programs like this on Linux where it will ask you to press enter or confirm and you do not want to do that. You just wanted to automate that process. So for this, we can use the yes command. So if we take what we just got there, so yes, then this, and then this, and then pipe that into KISSU, as you can see, as soon as it asks for verification, it automatically presses enter and it starts compiling our package. Now this is a very niche example, but yes, does have some practical applications outside of programs like this. It's mostly a workaround for programs that do not have an auto-confirm option. So that last one was a little bit more advanced than normal, but I hope you found all of these useful. In summary, we've learned about the colon, about sudo pacman-f, about the Tesseract program, and of course, finally, about how to use the yes program. So yeah, I've been Denshi and thanks for watching.