Transcript:
In this video, we’re going to do a quick tutorial on your computer’s, environment, variable or your path and be sure to subscribe to the channel and like the video and leave a comment and visit the website truth-seekers io for more tutorials. So basically, what your path does. Is it lists all the directories that the computer is going to search through in order to run a command? So let’s go ahead and take a look at the path you can run the echo path and so we can see that the computer is going to look in this directory, and then the colon is the separator, so that starts a new one, this directory user local bin user bin etc. So it’s going to search through all of these folders for a command to run. So that means when we run a command like LS that command is somewhere in the path and we can look at it well. I know that it’s in the /bin. So if we look through it, we can actually see. Copy move LS and a whole bunch of other commands, so any command needs to be in the path or you need to specify the location of the executable file, so let’s go ahead and look at an example. I’m going to make a file called who, Dad And this is going to be an executable program. So we’re just gonna make a quick bash Script Bin Bash and we’re gonna echo. I am a who dad command. And then we’ll write that, and then we need to make it executable, and then we’re gonna go ahead and try to run that command from our that program. That X people is Cutable program from our root the directory, and it’s not gonna work. So who Dad Bash command not found so and that’s because you know it’s not our path. So we need to specify the file or the location that would be one option so we can do from that directory that who dad is Dot slash who, dad and we get the command, but again we don’t get it, so we have to put in our path, and if we echo path, we can see that the /bin is one folder where the who dad were that where that’s in the path. So if we move who dad into the bin Oops, a pseudo move, It’s bin. Then if we try to call who Dad, it’s going to work because now that command not a file or that program is in our path. Another option is to add the specific file folder into the path. And you may want to do that for, like a package manager like composer or something. So let’s go ahead and see how to do that. Let’s move, well, let’s make Derp test derp in our home directory, and then we’ll move the food add-in to the test directory or sudo. I always forget that okay, so now. If we check out our test directory, we should have the who dad command, but if we go into our home directory, won’t we won’t be able to run it? No such file, directory or command not found, so we need to add a to our path, so the way that we would do That is with our our dot bash. RC file or our dot bash profile file and one of those. You know, there’s probably more that would work, but I use my bash, RC. So let’s go ahead and do bash RC, so we’ll edit this, and this will how this is, how you make your path permanent, so you do export path equals and then the existing path. And then you set the new path, so our my home directory is home Slash John /testdir. And that’s the folder that is. That has the who dad command so. If we close this out, let’s refresh the session and now run who, dad and we get who that and if we check our path, we see this home slash. John Slash tester is now in the path because of our bashed RC file has this export command. And that’s basically how you update your path permanently. The last thing is, you may want to prepend the folder to the path. So if you want to do that, we would need to do well. I’ll just show you so VI dot bash RC and actually wanted to use bash profile, but that’s not that big of a deal. So if you want to put the folder in the beginning of the path, then you just move the path to the end, so we’ve got path equals the directory. You want to add to the path and then colon path and then that will move it to the end, so if we close this out and refresh that go path and now you can see slash home slash. John Slash tester is at the very beginning, and that’s basically path your path Environment variable. Hey, everyone, hope you enjoyed the video. Be sure to subscribe to the channel and check out the website tree. Seekers IO for more tutorials and recommended books and other stuff. So have a good day. See you later, you.