 Hello and welcome to the series on shell scripts. I hope you're enjoying this today We're gonna be looking at how to find where certain commands are located and if you work with the shell at all You're probably familiar where the where with the where is command I could type something like where is nmap and it will tell me right where the executable is and the other files That might go along with it such as the man file for the manual. Another one I can do is where is and I can say PWD and right here you can see that there is an executable PWD and there's a header file if you're programming and see you can use that and There's a man page as well, but let's try another command. Where is And we'll try the read command the read command is a command that allows you to grab user input when we hit enter there It tells me where the man page for that is the files for the manual But it doesn't tell me where the executable is and that's because it is a built-in command It's built into my shell which currently right now. I'm at Z shell. Let's go ahead and type in command dash capital V in a command command You probably saw in a previous tutorial. I did I briefly touched on it does a few things like telling it to run an actual executable Rather than a built-in function, which we did in a previous video, but here with a dash capital V Switch we can type in something like free and it tells me where the executable is but if we did one like read It's gonna tell me that it's a built-in to the shell Another one we can do is command Capital V and we can do archive archive is actually a function that I created that is inside my Z shell Rc file so it will tell you whether it's a function and if I was to create an alias Let's say I was to say I wanted to alias the command year to date plus percent y Now anytime I type in year, it's just gonna tell me what year it is But if I command dash capital V year, it will tell me that year is an alias for this command So so far it will show us Where an executable binary is whether it's a built-in command whether it's a function within Like my RC file or if it's a alias, let me go ahead and clear the screen here real quick Let's create a function right here in this session Let's say I wanted to create an epoch command for getting Unix time stamps And I can just do in here date Plus percent s now anytime I type in epoch. It's going to give me the number of seconds since 1970 So that's great now if I use command dash V and The epoch command you can see that it's gonna tell me that it is a shell function Last time it told me with the archive command that it was a function that was in my RC file So I know right where it is here I know that it's a function that has been run in the current session if I was to start a new session Like so and I type in epoch is not gonna work And if I was to run this it's gonna say come on man not found because it was in this session So that is the command command and you might wonder where does the command command live? and You can run it on itself and you can see that it's built into the shell and As I mentioned in the previous previously in this video I'm running Z shell which is my default shell But if I would start up bash the command command is Built into bash as well, and so I can use it just as I did before Within bash now let's look at another command that does something similar And that would be of the type command So again example type dash a instead of capital V We can type free and you can see again. It does basically the same thing. Let me go ahead and go man Oh, that's not gonna work. That's actually next tutorial And I can do type dash a Archive and again It's gonna tell me the same thing that command command does and don't get confused again We're working a link shell if you're in windows type is a completely different command No, I haven't worked with windows in years but back in the day And I'm pretty sure it still is type is basically like the cap command if you wanted to output a file You would type type and the name of the file and of course just like the command command I can say command type a and type in type and it tells you it's a built-in command And you can type in type a type dash a Command and you can also run command on type So that is the command and type and we're gonna get us a little bit more than next because they are built into the shell So is that going to always work for us if we're working with different shells? That's what we'll talk about in the next video or in a coming video I've got a few more things on this topic. So I do hope you're enjoying these videos Be sure to like share subscribe comment And visit my website films by Chris calm. That's Chris the K There is a link in the description of the video there there You can search through all my videos from both my channels You can also support me there in the sports section. There's a link to my patreon page patreon.com forward slash metal x 1,000 and also a paypal link if you like to support me that way if you can't support me that way Think about sharing liking comments writing all that stuff helps out a great deal I do thank you for watching. Hope you found this useful and I hope that you have a great day