In this video we'll talk about how to list files with ls.
To start with, it's a good idea to use pwd, which will print the name of the current directory.
And LS is used to list files and directories. We've seen it a couple of times already.
With ls there's a couple of options that you might like.
Like the option A which will show hidden files also,
or the option L which provides a long listing.
Now, when you are using LS on a directory, it's a good idea to use LS ld because
just LS L on a directory will show you the contents of the directory. But if you want
to see the property and not the contents of the directory, you need to add this D option.
Another one that I like a lot is LS lrt, which shows a time sorted
list of vals. Let me show you so LS L. Let's start with that.
What are all the properties that we see from left to right? The very first column,
one character only, is the identifier of the type of the VAL that was found.
And here for desktop we see it as a D, which means that it's a directory.
Then we have the permissions. We will talk more about these permissions later.
RWNX for read, write and execute.
Next is the number of hard links. I'll explain later. As well we have
the user owner and the group owner and we have the file creation date.
So this is when the file was created.
And that is what you get in your default LS L output if ever
you are in a bigger directory. Let's do that on the Etc directory you
use LS Etc and there we can see the contents of the Etc directory.
But hey, what if you want to know which file was edited last? Well, you use LS lrt.
LS LRT is always showing the last modified file last in the list.
You want to know what LS minus LRT just means the R and the
T. Well, I would say use LS help and just look up the options.
So when we look up the options there we can see minus T is for sort
by time, newest first and the minus R is for reverse, reverse order while sorting.
That is because I think it's convenient if the newest file is listed last and not first.
And that is what LS minus LRT is doing.
Now one more thing that I need to show you and that is this. When
I use LS L on Etc, I get the contents of the Etc directory.
But what are we going to do if I don't want to see the contents, but I want to see
the properties. Well, I'm adding a D so LS LD on etc is showing the properties of this directory, and
for now that should be enough to get you started and show information about vals in your current environment.