1
00:00:06,660 --> 00:00:09,769
In this video we'll talk about
how to list files with ls.

2
00:00:11,330 --> 00:00:15,789
To start with, it's a good idea to use
pwd, which will print the name of the current directory.

3
00:00:16,710 --> 00:00:21,730
And LS is used to list files and
directories. We've seen it a couple of times already.

4
00:00:22,769 --> 00:00:25,210
With ls there's a couple
of options that you might like.

5
00:00:25,769 --> 00:00:29,890
Like the option A which
will show hidden files also,

6
00:00:29,890 --> 00:00:34,009
or the option L
which provides a long listing.

7
00:00:35,490 --> 00:00:41,289
Now, when you are using LS on a directory,
it's a good idea to use LS ld because

8
00:00:41,289 --> 00:00:47,089
just LS L on a directory will show you
the contents of the directory. But if you want

9
00:00:47,090 --> 00:00:52,890
to see the property and not the contents of
the directory, you need to add this D option.

10
00:00:53,950 --> 00:00:58,905
Another one that I like a lot
is LS lrt, which shows a time sorted

11
00:00:58,905 --> 00:01:03,859
list of vals. Let me show you
so LS L. Let's start with that.

12
00:01:04,579 --> 00:01:10,504
What are all the properties that we see
from left to right? The very first column,

13
00:01:10,504 --> 00:01:16,430
one character only, is the identifier of
the type of the VAL that was found.

14
00:01:17,109 --> 00:01:20,750
And here for desktop we see it as
a D, which means that it's a directory.

15
00:01:22,099 --> 00:01:25,140
Then we have the permissions. We
will talk more about these permissions later.

16
00:01:26,120 --> 00:01:28,459
RWNX for read,
write and execute.

17
00:01:30,000 --> 00:01:34,039
Next is the number of hard links.
I'll explain later. As well we have

18
00:01:34,039 --> 00:01:38,079
the user owner and the group owner
and we have the file creation date.

19
00:01:38,780 --> 00:01:40,700
So this is when
the file was created.

20
00:01:41,379 --> 00:01:47,576
And that is what you get in
your default LS L output if ever

21
00:01:47,576 --> 00:01:53,773
you are in a bigger directory. Let's
do that on the Etc directory you

22
00:01:53,773 --> 00:01:59,969
use LS Etc and there we can
see the contents of the Etc directory.

23
00:02:00,549 --> 00:02:05,790
But hey, what if you want to know which
file was edited last? Well, you use LS lrt.

24
00:02:08,150 --> 00:02:12,830
LS LRT is always showing the
last modified file last in the list.

25
00:02:13,750 --> 00:02:19,639
You want to know what LS minus
LRT just means the R and the

26
00:02:19,639 --> 00:02:25,529
T. Well, I would say use LS
help and just look up the options.

27
00:02:26,349 --> 00:02:32,050
So when we look up the options there
we can see minus T is for sort

28
00:02:32,050 --> 00:02:37,750
by time, newest first and the minus
R is for reverse, reverse order while sorting.

29
00:02:38,770 --> 00:02:43,840
That is because I think it's convenient if
the newest file is listed last and not first.

30
00:02:44,360 --> 00:02:46,849
And that is what
LS minus LRT is doing.

31
00:02:47,930 --> 00:02:52,439
Now one more thing that I need
to show you and that is this. When

32
00:02:52,439 --> 00:02:56,949
I use LS L on Etc, I
get the contents of the Etc directory.

33
00:02:58,050 --> 00:03:04,080
But what are we going to do if I don't
want to see the contents, but I want to see

34
00:03:04,080 --> 00:03:10,110
the properties. Well, I'm adding a D so LS LD
on etc is showing the properties of this directory, and

35
00:03:10,109 --> 00:03:16,139
for now that should be enough to get you
started and show information about vals in your current environment.
