Transcript from the "CLI Directories & Arguments" Lesson
>> All right, so I'm gonna go up one directory now. So now I am in home. And now I want to know what's inside of home. So I'm gonna clear again here. So I'm gonna type ls and I run that and now ls is going to tell me here is everything that's inside of this directory right now.
[00:00:15] So now I can see I have one folder inside of the home directory and it's called Ubuntu. Or if I go up one, and now I am in root, right? And if I type ls here, you can see that there's a bunch of stuff in here. So that's what ls does for you.
[00:00:34] It stands for list, right? It's just saying list everything that I have in here right now. Cool, so those are two of the again, most useful things. I use ls so much that it's almost a nervous tic at this point, that I'll just change directories into something, even if I know everything that's inside of that directory beforehand.
[00:00:57] I just immediately type ls from just muscle memory, right? It's like running my hands through my hair, like picking your teeth, or I don't know, or biting your nails, right? You can just run ls immediately. The nice thing about ls as well is right now, you can see I'm in the root directory, but let's say I wanted to know what was inside of the home directory.
[00:01:19] I can say ls and then I can give it a path to look inside. So, if I say ls home, it's going to tell me what's inside of the home directory. So, this is called an argument or parameters, you can call it either one of those things. Tends to get called arguments in this particular case, that's what I'm gonna stick to.
[00:01:38] And here I'm telling it, not only do I want to list something, but I'm telling you where I want the list to be ran and this is going to change from program to program what kind of arguments that you are going to give into it. And again, this --help is gonna be immense help to you.
[00:01:57] This is actually quite long, but you can see up here it's telling you ls and it is telling you, this is how you can run ls. So that's something to keep in mind as well. Okay. Another one that I wanted to go over is something that I'll be using all the time is one called echo.
[00:02:23] So if I say echo and I say hi. Surprise, surprise, it just says hi, right? So you're just telling it to output whatever I say put in there. So if I say, echo welcome to frontend masters, it's going to say welcome to frontend masters. Now obviously this is not incredibly useful for what we're doing right now, but it will be useful when you're inside of programs and you're doing things one after another.
[00:03:18] So I would have to say echo "welcome to frontend masters" or else it wouldn't work. So sometimes you have to put that in quotes. Just be aware of that. Here's another good one. There's another one called which, so which will tell you what the path is to the program that you're running.
[00:03:36] So if I say which and I say, let's say ls for example, it's gonna tell me the ls program lives in /bin/ls. So you could actually change directory into the /bindirectory and you could find ls in there. If you run ls in here, you can see there's actually a lot of stuff in the bin directory.
[00:03:56] Bin stands for binary. It's where you keep all of your runnable programs. But you can see here, ls should be in here. Here it is, it's right there. But here is just some of the very great many programs that you can run with Linux. All right, so I'm gonna go back to my home directory.
[00:04:27] All right, so that's kind of arguments. Some programs take one argument, some programs take no arguments, like pwd for example, takes no arguments. ls optionally takes an argument. Some programs take many arguments. So it just depends on which program and you'll see that kind of as we're going through here.
[00:04:47] But argument is just textual information that you're providing to a program. That's the idea of what an argument is.