 We're continuing with our shell tutorials and we're going to be working in the shell We're going to do a pretty long one liner. I do have to look at my notes for this I don't have the whole thing memorized But you can always create an alias for this is something you want to do regularly and what we're going to do is we're going to run a Command that lists all the open files on your system and all that sort of information is found inside your proc folder So we're going to start off. We're going to say find and we're going to say inside our proc folder Look in every sub folder of that for a folder called fd. Then we're going to say dash x type Type f and that's saying only look for files if it's not a file like if it's a directory or something like that ignore it Then we're going to print out the information we got so we're going to print f Excuse me and in quotations here. We're going to say percent sign l back slash n This is saying basically this is this percent l saying print the output from this command And the backslash and it's just a new line meaning put it put it each one on its own line now if we run that We're not root right now. I'm a regular user, so I'm going to get a lot of permission denies as you can see The bunch of bunch of permissions denied so I'm going to clear the screen and what I'm going to do is To greater than forward slash dev forward slash null so make sure no spaces here percent or not to not percent but to Greater than means any error output So if it's an error like a permission denied or any type of error instead of printing it to the screen We're going to pipe that into dev null which is like a wasteland where you just throw garbage It basically makes it not exist anymore. They're going to pipe that well. Let's run that so a little bit better but we get a lot of these deleted files, so let's go ahead and Pipe that into grep-v and Which means we're going to look for something and we're going to show everything that doesn't equal that so inside quotations. We're going to say deleted Delete Leated it's weird when you get on a new line like that, but that says deleted inside parentheses And then we're going to say dollars at the end So it's only looking for the parentheses deleted at the end of the line in case for some reason That's in the name of a file. It doesn't skip it. So only if it's at the end of the line So we do that we run this and look we got all that now we can pipe that into sort Dash you for unique and there we go. We get a list of files that are open We can also if you don't care about things in the proc folder for example or your sys folder We can do something like this. We can say grep dash v lines again begin with proc for proc and I can Kind of sloppy to do it in a separate command, but that's just how I'm gonna do it right now I can do forward slash OPT, you know, just narrowing down my search for things that might be specific to me So now that I have that you can see all like like these fonts are being used probably by chrome Because I have chrome open and you notice that a lot of these things are going to be Config files they're constantly read like by chrome or by cinnamon a lot of chrome chrome does a lot of stuff So you can see a lot of these are chrome this chrome that and you can see cinnamon bringing stuff up cash stuff But let's real quick. I'm gonna split my screen here oops Okay, and I am going to Touch a file In my temp folder, I'll just call it one So I just create an empty file and now I'll vim into it temp one and now if I do this And I grep through that I should be able to find That file, so let me run that same command again, but I'm going to grep for Something it says temp one And you'll see it doesn't come up and you might wonder why well certain programs like vim Don't necessarily open the specific file. It creates a temporary file and then it saves that file So I'm gonna run that again, and you'll see right here. We have temp dot meaning. It's hidden file one dot Swap so in this vim window here. I'm actually Editing that swap file, but when I save it it basically copies this swap file over the original file. So that's why you don't see temp one open So keep that in mind when you're trying to figure stuff out if you're trying to grep for something Think that it might be in a temporary file rather than the actual file Anyway, it's kind of a long command I will try to remember definitely with this one to put a link to that in the description of this video and As always, I thank you for watching. Please visit films by chris.com. That's Chris of the cave There should be a link in the description As well as a link to my patreon page patreon.com forward slash metal x 1000 as always I thank you for watching and I hope that you have a great day