Hello everybody and welcome to this tutorial. Today, I will go over a few basic commands
you will need in order to follow this course through. There are four basic commands that
are used in order to navigate within the terminal, or through the file system, to figure out
where you are at the moment, to copy things, move things, get listings of files, folders,
see the contents, remove them, change the ownership of files or change the modes of
files. You will see shortly what I mean. First off, we have "cd" which is change directories.
If I just type in cd/home, I am going to navigate over to my home directory. So, "cd" stands
for change directory. As I said before, you are literally changing your working directory.
If you type in "cd.." you will always go one step back. So ".." is always the previous
folder. It's a shortcut you will use fairly often. Next up, we have "ls." "Ls" shows you
the listing off the current folder contents. You can also use, for example, "ls /home/"
and you get the listing of a specified folder as well. Typing "ls" in and of its own give
you the listing of the current folder, as opposed to typing "ls" and then a path to
a folder, which will give you a listing for a specified folder. In addition to that, you
also have "ls - l" which will give you a long listing. That will tell you who the owners
are, the size, the date, the type, the permissions and so on and so forth. However, one of the
more common usages of "ls" is "ls - la" to show the hidden files as well. You might notice
that I am not using "ll" like I generally use in Fedora. It goes "- ll" command not
found. I guess I could install it here as well, but it doesn't really matter. It performs
a fairly similar function as "ls" does, but it's a bit faster to type in. Now I'm just
going to go ahead and clear this. Next up, is "pwd" which prints working directory. Some
of you may find it confusing, but / in all Linux-like systems simply refers to the root
directory, to the beginning. To the root directory from where all the files are located and from
where everything begins. Let me just make it clear. I'm going to navigate over to home,
and then use "pwd." You can see that I am in home at the moment. So, print working directory
does exactly what the name itself says, it prints your current working directory. Next
up, we have our "cp" command, which we already used in order to copy VirtualBox guest additions
from one place to another. It's fairly simple. You type in "cp /path" -- Let's do a real
example. So, if I, for example, go ahead and type in "cp VBoxLinuxAdditions.run," and if
I want to copy it to somewhere, let's say that I wish to copy it to "/var/". I will
delete, of course, I will show you how to do that as well, but it's fairly simple. You
specify what you want to copy and where you want to copy it to. Keep in mind, you could
have actually typed in here a folder, a full path, to this VirtualBoxguestadditions.run.
You don't actually need to be in the home directory. This "-v" option gives us this.
It tells us what was copied where. It's a very useful option. Let me show you what would
happen if I didn't have that. Just like this, you see nothing. There is no output or anything
of the kind. This is this is fairly simple. When you have one very small file and you
don't really care, but when you will have a large file, let's say it's 20GB or so, you
are copying you'll just have a blank screen below. Nothing will be happening. You will
not be able to figure out whether the copying process is going on or if it has actually
crashed, bugged or something of a kind. Just pass the "-v" option which is always useful
to have simply because the machine actually tells you what it is doing. Now, you might've
noticed that all of these commands, more or less, have their own arguments, which can
be passed to them in order to modify what the command does. You can view a listing of
these arguments. You do not need to memorize them all. So, let's take an example of "cp
--help." This is a universal way of getting help on the subject within the terminal. You
type in the command, a space, then "--help," press enter and you get a listing of possibilities.
So, I know it looks a bit messy and a bit difficult to see, but you don't actually need
to look at all of these things here. Just scroll upwards and there you go. You can see
all the arguments. They are listed clearly here. You have the argument here, and an explanation
of what that argument does. For the time being, you're not going to be able to memorize all
of these. Over time, as you practice more, and start actually is using these commands,
you will be remembering more, and more, and more, and more, without actually wish it.
Basically it will be caching the information, so to say. Anyway, over here, in the upper
part of this help menu you got usage. In usage, you get the format or the syntax of the command.
So basically, "cp" option, and then you specify your source and destination. Very simple,
no problems there. This is universal for all of the commands, you can always use the help
menu. However, in addition to the help menu, you also have man pages. So if I type in man,
and I can use the command "pwd." The man pages on "pwd" give me a ton of information. You
can see it gives you the name. It's called synopsis here, but basically the syntax of
the command. You get a full description of what the command does, a full description
of the arguments, you even get the author who actually wrote, some notes, copyright
and some references to something else as well. This is a very short man page because "pwd"
is a very short, basic command. For example, if I was to type in, "man grep," you can see
that the man page is a lot bigger. I'm just scrolling down and it seems to go on. "Grep"
is a multipurpose command which I'll show to you in a moment. I just wanted to show
the difference between a basic and a more complex command. Let me just go ahead and
clear the screen. Next up, we have move so, "mv." That will cause a folder to move. This
is how you rename folders too, or files. So just go ahead and navigate over to "var,"
where I have actually copied this file. Excellent. If I type, "mv VBoxLinuxAdditions. I can move
to some different folder, under some different name, or I can just rename it within my current
folder. If I just type it in "RandomIsNotSoRandom." I'm just going to rename it to that. Say ".run." You can
put whatever extension you want. Of course, it won't function the same. I am just showing
you the way of renaming files. if I do "ls" again, you see, that VboxLinuxadditions.run
has been successfully renamed to RandomIsNotSoRandom.run. I can also do this. I can RandomIsNotSoRandom
to my home directory. If I do "ls," specify a path to my home directory and press enter,
you see that I've actually moved it here. Unlike the copy command, it doesn't retain
the original within wherever the source might have been. So, once you move it, it's gone
from the source folder, however, it's going to appear in the destination one. Also tricky
one: when you delete something with move, when you move something over something else,
it's so difficult to recover, if not impossible. Also, be very careful with deleting files
in Linux. Once you delete them from the terminal, you will not be able to recover them. There
are some complex procedures that might give you a fraction of what you wanted to recover.
If you remove it from the terminal. It's very, very, very difficult. It's not like Windows
or something. When you delete something in Windows, you can always recover. It's like
you basically didn't delete it. You just don't see it. But here, when you delete something
it's gone permanently. So take great caution, take care but don't be afraid. I mean, over
time, these things become second nature to you. You will take it into consideration without
even thinking about it. I'll go ahead and clear the screen. Next up, we have "cat."
Let's navigate home. Let's type "cat RandomIsNotSoRandom." You see what it does. It actually shows you--
this is a bit of a longer file-- all the contents of that file, whatever that might be. This
content is not pretty at all. You can't read it like this, but doesn't matter. Let's just
create another file. So, nano is my favorite text editor from the terminal. You will need
to learn how to use the terminal text editors because you don't want to be switching back
and forth between GUI text editors and working on something a terminal. It's extremely time-consuming.
Here on Kali Linux, you can actually edit things with root. However, if you are using
some other distribution or something of a kind, most of the GUI text editors will not
be able to run as root. You will get an error message. So that can be a bit problematic.
That's why you should always learn how to use text editors that are terminal text editors.
Just type in "nano" and type in the name of the file you wish to create. For example,
I'm just going to go ahead and type in "test." Since this is a test file no need to give
it any extensions or anything of the kind. There we go, we are in the nano text editor.
So here I can write some text, "Some random text goes here." You have a variety of options.
This carrot sign, "^X" simply means control-X. If you press control-x you are going to exit.
Control-O, write out, that's basically save. You don't need this. where is, is basically
how you search things. Hit control-V to search. Let's look for "random" press enter and there
you go. It's going to point to random. It found it, no problems. Previous page don't
need and the next page we are not going to be that engaged with it. So cut text is also
very nice. It allows you to actually remove large portions of text at a relatively fast
rate. So if I just say control-K, it's going to remove the current line where the cursor
is, not what you have selected with your mouse. Just so you know. Let me just bring that back.
I'm just going to go ahead and continue talking about this in part two, in the following tutorial.
Until then, I bid you farewell.