Looking around#
Get logged into your Ubuntu VM as your normal user and type this: pwd
. This means "present working directory", and I get this:
1 2 |
|
Note
Notice the little ~
just before the $
? That's the tilde, and it means "home". It means you're exactly in your home directory.
So we're in /home/michael
. All Linux filesystems follow this pattern /<path>
. There's a path known as the root of the file system, or just "root" (not to be confused with the root user) that's simply: /
. We can go there right now: cd /
and now I get pwd
:
1 2 |
|
So now we're at the root of the file system, but what's here? Type this: ls
1 2 3 |
|
Interesting! These are all directories, but it's not possible to tell from looking at them here. Let's make it a little easier by using a command-line flag to the ls
to not only "list" the items top-to-bottom, but also get a lot more information: ls -l
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
That's a lot of information. We're going to cover everything in the first column - the drwxr-xr-x
like stuff - in the next section, but let's briefly go over what we're seeing here.
Each row above, each item, is split into column, from left or right. We'll look at each column below.
Permissions#
The drwxr-xr-x
, for example, is the permissions. This tells use who can do what to the item in the list. Again, we'll cover this in the next section.
Notice the d
at the front of some (most) of the items? That means directory
and that's how we know the item on the very far right, the last item, is a directory and not a file (or anything else.)
Links#
The second column is the number of links to the specific file or directory. This isn't important at this point in time.
The Owner and Group#
The third and fourth columns are the owner of the file/directory and the group that it also belongs to.
Size#
The fifth column is the size of the object. In my list I have:
1 |
|
Which is a SWAP file. Nothing to worry about, but how BIG is it? That's a big number! Can we make it more readable?
Try this: ls -lh swap.img
1 2 |
|
I did two things here: I added the -h
flag to my ls
command to further modify the behaviour of the command, and I added the filename at the end, swap.img
. If I didn't include the filename, I would get all the files, but I want to know how big this particular file is and now I know: 3.9G
which translate to 3.9GB
or 3.9 gigabytes
.
Date and Time#
The sixth, seventh, and eighth columns are the month, day and time the file was last modified or changed. If it's a directory, it's the same information but it tells the last time a file inside the directory was modified (not the directory itself.)
Name#
And finally we have the name of the file. We've just looked at one, swap.img
, but there are many in the list.