 Hello and welcome. This is video three in my 2018 Shell script tutorials for your Linux shell. Let's go ahead and look at the stack command So let's say, you know if I was to list out here I've got a folder with a couple of video files in it a couple of sub folders there from Christmas Day and Let's say I wanted to get information about it. I could do list space dash L for list H for human readable a for All I believe because it will show hidden files as well There's no hidden files in here, but I tend to that's just how I type it by default So here we go. You know, we got information on permissions for a file I forget what the second column is here Probably file type. These are probably files. These are probably directories something like that Don't know. No, that's what this is for. I forget what the second column is. Anyway Let's say I wanted to know the user or the group that owns these files I could do that and let's say just one the user of a file. I could list out that file Let's say I want to go with this file this this Christmas morning one dot AVI AVI I could do that that lists out that file and then I could pipe that into awk and I can then say awk Print dollar sign and I want column three. So one two three. Yep. I'll call three and there we go I can see that the owner of that file is Metal X 1000. That's me That's that's that's you know, writing two commands and and piping stuff and it's it's a bit longer than needed So what I could do is I could use the stack commands I can just type in stats dash C and since I want the user I can say Percentage capital U here and the file name. So Christmas morning AVI and right there it gives me just the user name Now we could look at the man file to learn more about the stat command and here we go You can see a list of options here and you can see lowercase a is the access rights in Octel or capital a is access rate in human readable forms So if we were to run the same command again, I can just do lowercase a and it tells me right there The permissions in octal or six four four, you know, so that's Long wait, but you can also do capital a and you can see that it is you know for the user It's readable or writeable for everybody else. It's readable And of course you can put some of these together Let's say I wanted to say the who the Owner is the user that owns that file I can say percent capital U and then capital a and you I can see I get that's the That's the user and these are the permissions here And of course I could should be able to reverse those as well and there you go Actually, no, I did a and a didn't I? There we go. Okay. So those are some examples. Let's look at other options We could also use it to You know get links. So let's go ahead and go back in the man page here for stat And we can scroll down here and you can see a lot of options. You can see you know what file type it is and Was cure Linux security contact string Going down We can get just the file name if we want So a lot of the stuff that you can get with the list command But you can ask for specific parts of them without other information So that way you don't have to grep and pipe and said just to get a piece of that information It's just a little more efficient that way And here with the with the file name command we can use that We should be able to use that Actually, let's look at this capital in here quote file name with difference of symbolic link So I have a symbolic link in my WWW folder, so I'm going to do is I'm gonna say stat I'm gonna say dash C and here. I'm gonna say percent n and then the Link is inside my home folder WWW media and I could enter and right there. It tells me that this Symbolic link is pointing to this directory here So that's a quick easy way to just split things up and again look at the man page because there are a lot of options in here I'll list it right there And again, it might save you some time, you know some some coding You don't need to pipe stuff which same system resources and might shorten up your commands a little bit And and you can run this on a full directory. So let's say we were to go back up to here I can say give me The you know the permissions and the username for all files in this directory and there you go you get both of those So that's it for this tutorial So I hope that you find that useful if you did be sure to check out the rest of my videos in this playlist and my previous Playlist I've done hundreds of shell script tutorials over the years be sure to check them out on my website filmsbychrist.com That's Chris the K there's a link in the description there you can quickly search through all my videos from both my channels and While you're there check out the support section where you can support me through PayPal or patreon. I do appreciate support Also, if you like my videos be sure to like share subscribe and comment that stuff helps a lot More views I get the better and I appreciate it and I hope that you have a great day