learn the basics of using linux josh
teaches this course for absolute
beginners and he will help you get a
full understanding of how the linux
operating system works hello everyone my
name is josh from keeping techie and
welcome to my introduction to linux
course the purpose of this course is to
help you get a full overview of what the
linux operating system is and how it is
used in everyday life
i noticed there was a need for a basic
course for people interested in getting
into the it feel
now linux is used in pretty much all
aspects of the field for example linux
is used in the cloud
it's also used in the cyber security
field
especially when you're looking at pin
testing
so i created this course so you can at
least get the basics of using the linux
operating system now a quick disclaimer
if you're looking for a more advanced
course
for let's say a linux certification then
this may have some information that can
help you but it will not cover all
the topics needed in order to pass a
certification exam
and just to give you an overview i will
only cover basic topics such as
installation basic configuration
terminal usage understanding the file
system
as well as software management
so please remember this course is
designed for people that are very new to
the linux operating system i have a
course that hasn't been fully completed
that will be released in the near future
which will cover all modules that are
needed for the comptia linux plus exam
so once that's uploaded you can easily
roll from this course into the next
course in order to take the comptia
linux plus exam now let's start off by
giving you a little bit about myself
i have been an i.t professional since
2007 i've worked in multiple positions
some of which a network administrator
systems administrator and i'm currently
working as a database administrator
and i've also been a linux user since
the year of 2008
so i have a lot of knowledge when it
comes to working with the linux
operating system now what is linux
when most people ask this question the
response that's given
is simply debian ubuntu red hat or maybe
arch linux
but these are what is called linux
distributions and linux is basically the
kernel of those linux distributions
combined with other software such as gnu
software and other pre-installed
software
now just to break down everything that's
combined to create a distribution we
have to look at some of the creators of
each separate port
and the first one i need to cover is
richard stallman
and in the 80s
many companies stored developing their
own
unix operating system for instance ibm
sun and hp they all had
different versions of the unix operating
system that they were developing
and the results was a mass of unix
dialects and a dozen different ways to
do the same thing and so this is where
richard stallman came in to end the era
of eunuch separation and prevent people
from reinventing the will by starting
the gnu project
and gnu simply means gnu is not unix and
his goal was to make an operating system
that was freely available to everyone
and where everyone could work together
and many of the command line tools that
are in modern day linux use the new
tools that was created under this
organization by richard stallman
and just to give you a little bit of
more about his background he's an
american free software movement activist
also a programmer that went to mit and
he also created the organization called
free software foundation and he's an
avid campaigner for software to be
distributed in a manner such that its
users receive the freedom to use study
distribute and modify that software
so now this rolls right into the
next question which is what is the linux
kernel
and the linux kernel is a free and open
source monolithic module multitasking
unix-like operating system kernel and
the kernel is simply a program that
talks directly to the hardware and
manages the resources and processes and
the meaning behind linux is
linux is not unix
and to cover the creator
lin the linux kernel was actually
created by a guy named linus torvalz
and after its creation it was soon
adopted as the kernel for the gnu
operating system and it became a free
replacement for unix and since that
combination of these two projects it has
spawned a large number of operating
system distributions and they're pretty
much all commonly
called linux now that we understand the
gnu project as well as the linux kernel
let's
go down and cover
a linux distribution now there are many
linux distributions
but simply put a linux distribution is a
complete linux system package
and many linux distributions are
available to me just about any computing
requirements
you could have and most distributions
are customized for a specific user group
such as a business user
multimedia enthusiasts software
developers
and your average home user and as you
can see on the screen this is four major
linux distributions that are out there
one is ubuntu
debian and then kali linux as well as
red hat and just to explain
each one of them
ubuntu and debian or one of
your basic desktop linux distributions
that you can use and we all know ubuntu
is the most popular distribution in the
world and i threw cali linux up there
because this is the most used
distribution when it comes to cyber
security as well as the hacker culture
and red hat covers the business side
because this distribution is not a
hundred percent free and the way they
charge as far as the model for red hat
is that businesses pay for the support
but as stated there are a whole bunch of
linux distributions that will meet most
of your needs
and now let's cover the course
distribution
which is the distribution i'll use
throughout this course which is ubuntu
and we know that it's debian based
and it is composed mostly of free and
open source software
and ubuntu
is released in three different editions
they have a desktop edition a server
edition and a core edition which is
typically used for internet of things
devices as well as robots
and all the editions can run on the
computer alone or in a virtual machine
which is why i chose ubuntu for this
course
because i want you guys to kind of
follow along
no matter the hardware that you are
working with
now let's go down and get started
now as i stated in the previous segment
we will be using ubuntu for the full
course
so i will now cover how to actually
download it and install the distribution
and i'm currently at
ubuntu.org this is the simplest way to
actually get the ubuntu distribution if
you hover up to the top where it says
downloads click the down arrow
that will get you the ubuntu desktop and
the current version right now is 20.04
and i always recommend people use the
lts
which stands for long-term support this
release has the longest support time
versus any of the others
now you can also install the ubuntu
server version but it doesn't have a
desktop environment
and like i said stated earlier there is
a ubuntu core
or ubuntu for iot
that you can actually download for
your mini boards like a raspberry pi
now in order to download it all you have
to do is click on the 20.04 and that
will start the download and it only
takes a couple minutes depending on your
internet speed but you want to go down
and download this and then i'll be back
once it's finished to go through the
install with you guys so now that we
have ubuntu downloaded i just wanted to
talk about the couple ways that you can
install ubuntu now there's the direct
way there's also
a way to install it in a virtual machine
as well as you can install it within the
cloud but most of the times people
install the server edition in the cloud
because they may want to set up a web
server or something to that effect now
you can install it directly
to your hard drive but i definitely
don't recommend you do this for this
course
unless you have a secondary computer
because
when you install it directly on your
system you have to make sure you have a
backup of all your files and since we're
just going through a course in a simple
introduction
i don't want people to go through this
and mess up their computer by not having
backups lose files and don't have a way
to recover them and then also when it
comes to a direct install you have to
write the iso to a usb or a cd which
will cause a little bit more confusion
than necessary just to go through and
follow and run a couple commands that
i'll teach you through this course
so the main way i want to show you guys
how to install ubuntu is by using an
application called virtualbox
now oracle virtualbox is a type 2
hypervisor and also virtual device can
be installed
on all three major platforms microsoft
windows mac os and linux
and then also when you use virtualbox
you have the opportunity to try the
operating system before you actually
commit to installing it directly on your
hardware
and then also
one thing about virtualbox you have to
have
newer hardware because the newer the
hardware you have the more likely that
virtualization is supported through your
processor and since this is 2022 i know
a lot of people are using newer laptops
and virtualization is turned on by
default
and i wanted to make sure i open this up
to as many people as possible so they
can go through the training successfully
now let's hop over to my desktop so we
can walk through installing ubuntu
within virtualbox
okay so our iso is downloaded and i have
it stored in a folder but this is what i
actually downloaded right here which is
what you will receive when you hit the
download button from ubuntu so you want
to make sure you find that
location so you can create the virtual
machine now this is virtualbox manager
and it's a very simple application to
use it looks and feels the exact same
way on all different platforms so
windows mac os
as well as linux it looks pretty much
the same
and most likely when you first open this
application there won't be anything
there and i currently have some virtual
machines already here that's why they're
listed
now in order to create our virtual
machine all you have to do is hit new so
we can hit new and then what you want to
do is name the operating system now i
know this is a ubuntu system so i'm
gonna just put ubuntu as the name and
you can also put the version number
sometimes i put 20.04 at the end of it
and i'll do that for the the purposes of
this video so you guys can follow along
with it
now you want to select the type
now it'll automatically kind of
recognize based on whatever you type up
here and it automatically pulled up
ubuntu
down here as well as the type which is
linux and if we click under here i just
want to show you guys the different
options but you have microsoft windows
solaris bsd
ibm mac os x and other
and what you want to do is make sure it
selects linux most of the time like i
said when you type in
the operating system it'll automatically
update here
with the right information and you want
to 64-bit as you can see when you click
under type it'll open
and expand the different versions and
what you want to do is make sure it's
when you've gone to 64 bits
and so we're good there we can hit next
and now this is your memory size now
this is all dependent on the extra
resources that you have on your system
now my laptop has
16 gigabytes of memory so i have some to
spare
and for this demonstration i'll just
select eight since i have the resources
to spare
but you may want to select like four or
six
when it comes to this depending on how
much memory you have on the system
now ubuntu can actually run with less
memory depending on the desktop
environment
like for instance if you're using the
xfce version of ubuntu then you can
probably get away with two gigabytes of
memory but i always recommend for people
starting out just give it four gigabytes
of memory
and you'll be good to go
so let's hit next there now
we have to select our hard drive and
this is just a way to select if you
already have a hard drive created and
what this is is a virtual hard drive it
doesn't really exist it's kind of like a
container so to speak and i'm only using
that as an example it's not the actual
application that runs containers like
docker but it's essentially a
containerized file
that's virtual that's used by the
virtual machine where all your files
will be stored and it's looked at by the
operating system as a real hard drive
but it's actually not it's just created
by virtualbox itself so what you want to
verify is that you want to create a
virtual
disk now so you can hit create there
and there are different types of hard
disks within this application there's
the vdi which is a virtualbox this image
vhd which is virtual hard disk and vmdk
which is a virtual machine disk
and i know that's kind of confusing but
some of these is basically the format of
the type of virtualized hard disk that
will be used
for this operating system
and the main thing that needs to be
explained the difference is there are
other types of hypervisors out there
that use a different format for for
instance i believe vhd
is the one used by
vmware
but we're not going to worry about that
we'll just use the virtual box this
image for this demonstration so let's
hit next there
now this is an important step that i
always try to tell people when i'm
teaching them how to use virtualbox
there are two different ways
of storing the data within the hard disk
there is dynamically allocated and a
fixed size
now dynamically allocated means that the
the hard drive will only be as big as
the actual
files and as you add more and more files
to it it will grow now with a fixed size
if you select a hard drive of 10
gigabytes then it will take up 10
gigabytes of space on your system so i
always tell people to use dynamically
allocated that way it'll grow as you
need it it won't take up take away from
the resources from your main machine
so let's hit next there and as you can
see it will store the virtual machine in
a location i won't go too deep into that
but that's basically where the virtual
machine is stored or the hard drive
itself and then also the size you can
set the size as 10 gigs or you can go
even higher depending on how many how
much resources you have in your system
for instance i have a two terabyte hard
drive within my laptop where this is
located so that's why it's showing two
terabytes but you can't use the full two
terabytes because like i said this is
running on
a operating system that's already
installed
so if you don't have two terabytes
which i'm sure i don't because of all
the
files and folders
and applications that i have installed
on this system
i definitely don't have that space to
give to this virtual machine now you
don't have to really worry about it if
you select it dynamically allocated
because it will only grow to the size
that it needs for the operating system
and whatever files that you put on the
virtual machine
but i always recommend people use like
10 gigabytes for
just a
install that you're doing for testing
purposes
but let's go down and hit create and
that will
conclude the setup and that was
basically the
initial configuration of the virtual
machine we have to go into the settings
and make a few more changes before we
actually
launch the virtual machine
so let's hit settings
and you want to make sure
that that virtual machine is selected
that way it'll open up the settings for
that virtual machine
and we don't have to mess with anything
under general but i'll go through and
show you at least the tabs now there is
a shared clipboard drive and drag and
drop you could turn that on which i
won't need that for this demonstration
uh you can write a description in there
and then they also allow you to create
this encryption if you want to
i recommend you don't do that especially
if you don't have
especially if this
virtual machine is just temporary and
you're probably going to delete it in
the future now if we go to the next tab
that's the system you can
make changes to how you set up the
virtual motherboard for instance that's
the base memory and like i said i gave
it eight gigabytes of memory but you can
select it whatever you can make changes
there if you need to and then also it
has a virtualized boot order so you know
like when you boot up a physical
computer
it'll pop up with hitting either like
f12 or f9
to select a different boot order or
select something
to boot first within the order
from the bios then you can make those
changes here as well
and then some chipset information
uh you can enable efi
for special you know os's if you need it
i don't recommend you
select it you just use the default now
under processing you can give your
virtual machine more processors which
i'll bump mine up to two now i have a
whole bunch of cores on my system
because i'm using a ryzen on my laptop
so you select what's best for you but
two cores is just enough for what i'm
trying to do
with this virtual machine as far as just
showing you guys how it all works
and then there is an acceleration tab
which we will leave default now under
display what i typically do is bump up
the video memory
to 128 and then
enable 3d acceleration
and then there are some other tabs in
here remote display and recording if you
need to
um and then storage
this is where you want to add your iso
so right now it's a virtualized ide
controller which is the cd drive and all
you have to do is and select over here
where the little dish is
and you can find the iso by clicking
choose a disk file
and then all you have to do is go on
your system now
and find that iso that we downloaded
from
ubuntu a few seconds ago
and once you find that iso you just
select it and that will actually add it
to the virtualized cd drive
and then as you can see right here this
is the hard drive that we created the 10
gigabyte hard drive
and that is where the operating system
will be installed but this is needed in
order to boot up the operating system in
order to install it and i just wanted to
explain that for people that are very
very new
so you can understand exactly what we're
doing and this is similar to
installing it on physical hardware
meaning that this iso would typically be
written to a cd or a usb drive and
you're basically plugging it in
to your hard drive and then your hard
drive is booting this cd
and then writing to your physical hard
drive that's within your laptop
now the rest of these options i won't go
through uh but especially the audio
network settings now one thing you can
actually change right here
which i didn't think about talking about
but they do have different types of
networks you could set up like net
which it'll basically use your ip
address for this machine
and then they have bridge adapter
internal network uh host only which i'll
just leave it on that so we can have
internet
for this virtual machine
and then also serial ports usb ports
which i kind of leave most of this stuff
off or i turn it off but you could just
leave it the defaults now let's go down
and press ok and that's pretty much
saved our settings for the virtual
machine and we can basically boot it up
and store the install so it's two ways
to actually start it you can double
click on the actual virtual machine or
you get this down arrow or you can just
hit start but they do have options under
here they have a normal store they have
a headless store and a detached stort
and what you want to use is the normal
store or just double click on the
virtual machine and it'll start it up
and as you can see it's popping up it
has our boot you know order it
automatically recognize the cd drive
that we had
in the actual system
and then
one thing with ubuntu it'll go through
and check your files before it opens up
the installer
now one thing that ubuntu will do it'll
pop up with a installer right away as
soon as it boots into the operating
system and there are two options first
thing you want to do is select your
language so if you're in a different
country you can select whatever language
that applies to you but since i'm in the
us i'ma select us or english
but the two options are you can try
ubuntu or you can install ubuntu and
which is what we want to do
we're going to install ubuntu but you
can actually try
the operating system
before you actually do the install and
this is beneficial if you're installing
directly on your hardware
because every now and then you'll run
into a system
that is not a hundred percent supported
but this is very rare but i try to tell
people to use the try ubuntu first that
way it'll verify that your system
will actually run the ubuntu operating
system
without any issues
and it basically boots up the system as
if it's on installed on
the actual computer
with all the applications and everything
you want to do
in order to use the operating system you
can get on the internet you can play
around with files you can do pretty much
anything you can do
if it was physically installed
on your hardware
now the only thing is if you download
files or in install something or
whatever it's gonna reset
if you reboot the system so i won't save
anything which that's basically called
persistence
now let's go through the installer by
just hitting install ubuntu which is
what i want you guys to do if you're
going through this course
now the first thing that will pop up is
the keyboard lay by layout so you select
whatever keyboard layout
applies to you but since i'm in the us
uh english us and in english us over
here and then you can also test the
keyboard just to make sure
that all the keys line up and all that
stuff so let's hit continue
and so it says right here what apps
would you like to install to start up
you could do the normal installation now
they do have a minimal installation
it'll come with a web browser and basic
utilities but i'll install the normal
version so you can see all the software
that's on it and then the updates right
here it'll download updates while
installing ubuntu because these packages
or isos that are created are not always
up to date like they'll update the iso
let's say once a month or
a couple months depending on the
developers of the actual distribution so
sometimes you'll download an iso and
it's a couple weeks behind the update so
this will verify that you have a
up-to-date machine as soon as you boot
up the operating system and the
installation is complete so i'll just
hit continue there i'm gonna just leave
the defaults
now this is a very important step this
is where you want to install
the operating system meaning the hard
drive and one thing it says right there
warning this will delete all your
programs documents folders photos music
and any other files
on any other operating system that's on
the hard drive so
if you're installing this on physical
hardware you want to make sure you have
backups of all your files because when
you run through this installation and
you get to this step this lets you know
that it's going to erase the hard drive
and you will lose everything on the
system we don't have to worry about that
because
we elected to install it all on
virtualbox so this is an empty hard
drive or virtual hard disk
with nothing on it so we don't have to
worry about it but they do have options
for you to set up the hard drive
in your own configuration which i won't
go through that's pretty much advanced
uh
if you're just installing this to follow
along with the class
then i recommend you select just erase
this and install ubuntu
and we can just click install now and
it'll go through the install
and i actually forgot about this next
step the next step is going to ask you
where you're located uh i'm on the west
coast so i select los angeles which is
super cool and then also you have to
select and create a user account and
this is something
that most linux distributions want you
to do they want you to create
a user account and not use the root
account which i'll talk about
later on in the course
and i'll change the computer name to
ubuntu
20
and then what you want to do is select a
password or create a password
and so i'll throw that in there
and just to throw you guys a little bit
more information
uh one thing they do have two options
when it comes to logging in you can log
in automatically or you can require a
password to log in which i always
recommend people use a password
and then with ubuntu they also have it
to where you can connect to active
directory so if you understand
uh windows in active directory you can
add the system to
active directory which is a little bit
outside of it the scope of this course
so let's move on
hit continue
and like i said it's going through the
install
and it actually doesn't take too long
but i'll be back when it actually
complete completes
and so since the installation is
complete this will pop up for you
basically say installation complete you
need to restore the computer in order to
use the new installation so all you have
to do is hit restart
and this concludes the installation
portion of
ubuntu for the course
okay so our installation is complete and
this is the desktop that you'll see when
you log into your ubuntu 20.04
now i won't spend too much time on the
desktop environment i'll just basically
do an overview of how to actually use
the linux desktop and then we'll dive
into the terminal
which is where all the magic happens
when it comes to the linux operating
system so let's start off by giving you
guys a overview of how the desktop works
and how to use it
and if you're coming from windows or mac
os
then this shouldn't be too difficult for
you to pick up on
as you can see it has a main bar at the
top which has audio tasks and
hardware hardware changes like for
instance uh
the sound settings right here right here
is the log out button or shutdown button
so you can click there and that'll bring
that up and you can shut down the system
you can also modify your
internet connection
you know the simple things that you
would see in a windows taskbar or the
taskbar on a mac os system
and then right here in the center you'll
see you have the date and time and if
you click on it there is a calendar
and then also you'll receive
notifications here
which is super cool to see
now if we go over here to the left on
this actual taskbar you'll see where it
says activities you can click there and
that'll actually open up any processes
that are going on on the system or
applications that may be running and
minimized on the system like currently
i'm running some updates on this
installation and i'll get into that
later how to actually do updates on the
system
using the graphical user interface
if we click on that that'll hide it back
where it was and as you can see on the
desktop you have folders so this is the
home directory which is what they call
it on a linux system the home directory
this is where all your files and folders
are stored
and i wanted to cover this so you guys
can at least see
that the files that we are going to
create and manipulate using the terminal
once we get to that point
can be modified using the gui as well
and it looks different you know i'm
saying it's different from your windows
operating system as well as the mac os
operating system is different but the
concept is pretty much the same uh you
can double click on folders and now open
them up you there have they have a back
button so you can go back
and you can navigate throughout the file
system as needed now let me go down and
close this because i want to show you
guys they do have a trash can so if you
delete something it'll throw it in the
trash can and that opened up our file
explorer again
which is another way to actually get to
it so let's go ahead and close that
again
by default you have a lot of software
installed especially on this version of
ubuntu when we went through the install
it installed pretty much the default
software that anyone would need or what
they think anyone will need
to use the operating system to its full
potential and just to cover some of it
if we go on the left hand side you'll
see this taskbar on the left hand side
this shows you your favorite
software that's on there and as you can
see we have firefox so our web browser
uh thunderbird is a male client similar
to microsoft outlook you also that's the
same file explorer like when we click on
josh that'll open up the file explorer
and i'll open it up again just so you
guys can see
this is a music player and like i said i
don't want to go through all the
software i just kind of want to show you
what's there by default so you can
understand
that pretty much everything on this
system is installed to make the
transition from one of these other
operating systems a whole lot easier and
like i stated this is a music player
then we have
uh this is similar to microsoft word
now one thing i want to show you guys
was the software center so i'll go down
and open that up but this is how you get
other software
and just so you guys can get a full
understanding linux doesn't have the
typical software that you would install
on a windows operating system or mac os
it has its own repositories or locations
where
certain free and open source software is
located so you can install it and use it
on the operating system and a lot of
these applications are made to be a one
co one to one comparison
with software that you would see on
other operating systems like earlier
what i was talking about this is
equivalent to microsoft word well you
can actually write documents just like
microsoft word you can even store the
files in the microsoft word format so
you can jump back and forth with a
particular file and you can easily
modify it on your windows system if you
want to so i just kind of want to cover
that but as you can see this is the
software you can look at the explorer
they have the editors pick so you can go
through play around and install some of
the software uh there are different
categories so you can go through and
look at all this different software and
then also you can check out what's
actually installed on the system
and this right here is
makes it very simple for new users to
linux to actually transition over
because it's not that difficult to
install because once you find something
under the explorer list let's say you
want to install
signal or
all you have to do is open up the
actual application or click on it and
then there's the install button and
it'll install it on your system so let's
go back and i just want to show you guys
this is where you update your system as
well but i'll show you the
proper linux way of updating things once
we get to the command line portion but i
at least wanted you guys to see it here
but this is where you can update all
your applications
that are installed on the system now
let's go down and close that because i
want to show you guys they do have a
help guide so if you need help with
while using this operating system that
will open up the how to guide basically
goes through the overview of using the
system and i really want to show you
guys this
because i know a lot of people that are
taking this course or new to the linux
operating system this is a great place
to get help
and that's why i use ubuntu because the
community all the documentation and
pretty much everything is
is out there
for you to use so you can
fully understand how to use the desktop
environment as well as linux in general
now let's go down close that but like i
said this is the software updater that
actually popped up and it's telling me
to restart now but i'm not going to
restore it at the moment let's minimize
this because i want to show you guys a
few other things and right here this is
basically
the installation iso i kind of left it
on this system
but most of the time you want to remove
it or you want to remove it from the
actual system if you're doing a physical
install if you did it on you using a usb
drive or a cd drive you want to remove
that cd or remove the usb drive from the
computer that way you'll you can verify
that it's booting from the hard drive
especially if you made changes within
the bios
as far as the boot order so it won't
keep looping and going back into the
installer versus booting from the hard
drive
now i want to show you guys how to
actually get to all the software
that's installed on the system as you
can see this is just basically what's
open
as well as the favorite software
but if you click here under show
applications it'll pop up with a screen
and this looks fairly similar to people
that use android phones you know how you
swipe up and that'll bring up all your
applications that's ex exactly what this
looks like
but this is for a full blown system and
not a phone
but you can access all your software
from here uh i won't go through them all
i just kind of wanted to show you that's
how you actually get to it if you need
to use any of the software on the system
and one area i want to show you guys
before we move on to the next section is
the settings now this is where you want
to go if you need to make changes to
this system
in general pretty much all your settings
are in this one location
like you have your network settings
bluetooth settings if you have a
bluetooth bluetooth hardware on your
system
uh the background you can change the
appearance notifications uh applications
you can set your default applications in
here uh privacy settings so you're not
being tracked by any type of software or
the operating system itself you can also
log into online accounts if you want to
for instance they have a way to connect
to your google account
that way your email and all that stuff
will be connected directly to your
google account which is
which is very beneficial and then also
sharing you can set up like share drives
they also have sound power settings
display settings and like i said any
type of settings that you could think of
or under here
if you have a printer at home that you
want to set up to it you can install
your print drivers under here
as you can see
ubuntu is real good with this it picks
up
the printers on your network i have a
brother's printer as well as a hp
desktop jet printer that's on my network
currently and it already picked those up
and added them to the actual desktop and
then also
this is something i was going to get to
within the command line but i wanted to
show you that you could do a lot of this
stuff that i'm gonna do in the command
line from the gui but
as i stated the power of linux is within
the command line but you can modify user
accounts as well which is super cool to
actually have access to
from a gui
now let's go down and close this
and this will conclude the portion of
the basic understanding of how to use a
linux desktop environment now a quick
note depending on what distribution you
use the desktop environment may look
totally different from what i'm showing
you here but if you're following along
with this course and you install ubuntu
your desktop environment should look
similar to what mine is showing here but
i just want to at least let you guys
know that in the future once you start
playing around with other distributions
the desktop environment may look a
little different certain things may in
different may be in different places but
the overall concepts are pretty much the
same and that's why it's important for
you guys to understand how to use the
terminal because a lot of the tools and
a lot of the
software that you use within the
terminal is used across all linux
distributions
so let's hop over to the next section
and now we'll be covering how to
actually use the terminal and the first
thing i want to do is just basically
show some of the configurations for the
terminal once we get it up open and
basically what is called the terminal
emulator and you could just search for
it under your applications you'll see it
pop up you can actually just search up
here to top type terminal and that'll
bring up the actual terminal emulator
and as you can see
it should kind of remind you of those
old
hacker movies where someone is just
typing at the terminal that's
essentially what this is it's just the
terminal emulator so application that
affords you to interact with the os
using commands
and one of the first things that will
pop up which you can kind of ignore but
it talks about
pseudo and i'll cover that a little bit
later on in the demonstration where that
actual application can help you while
running certain commands
now before we type anything i just
wanted to show you guys some of the
configurations that you have for the
terminal emulator and this is similar to
any application i can show you the
settings the
how to make it look a little different
you know using the options that are in
it so if you click right here this will
open up the menu and you can just click
preferences down here and this will open
up all your preferences for the terminal
emulator as you can see they have a help
button up here that'll open up some
information about
how to actually use it but i'll walk you
guys through it
this is the generals tab and this has
just basic information on the looks of
it like there's a theme you could change
the theme to dork
you can open new terminals in a new
window or you can open it as a tab which
is beneficial especially if you're
working with different
systems because you can connect to other
linux operating systems via the terminal
and you can tab back and forth using
those tabs so it's super cool but if you
have tabs enabled up here this is kind
of where it'll it'll help you if you
have tabs turned on right here so
anytime you open up a new terminal it'll
open up as a tab and you can specify the
position that you want it to pop up in
once it opens up so last and then next
is the
the other option now next thing on here
i want to show you guys these shortcuts
this is something
that i think you should definitely check
out i'm not going to go through all
these shortcuts but there are plenty of
shortcuts to
help you while using the terminal and
then also you have a profile and
currently right now this is the profile
uh for us it's unnamed you can actually
go in and name it if you want to i'm not
gonna name it i'm gonna just leave it
the way it is
but this profile is tied to your user
account so if you log out log back in
whatever you set
within this profile tab
of unnamed will
stay the same each and every time you
log into the system but as you can see
you have a whole bunch of options here
this is how you modify the terminal to
make it look a little different uh there
are some text appearance uh you can set
fonts
you can set the spacing
as far as the
cursor that you see that's blinking
right here
uh you can modify that by making changes
you could change it from block to a
i-beam and i'll just go down and do it
so you guys can see it should change it
yeah as you can see the i-beam is just a
line
uh you can also you know change it to an
underline like an underscore pretty much
and it blinks and then you can also
change that to where it doesn't blink i
like the blocks
i'll leave that as default but you can
turn it off where it doesn't blink like
it's blinking right now should be
blinking right now yeah and then right
here they do have sounds for the
terminal i don't i never really mess
with any of this stuff
i may change the colors which is some of
which is on the next tab
and under here you have built-in themes
so you can modify this if you want to
currently it's set to use the system
theme but you can easily modify that by
unchecking this box and you can modify
it using a theme that's already there
or you can create your own custom theme
by selecting different colors
like there's attack text color
background color
bold color cursor
colors and highlight colors and then
also they have it where you can set
transparency on the background which is
super cool i like that
and currently it's set to use the
transparency from the system theme so
a lot of people just use the default
which is no problem with it but once you
start getting good and familiar with
using the terminal and different
applications and linux in general then
you can start customizing and modifying
the system as you see fit but there are
down below a lot of color palettes so
you can go through and select whatever
you want and make the terminal look
however you want it now as far as
scrolling a lot of times i leave this as
default but this is basically if you're
running a whole bunch of uh commands or
something and you want to see what
actually happened the screen will scroll
down as you're running commands
especially if it's a command that looks
at let's say a lot of files or something
then it's just going to scroll past
everything and if there's an error
then you may want to scroll up and look
at it so i leave that as default but you
can scroll back and forth up and down
throughout all the commands that you've
ran as well as the results that come
through from the command that you
actually ran
now
under here there are commands so you can
run a specific command on login and
custom commands if you want to
and then also preserve working directory
for the shell only that's that's just
another option right there
and then when command exit exit the
terminal you get you can set that up
um i don't recommend you do that
just leave the defaults you should be
fine
and then also un under compatibility
there are some changes there but we
won't mess with that with that at all
now let's go and close the preferences
and one thing i want us to do is
actually
zoom in so you guys can see a little bit
better
because it's it's difficult to see
things within the terminal
unless you make it a little big
especially while recording
as you guys know i'm recording this in a
virtual machine so it's kind of
difficult to record where you guys can
see everything without blowing it up so
hopefully you guys can see this
but this is what you'll be greeted with
when you first open up the terminal
and it's only showing this right here
because this is our first time running
it on this system all together
and just to break things down
the first thing that will show up is
your user account so we know that when
we install this operating system i set
up a user account as josh which is my
name so it'll show whatever your name is
or whatever you set
during the installation and then there's
a at symbol so it's similar to an email
address look at it that way you have the
at symbol
and then after that is the system name
so this is what we actually named the
operating system when we went through
the install
and then after this colon
that basically explains or shows you
where you are
that's what this tilde is for and
currently we are in the home directory
and then after this this is where you
actually type the command so
you can just type right in there and
that's where you actually run your
commands
and the first command that i'm finished
show you is the most important command
that you will learn using the terminal
and that command is man
and man basically stands for manual and
this is something that you will i will
use
with every command that i show you guys
that we run within the terminal
man
basically gives you information about
whatever command you're trying to run
within
the linux terminal
and let me give you an example the first
example i will show you of a command and
showing you the manual is man
space
man
now that is the manual for the man
command so essentially whenever you run
the man command
whatever you're looking for or whatever
manual you're looking for you have to
put that command behind it so there are
other commands like cd you can put cd
behind man and that will open up the
manual for
the cd command but like i said we want
to look at the manual for the man
command so it's man
space man and press enter and you'll see
it'll pop up with the actual man
the manual for
man
as you can see right here just kind of
break it down this shows you the actual
command then it says manual page utility
for the utility man
and then it gives you a name a synopsis
basically how to use the command and a
description of everything about that
command and it does the exact same thing
for most of the other commands within
the linux operating system and let's
just read the name right fast so man and
interface
to the system reference manuals now at
the end of the day there's basically a
small database running on the system
that hosts all the manuals for all the
different commands
and you can use the man command to pull
up those manuals
and they'll show up in the terminal just
like this and in order to navigate all
you have to do is use your up and down
arrows and that'll move up and down
throughout the terminal of the manual
and as i was saying there is a synopsis
so it kind of shows you some of the
options
because a lot of commands they also have
options
that allows you to modify the results of
the commands
so
just to break down the first one it says
man option
section page etc so you can modify the
result results that'll come out while
running that actual command
and then this breaks down the
description
and like i said this is in every manual
for every command
that's on the operating system and the
information here is very beneficial uh
when you're first learning how to use
this
and in certain cases there are examples
of how to actually use the command so
you can check these out they explain
what they're actually doing while using
the option
and you can test some of these examples
as well
by running them on your own
and the way you get out of these manuals
is simply
by looking at the bottom where it says
press h for help or q for quit so all
you have to do is hit the q button and
that will actually
exit you out of that command
so congratulations that's the first
command you have ran within the linux
terminal and as you can see it's super
simple
but i want to highlight again man is
very important especially when you're
first starting out using the linux
terminal because there's no way in the
world that you can remember all these
different commands and how to use every
single option within it so if you're
trying to figure something out using a
command that you've never touched before
or a command that you haven't touched in
a long time then the man command is
definitely beneficial now that you guys
have a full understanding of the man
command now i want to show you guys how
to actually work with directories within
the shell
now i showed you guys earlier that you
can navigate the shell
by simply opening up the file explorer
and going through and just looking you
know at your documents or your different
folders that you have where well there
is a way to do this within the terminal
and i'll show you guys a couple commands
that can help you
work within different directories
and the first command i want to show you
guys is the pwd command so we're going
to use that man command again and i'll
use that for every command that i run so
you guys can actually see that the man
command
does help you
while understanding commands so let's
type man
and then pwd and press enter and that'll
open up the manual for pwd and as you
can see the name of it is
pwd and print name of current working
directory
and this is an important command because
when you're navigating through files and
folders on the linux operating system
you can easily lose track of the
location that you're at and this command
is important because it'll allow you to
just simply write this command
and it'll show you the location that you
add
now let's press q for quit and let's go
down and run this command now and let's
type pwd and this is actually running
the command and we can press enter and
that'll show you the working directory
and remember when i brought up the tilde
represents the home directory well
everybody's home directory or all users
on the operating system will have a
folder
under the home directory which is just a
folder
on the file system and it'll be named
after your username
so let's click here under files and i
want to show you guys the location of
this
so
you can see
a gui representation of it as well
so
in front of it looks like i have to go
under other locations and that'll bring
up computer uh and that's basically what
i want to show you guys so we click on
computer this is the root directory
which is the represented by
the forward slash right there and then
what we're looking for is the home
directory so that's that home directory
and then the josh directory so that's
essentially the same location as the
home location right here you just don't
see it they kind of hide it from you
but it is there and that's one of the
powers of using the terminal you can see
the exact location where you are and
this goes into absolute path versus
relative path which i'll give you a
quick overview of what that is
and the absolute path is the full
location to
a file or folder or directory so home
and josh
and then a relative path
is an assumed path
which i'll cover a little bit more once
we get to the cd command which is the
next one
now let's open up the cd
man page so all we have to do is type
man
and then cd
and basically cd stands for change
directory and as you can see certain
commands don't have a manual
especially if it's a very old command
and i wanted to do this on purpose so
you guys can see
that some commands you may run into
won't have a manual but majority of them
do
when it comes to the cd command is so
old and it's been around forever
that they assume that most people know
understand what it actually means but
the cd command is simply a way to change
directory that's what cd stands for
and just to show you a quick example of
how to use the cd command we can just
type cd
and then let's say we want to go to this
home directory we just want to go to
that home directory and this is what i
was saying about relative path versus
absolute path
but let's type home
and we can press enter and that will
take us to that directory uh and as you
can see right there
the tilde is gone and now it's showing
the actual location where you're located
and the tilde was simply just a
representation of home and josh
now this gives me the opportunity to
show you guys a relative path which
basically means that the system
understands where you are which is the
home directory right now
or the home folder
and a relative path would be to change
directories to the josh folder within
home
and so if we press enter there that'll
get us back to our home directory and
just to add a little more one thing
about linux you could do things a number
of different ways so there's not
one way to actually do certain things
because that took us back to our home
directory
and if we go back to the home folder
by typing the path
home
and press enter
we can also simply type cd
and that will take us to our home
directory as well
because by default it will
take you back to your home directory no
matter where you are it'll take you back
to home josh
or whatever your user name is
now the next command i want to show you
guys is the ls command so let's type man
and then ls press enter
and that will give you the details of
this actual command or the manual it
says list directory contents and then it
also gives you
the synopsis on how to actually run it
as well as the options
and let's hit the q button just to get
out of that and i downloaded some files
for us to play around with with this
command and they're located in another
directory so we have to use that cd
command like we just used but we just
need to type cd
and then the folder that it's in is
under the documents
folder
and there's a folder underneath it
called ansible saw all we have to do is
type ansible
examples and press enter and that'll
change us
our current location is within
that ansible directory now let's play
around with the ls command so all we
have to do is type ls
and press enter and that will list out
the contents of the current working
directory
so that's essentially how the ls command
works as you can see you can see all the
folders that are underneath it as well
as the files that are underneath it
and if we go back to
our explorer
and we click in here under documents
you'll see that ansible examples folder
and you'll see the exact same
information that was listed out within
the terminal now this will be a good
example
to show you guys one of the options that
you can run with the ls command and this
will kind of show you how powerful the
ls command is
now within this directory there is a
readme.md
and linux
has hidden files and folders just like
in the windows operating system as well
as mac os
but in order to make something hidden
linux uses a different designator for
hidden files which is a period so any
file or folder that has a period within
within the front of it
lets the linux operating system know
that this file is a hidden file and so
don't show it unless you have it
set to where it shows hidden files
and it's readme.md what i'm gonna do is
just change it by going under rename
and put a period in front of it and that
will actually hide that file so we can
hit rename as you can see it disappeared
so that file is hidden now but if we go
back to the terminal
and we type ls
we'll see that that file has disappeared
as well there
well a good example of how to use an
option with the ls command or any
commands in general and that's why it's
important to understand how to look at
those man pages is that there's a way to
show hidden files while using the ls
command so we can just type ls
and then i know the option off the top
my head but it's simply dash a
for all so that'll basically show you
all the files whether they're hidden or
not hidden so let's press enter
boom and as you can see it will show
that that hidden file and by default
when i downloaded this github directory
they already had hidden files within it
but i just wanted to show you guys how
to hide something as well as how to see
all the hidden files if you want to see
it
now there's another option i want to
show you guys that you can run using the
ls command and one thing i want to do is
clear the actual screen and basically
all this is doing is moving up moving up
all this information so we're starting
and it looks like it's a fresh terminal
by typing the command clear
as you can see it just basically moved
everything up
now let me run the ls command again
just so you guys can see an example of
what it shows when you run the ls
command with no options but i also
wanted to show you another option which
is l so if we type ls
and then dash l
that stands for long or it's a long view
and it puts it almost in a table so you
can see a whole bunch of information
associated with the specific files
because right now all you see is just
the files in general
but you don't have any other information
beside that besides just the name of the
folder so if we press enter
boom that will give us a lot more
information as you can see it's broken
out in a format that you will start to
recognize and understand and this goes
into the permissions portion that i'll
show you guys later on in the course but
as you can see it gives you a whole lot
more information about these folders
and it also shows you when they was
actually created and also like the owner
and the group of the actual files
so this lets you know that josh
the user owns these folders and files
now one thing i want to show you guys as
well and we're gonna use that l option
again but you can also run options
together so let's type ls
and then dash l
and the a option and we don't have to
put two dashes
we could just put them together and the
system will understand it and press
enter and that will run it with the all
and that will bring in our hidden files
and folders so as you can see that git
ignore
file is there as well as the readme dot
md file is there as well
now let me show you one more option that
you can actually add to this
and that is the h option which puts
things in a human readable format and if
we look at the man page which i'm not
going to open up again but the h option
is there you'll see it but one thing
we're going to run is ls
and then dash l
and then the a option for all
and then the h option and just to kind
of explain it before i run it as you can
see all these files and folders are in a
bytes format that's the actual size of
the files right there in this column
right here in the middle
that is the size of the files and
folders now most folders are represented
by 4k
that's typically the size of a folder no
matter how big something is in it it'll
show as 4k
but this is in the smallest format so if
let's say we're looking at a file
that's a gigabyte in size
well if you run it without the h it'll
have the
the size in bytes
and it'll be hard to kind of figure out
what it is so let's press enter and that
way i can show you the difference so as
you can see it's in 4.0 k it basically
puts it in the
the size to make it human readable as
you can see this file is 31 bytes and
the readme dot md is 121 bytes
now let's go down and clear the screen
again and press the cd button that'll
get us back to our home directory and we
can clear again right fast just to get
it back up to the top and the next
command i want to show you guys is the
mkdi mkdir which is stands for make
directory now let's go to that man page
for that by typing man
mkdir
and press enter and that'll open up that
manual for us and as you can see it
basically stands for make directories
and then there's a whole bunch of
options you can go through and check
this out at your leisure
but let's go through and show you guys
how to actually use it so let's press q
to get us back to the terminal and let's
go to our documents folder by using that
cd command we just learned and then type
in the documents
folder
and press enter and as you can see now
we're in that documents folder and if we
ls using that ls command we just learned
we could press enter and we can see that
we only have one folder within this
directory in the documents directory so
let's say we wanted to make another
folder within this directory without
using the gui
well you can use the make directory
command so let's type mkdir
and then you want to put the name of the
directory that you want to create so i'm
just created test a
test directory
and press enter and that'll create that
directory for us
and majority of the times when you run a
command
within the terminal no output is a good
thing that lets you know
that the command ran successfully now if
something happened
then it would have given us a error
and just to give you a quick example of
that if we run that same command again
to make the same directory name
so test with a capital t press enter
you'll see it'll give you an error
basically saying it cannot create
directory test
file exists so that means that folder is
there now
let's use the ls command again so we can
see that that folder has been created in
that location so if we type ls
press enter that'll show you all the
folders that are in that directory and
you should see that the test directory
is there
so now let's say we wanted to create a
folder underneath it well the easiest
way to actually do it is by typing cd
and we can go into that test directory
and make another folder so
and let's type
mkdir
and then type test2
and press enter and it'll create us a
folder underneath that directory so if
we type ls
boom under that director you'll see that
there is that folder of test two
now that kind of took a little bit
longer and like i said in the linux
terminal terminal there are multiple
ways of scanning a cap i could have made
both of those directories at one time
and i'll show you guys that by using a
option with the make directory and what
i'm gonna do is
cd from that directory and what i want
to do is go back to the
documents folder
which is where we were where we created
the first directory and let's ls again
so we can verify where we are
or we can also type in that print
working directory which i won't
print it out because we know what
directory in
by what's listed here the tilde which is
our home directory and then the
documents directory
now let's make a parent folder and a
child folder by using an option
with the make directory command
and all we have to do is type mk
dir and then the option which is dash p
and now we can specify a parent in a
child directory and you can go as deep
as you want when it comes to creating
the folders for a full directory tree so
the folder i want to create i'll just
create uh
linux folder
linux
and then in order to create a folder
underneath that folder we just have to
put the forward slash
and then let's type ubuntu
and then let's say we wanted to create
another folder underneath that just to
take it to another level we could type
josh in there
and press enter
and it will create that full directory
tree so if we ls within this directory
under documents where we created that
linux directory
you'll see that we have that linux
folder now if we go in
cd into the linux directory
press enter
and if we ls again
that'll that assurance that we have that
ubuntu folder that we created now if we
cd into the ubuntu folder
boom and you type ls
again and you'll see that it has a josh
folder and you guys should get the idea
of how that actually works so i'm gonna
clear the screen
because i wanted to show you the next
command which is how to remove a
directory now let's cd to go back
and then let's cd in back into our
documents directory and press enter and
let's ls again
so you guys can see the folders that are
in
that directory
and the next command i want to show you
guys is
the remove directory command so let's
type
man and then rm dir press enter and
that's the manual for the remove
directory so it says remove empty
directories now the word empty is very
important when it comes to this command
because you have to run an option in
order to delete a folder
that has
either files or
directories underneath it and i'll show
you guys how to do that once we get to
running the remove command so let's
press q for quit and the first thing i
want to do is go to that test directory
and this i just want to show you guys a
simple way
of deleting a folder so as you can see
it has that test.2
directory underneath the test
directory so in order to remove that
test to directory and we know that that
folder is empty because we didn't create
anything underneath it so all we have to
do is type remove
dir
and then we could just type in test two
press enter and that'll remove that
directory for us so if we type ls again
you'll see that the task 2 directory is
no longer there otherwise it would have
listed just like up here when we first
run the ls directory
now let's type cd
and go back to our home directory now
let's go back into this documents folder
because i want to show you guys an
option on how to delete a parent and
child folder so if we uh press enter
there that'll get us back in that
documents directory
and let's type ls
to list out their directory the contents
of that directory now we know that the
linux
folder has multiple folders underneath
it
and just to show you you cannot remove
a directory with a directory i'ma run
the remove command against that linux
directory that we created and press
enter
and as you can see it says fail to
remove the linux directory because it's
not empty so in order to get by that we
use the same option that we used to
create a parent child folder
when we ran the make directory command
which is dash p and you'll start
learning that a lot of
the options are pretty much similar
so let's run it now
remove
dir so rmdi or
dash p
and then we have to specify
all of the directories so if we type
linux first
and then there is a ubuntu directory
underneath that and then the josh
directory as well and if we press enter
there that will delete that whole
directory tree so all the folders
underneath it are deleted as well as
that folder and if we list this
directory again you'll see that it's
fully gone
okay cool so now that we understand how
to
manipulate directories now let's hop
over and learn how to manipulate files
or create files remove files
and the first thing we need to
understand is that all files on the
linux operating system are case
sensitive meaning that you can create
files with the exact same name the only
difference is the case of a particular
character within that file
and that will be recognized by the linux
operating system as a totally different
file
and this is very different from the
windows operating system
in windows a file no matter where it is
within the same directory can't have the
exact same name no matter the case so
this is one of the big differences while
working with files and linux that you
need to understand
and then also not to fully confuse you
guys but
in the linux operating system everything
is considered a file
even directories
they are considered a file by the linux
operating system it's a special type of
file but it's considered a file
nonetheless
now the first command i want to show you
guys
is the file command
it's very simple so let's open up the
man page for the file command
and we can type man
and then file and press enter and that
will bring up the manual for the file
command so it says determines a file
type and then here is the synopsis and
then also the description of what is
that how is actually used and then we
can go down to the bottom and it will
also show you some options that can be
used with the actual file command so
let's quit and i'll show you guys some
of the basic examples of using the file
command and before i type the command i
just wanted to explain that the linux
operating system does not use extensions
to dis determine a file type now there
are applications that sit on top that
will
use the file type to show you what
application can open the file but as far
as the file type it's not determined by
the operating system if that makes sense
so this is another reason why the file
command is very important especially if
you're working in the command line full
time
now let's go into our documents
directory and look at some of the files
using the file command
so boom and then let's ls this directory
uh let's actually go into the ansible
examples directory and then let's run
the ls command again
and let's actually go into another
directory right fast within here and
what i'm basically looking for is
a simple file that we can just play
around with and look at the file type so
if we ls this directory we should find
something yes and so what i'm gonna look
at is the readme.md
file and the way you use the file
command is simply just the command
itself which is file and then the file
that you want
looked at by the file command so let's
press enter
and that'll give us the information
about this actual file as you can see
it's a text file and that's basically
what amd
md file is it's basically markdown a
markdown language but it's it's
essentially a text file and now now
let's run it against this uh
rollingupdate.gmo so let's type file
and then rolling
update.yaml and press enter and let's
see what it brings up as well it brings
up as a text file as well
and let's go up one directory
because i want to find another file so
let's go to this
db folder
and let's see what's in here as well i
think it's some images
so our image directory
and let's ls this directory now let's
see what's in there so let's look at use
the file command to actually look at one
of these files now we already know by
the extension what it is
but this is a handy tool to give you
more information about a file now as you
can see this is the file name then this
is a pn png image
and you can look at the resolution of
the actual file as well as the color
color the rgb
rgba
and it says non-interlaced
but that's a image file basically
so that should help you understand the
file command
now the next command i want to show you
is how to actually create files from the
command line so let's actually cd
or change directory back to our home
directory and clear the screen
and the command i wanted to show you
guys is touch so if we type man
and then touch
this will give us the manual for the
touch command and basically what it says
is it's a change file time step
but
the major purpose for using the touch
command is to create files
but you can also do other things like
change access and modification times
as well as you know basically create
empty files
so let's go down and quit that and show
you guys how to use the touch command
and let's get back into our documents
directory
and use the touch command to create a
couple files now the basic way to run
the touch command is simply touch
and then the file name
so we can name it file
one
dot txt
press enter and if we lsd documents
directory
we'll see that file 1 has been created
now let's go down and create multiple
files
using the touch command and basically
all you have to do is list out the files
so let's create we already have file one
let's create file
two
dot txt
and file
three dot txt
and that's the two files and i'm just
basically showing you that you can
create
more than one file at a time using the
touch command you just have to separate
them by a space so let's press enter and
then list ls directory again
and we'll see that all three of those
files are there and just like other
commands the touch command has has a lot
of options where you could change things
about a particular file but i won't go
through that i just wanted to show you
the touch file and this is the simplest
way to create empty files on your
computer
now that we learned how to create the
files let's go down and learn how to
remove a file which is very simple it's
similar to the remove directory command
but instead of
rmdi or
it's just simply rm so let's go to the
man page for that right fast so we can
type man
and then rm press enter it says remove
files or directories and it basically
covers how to actually
use the command as well as a description
just like all the other ones and as well
as options that you can use so let's
quit that and actually do some examples
of removing these files that we already
created so the basic way to remove a
file is simply rm and then the file name
which is
uh the one the file1.txt which is the
first one i want to delete so we press
enter and that will delete that file so
if we run the ls command we'll see that
file1 has been removed
now the same way with the touch command
you can specify
multiple files so
all we have to do is type rm
and then what i want to do is show you
guys one of the options for the remove
command which is dash i which is
considered the interactive mode and it's
basically a way of running the command
where it verifies that you want to
delete these files so let's uh type in
our file names so file two dot txt and
file
and file
three
dot txt and press enter and it'll go
through and it'll make you verify each
one of these files and it says remove
regular empty file and you have to
respond by typing yes
and press enter and i'll delete that
file and then we have to type yes again
and i'll delete that file so now let's
run the ls command again
and both of those files have been
successfully deleted from the file
system
now don't you guys remember how i said
there's more than one way to skin a cat
within the linux terminal well you can
also use the remove command to remove
directories like it's stated within the
man page
and i want to show you guys how to do
that now
by using this test directory that's
already there
and in order to remove that directory
all we have to do is type rm
and let's try it without using any
options
let's type uh test and press enter
because i want to show you guys what the
response is as far as the error that
will pop up when you try to remove it
without using any of the options as you
can see it says cannot remove test is a
directory so in order to remove a
directory you can use rm and then there
is an option
of recursive that's what the or stands
for recursive and then force
and this will force the remove command
to remove that directory so let's press
enter and that should remove that
directory and we can ls this directory
as you can see that test directory is
gone now so i just wanted to throw that
in there so you guys can see that there
are multiple ways of doing things within
the command line
now let's go down and clear the screen
again
and the next thing i want to do is show
you guys how to copy files so the first
thing i want to do is
create a directory so we can go make
dir and then let's create a directory
called test under the documents
directory unless ls to make sure that
directory was created now let's create a
file within the test directory so we can
just cd to that directory that's the
simplest way
and press enter and then ls this
directory as you can see nothing is in
there so now we can use the touch
command so touch
and then file
one dot txt and press enter that'll
create that file within the directory
and as you can see it's listed there
once we run the ls command
now let's say we want to copy that file
within that same location well all we
have to do is type the copy command
which is cp now the first thing before i
copy i want to show you guys the man
page for it so man copy
basically copy files and directories and
then all the options that you can use
with the command so let's go down and
quit that and let's run the command and
and do some examples so all we have to
do is type cp
and then you want to specify the file
you want to copy
and then you want to specify where you
want it and the file name so we want it
in the same directory so we don't have
to type anything before the file name we
can
name it file
one
cp dot txt and press enter and then if
we ls this directory
we'll see that we have the copy file and
the original file that we copied from
now let's say we wanted to copy one of
these files to a specific directory
within the file structure all you have
to do is type copy
the cp command and then let's copy that
same file so file one dot txt and we
want to copy it to a specific location
let's copy it and put it within our
documents directory now we can just type
the absolute path that way we know for
sure we're getting the file in the
correct location
so we could put the forward slash which
is our roots and then the home directory
and then josh and then let's say we want
to put it in that documents directory
like we stated and that's all we pretty
much have to do unless we want to rename
the file and we'll just place it in that
location by pressing enter and if we ls
this directory you'll see that file one
is still there but we can ls a specific
directory
by typing the full path so we can go
forward slash home
josh
and then documents
and press enter and that will show us
that file one that we put in that
location
now let's go up one directory
and the way you go up one directory if i
didn't show you guys this but it's cd
change directory dot dot and that'll
take you up one directory as you can see
we went up one directory in a tree and i
believe i forgot to explain that when we
covered the cd command i just wanted to
keep it simple and not confuse people
but that is the way you move up one
directory while using the cd command now
back to the copy command
if we want to copy
a directory it's a little bit different
we have to use an option of dash or in
order to copy that directory as well as
all the files within it so all we have
to do is type cp
dash or
and then we want to copy that test
directory
that test directory
and i want to put it in the same
location so it's the exact same thing
all we have to do is type out a name so
let's go test
and then cp that's the name of the
directory and press enter and if we ls
our documents directory we should see
two folders in there now one of test and
one of test cp which is the copy now
let's ls that directory as well so let's
go
test cp because i wanted to show you
guys
that it does have those files in there
that we created under test so that
should be a clear example of how to
actually use the cp command
now let me clear the screen right fast
because the next command i want to show
you guys
has two features involved with it and
it's basically the
move command you can move files and then
you can also rename files and this is
what a lot of people use the
move command for for instance if you
have a file named file 1
and you want it to be named file 2
within the same directory a lot of times
people will use the move command to
actually rename those files within the
command line because it's basically a
faster command it's just two letters in
order to rename a file so before i show
you the command let's go to the man page
as normal
and the move command
let's press enter
and as you can see in the man page it
even says that
you can rename files with it and it also
goes through the description as well as
all the options for using the command
but i'm gonna show you guys the simplest
ones if you want to get more advanced
then definitely check out the man page
but let's quit
and then let's ls this documents
directory again because i want to show
you guys the simplest way to run the
move command by renaming file1.txt
and i'm going to do exactly that example
that i said a few minutes ago so let's
just type move
and then file name uh file1.txt
and we want to rename it to file2.txt
and we'll leave it in that same
directory so we don't have to put the
path in front of it and we can press
enter and unless ls this directory
and we'll see that file one is now file2
so that's in a simple example of using
the move command
to rename files and then you can also
move the file through that process by
specifying a absolute path
which i'll show you guys now
and so let's type move
and then let's capture that file to file
and we want to move it to the
test directory
and then let's also rename it to file
three
just to show you guys you can do all
this in
one command so let's press enter
and that will move file to and if we ls
this directory just to show you guys
that it's gone
now let's lsd test directory
and press enter and that'll show us that
we have that file three in there so
basically we've moved and renamed at the
exact same time by using one command and
you can also do the exact same thing for
directories with the move command so
let's lse documents directory again and
what i want to do now is rename the test
cp to test pc and i apologize i typed
the wrong command i put the remove
command in there which i meant to put mv
so apologize for that but let's go down
and move forward but we're going to run
that same command i'm just going to
change it to the right command and i'm
glad that didn't work
because it's a directory i would have
lost that file
or directory
but anyway let's run it now and we
should be good to go so let's ls this
directory now
and it should be test pc
so i apologize for that and even your
instructor makes mistakes
but let's keep rolling right on with it
and by showing you guys all these
commands you should be able to
manipulate
files within the linux file system so
make sure you practice these commands
because once you master these commands
then there are more commands and more
options that you can use in the future
okay cool so now that we understand how
to work with directories and files now i
want to show you guys how to work with
the content within a file and there are
a couple commands that i wanted to show
you guys that will help you do this
now the first command i want to show you
guys is the head command and as always
with every command i will show you the
man page first so
head
press enter as you can see it outputs
the first port of a file now the purpose
of this command it will print out the
first 10 lines
of a file and it'll do it right within
the terminal
and this is so you can get an idea of
what's actually in the file so let's
quit the man page right fast by pressing
q
and let's find a file to actually
use the head command on so let's lsd
documents directory and i may need to go
into another directory yeah let's go
into the ansible directory again press
enter and ls again so we can list out
the contents
and let's go down and
run the head command against the
readme.md file
so let's just go down type head
and then read
me dot md and press enter as you can see
it pulls the first 10 lines
now it's a little hard to count but the
spaces are actually a line as well so
that's why it shows content on blank
lines as well as lines with content on
it but it's the first
10 lines of the actual file now there is
an option
where you can show a certain amount of
lines let's say you only want to see the
first
five lines of this same file so let's
press up
let's actually run that command again
and run
dash five
and press enter and that will show you
the first five lines of that line
instead of the default of ten so that's
a cool way of actually using the head
command and now that we know how to use
that command i want to show you another
command that's very similar to this one
and the difference between
this command the head command and the
command i'm about to show you is that it
shows you the last 10 lines of a file so
it's beneficial to use both of these
commands
if you're trying to figure out what's in
a file without opening up the full file
and the command i'm talking about is the
tail command so we can type man
man
tail
and press enter
and as you can see it says outputs the
last part of a file and the exact same
thing as the head command but it's the
total opposite while showing you the
last 10 lines of the file so let's go
down quit that
and let's run the tank tail command
against that same
file
and press enter
and as you can see it pulls the last 10
lines of that actual file
and just so you guys know this file
doesn't have much data in it i believe
it has about 10 lines in it that's why
it's showing the exact same information
as the head command
so let me find another command to give
you a better example so we can go into
the lamp
uh directory
and press enter and let's ls this
directory and let's find a better
file to actually look at and let's look
at the site.yaml file and let's run the
head first so ahead against the site
file and press enter as you can see it
pulls in the first 10 lines now
let's run detail command the exact same
way
and press enter and you'll see that the
information is different and that's the
last 10 lines of that file
and i wish i would have found this file
first because it's a better example as
you can see
the information is totally different
from when we ran it the first time on
the original file which only had a
little bit of content in it
now let's go down and clear right fast
and i wanted to show you another command
which is the cat command
and since we're deep in a directory
let's go down and make the terminal full
screen that way you guys can actually
see everything and let's clear the
screen again
and run man
cats which is command i'm about to show
you now and cat is short for concatenate
files and basically what this command is
used for is to print out
all the content of a file
not just the first 10 lines not just the
last 10 lines but the full
file itself so let's quit that and let
me show you guys how to actually run
that now so we could just run cats
and then the site
dot yaml file press enter and as you can
see it pulls in that whole file
and we can scroll up and see it but as
you can see that's the full file right
there so that's just a quick way of
printing out everything now the cat
command as i stated
stands for concatenate so you can take
information or content from multiple
files and concatenate that information
into one big file using the cat command
that's one of the
more advanced features of the cat
command so let me show you guys how to
actually do this
by creating a couple files and then i'll
concatenate the information within each
one of those files into one big file now
let's
let's cd
and then clear the screen right fast so
i can bring everything up to the top so
you guys can see now let's change
directories to our documents directory
press enter and let's ls this directory
because i'm gonna have to create a
couple of files right fast
and i haven't shown you guys the echo
command but this is the simplest way of
actually creating
a file along with the content in it so
let's first look at the man page for
echo i just wanted to show you guys
uh this right fast but echo
press enter and it'll display a line of
text this is it's a simple command
that's been around for a very long time
that allows you to display information
and really all we have to do is type
echo
and then we can type some text so
and then i want to write d
and put it into an actual file
within this directory and all we have to
do is type
text one or whatever you want to name it
dot txt
and press enter
and that will echo d
into that file name as well as create
that file for us and if we ls this
directory right fast just so you guys
can see you'll see that text one is
there
and if we cut out that file
and i just wanted to show you guys this
we cut out that file
and press enter you'll see that the
word d is in there now let's run the
same exact command uh echo
and let's put something different in
there so
and just so you guys know what i'm doing
is pressing the up arrow that'll show
you commands that you've already ran
but
let's see the
and let's write big to this actual file
and let's press enter and that's text
too
and let's run it one more time
and let's create a file called test
text three
and let's put a word in here as well the
big
apple
so it'll write apple to that form to
that file
now let's cut out each one of those
files right fast so you guys can see
exactly what's in each one of those
files
and we'll start with test
one
press enter
and then test two
and then
test three
or text three
press enter and so as you can see it
says the big apple
now watch this if we run the cat command
against all three of those commands
we'll see all the text printed out from
each one of those text files
so let's type cat
and then we can type test
text
one
and then text
two
and then text
three
and press enter as you can see it puts
it all together so that's what the king
kat that's what concatenates means it'll
put
the content of multiple files
into one printout and you can also
extract it all to another file which is
a little bit more advanced but i just
wanted to show you that it is possible
to do this
by simply we can run the same exact
command but instead of it outputting
to the terminal i wanted to output that
information to a file so let's create
another file and all we have to do is
type the
greater than sign
and we can name the file all
dot
txt
and press enter
and if we ls this directory we'll see
that we have another file now called all
so if we cut out the all file
right fast we'll see that that text is
there so it basically took the text from
text 1 text 2 text 3 and put it all into
one file which is super cool and just
think of the possibilities by doing
something like this if you have a
file with 100 lines in it or a couple
files with 100 lines in each one of them
and you want them to be combined you can
use this simply the cat command in order
to do this now let's say you want to
create a file and you want to type the
content within that file wanna show you
guys the simplest way by using the cat
command this is another feature of the
cad command and let me clear the screen
so we can get
it back up to the top but let's
let's start off by creating the file
using the cat command and what we need
to do is put the greater than sign
and then we can name the file whatever
we want it so let's name this file
one
dot txt
and press enter
and then as you can see the cursor is
stuck to the left-hand side that's
because we're using the cat command to
create the file and then write the
content into the file so all we have to
do is type in whatever we wanted to say
so i could type i
am
having
a
good
day
period and then you can actually add
more than one line you don't have to
keep typing you just press enter and it
will take you to the next line and then
you can continue typing i
hope
you
are
too
now let's say you're finished done
writing everything you want within this
file
in order to save it all you have to do
is hold the control button and press d
and it'll drop you back down to the
command line now i know that's kind of
weird where to put it but let's press
enter just to get it out the way
and now let's actually catch
that file right fast so we can see
exactly what's in it
and press enter and that'll cut out that
information for us and i should have put
a return at the end of it that's why
it's putting the the terminal prompt
right after the end of the file which
makes it kind of look weird but
that's essentially how it works
but with if you follow that process you
can create the file
write in the content that you want to
write into the file and then save the
file in that location now let's press
enter again because i want to ls this
directory because i don't think we i
showed you that the file was actually
there but as you can see file one that's
that actual file
now there's another cool feature of cat
that i want to show you guys you can
actually copy files or you can use it as
a copy for a particular file
and if we cut out
uh file one again that way we can look
at the text again so you guys can
actually see what's in it
we can actually copy that file and
rename it something else by using the
cat command like this so we can just
type cats
file
one
and then all you have to do is put the
greater than sign
and then name the file whatever you want
to so i'll just name it file 2 dot txt
and press enter
and if we ls this directory again you'll
see that there is a file 2
and if we run the cat command against
file 2
that will show us
the contents of that file which is
exactly the same as file 2.
all right cool so now we understand that
let's uh clear the screen because i
wanted to show you another command that
helps when working with files now this
is typically used
when you have a very large file that
you're trying to go through and look at
and this command is called more so we
can type man
and then more
and this will give you information about
it but basically it just parses out data
to your terminal
but it allows you to tab through
different pages and i'll show you guys
how to actually use it once we get into
it
and i found a quick file let's see under
the ansible directory
and then the lamp
directory hp i believe proxy
press enter unless ls is directing i
just want to try to find it uh in the
provision.yaml file so let's run more
against provision
dot yaml file press enter and as you can
see
at the bottom now this is by running
more
more shows you the percentage of the
file that you're at
as well as you can tab through
per page instead of going line by line
with the cat command where it just kind
of prints out everything let's say you
want to look at everything like uh page
by page if you hit the space button bar
that'll go to the next page and if you
hit it again that'll go to the end of
the page
and that's a super beneficial command as
well now there is an alternative that
some people like to use which is less
and i'll show you guys that now using it
against that same command but
first let's go to the main page for less
just so you guys can see it but it says
the opposite of more so let's type it in
and just run it right fast so let's go
less
and then the provision and file again
just press enter as you can see it's
pretty much the same you could tab
as well and you can go back up you know
what i'm saying and back down you can go
line by line as well
with this command but if you hit space
that'll take you down to the end
and all you have to do is hit the q
command that'll quit the actual command
but that's essentially a higher overview
of the less command and the more command
and this concludes all the commands i'll
show you
that'll allow you to manipulate the
content within
a file on the linux operating system so
let's move on to the next segment
okay guys so in the next segment i want
to show you guys a high level overview
of how the linux file six system is
structured and i'll show you by
basically bringing up the full file
structure in the terminal and then break
down each directory underneath the file
system so let's go down and hit cd
and then the forward slash and this
represents the root of the file system
and every file
included within the operating system is
stored under this one location it's
similar to the windows operating system
how everything is structured under the c
drive well it's the same thing but a
little bit different within the linux
operating system so let's press enter
there and what i want to do is run the
ls command and then i'll run the dash l
option and this will give us the full
structure of the operating system and
i'm gonna scroll up right fast a little
bit just to put it all in
so that everything is listed out
and i'll go through and break down each
one of these folders and like i said
this will be a high
overview
because i don't want to go too deep and
confuse new users of the linux operating
system i just basically want to explain
what a lot of these folders are used for
and this will give you a better
understanding of how the operating
system works
okay and the first directory i want to
show you guys is the bin directory and
this is where most of your binary files
are stored
now this means linux terminal commands
and core utilities
such as the cd command which we just
used uh the pwd command which is print
working directory which i showed you
guys a little earlier as well as the
move command and so on pretty much this
is where all those binary files are
stored now the next directory is the
boot directory and this is a very
important directory and you don't want
to go playing around in this directory
this is where all the needed files for
the
for linux to boot or kept
and a lot of people that are used to
running linux they typically separate
this directory on a different partition
from the remainder of the operating
system especially when you're working or
doing dual booting
but that's a little high level for you
guys i just wanted to give you guys a
overview of what this folder is for and
just a a little bit more of an idea of
what's
located in this directory is the boot
files as well as grub most of the time
which is a small program that allows you
to select the operating system and boot
the operating system now the next
directory is cd-rom and that's obviously
where your cd drive is stored so anytime
you put a disk into your linux operating
system it'll show up under cd-rom now
the next directory i want to really talk
about is the dev directory that's the
next directory down and this is where
all your physical devices are mounted so
all your hard drives uh usb
optical drives and the reason i say
optical drive cd drives because they can
be mounted under this location or stored
under this location as well it just all
depends on the different distributions
different distributions store things in
different places sometimes they have a
extra directory here and there that's
why i didn't talk much about the cd-rom
folder which is obviously that's what
that's for the cd drive but typically
that's stored and depending on the
distribution the cd-rom drives are
stored under dev as well but all your
hard drives are stored in this location
they're they're actually mounted from
that location and also if you have like
multiple partitions on a single drive
those will be stored under this location
as well and you'll see that once you
start really diving in
how to partition a hard drive for your
linux operating system now the next
directory i want to explain to you guys
is the etc directory and it basically
stands for etsy but this is where all
the configuration files are stored and
this is for all the applications that
are installed on the linux operating
system so let's say you want to install
an apache server well they'll have
configuration files stored under the etc
directory or if you want to set up my
sql or if you're trying to modify your
ssh connections or your configuration
for your ssh server then the
configuration file is underneath there
and most of your configuration files
have an extension of conf so c-o-n-f
okay and so the next directory is
basically the home directory and i kind
of explained this when i was showing you
guys how to navigate the linux file
system by using the cd command well the
home directory is where all the user
name folders are stored so anytime a new
user is created on the system depending
on if that option is selected or not
a home folder is actually created and
this is where all your documents and
photos and video files they're all
stored under that user's
home directory which is stored under
this home folder
now the next folder is the live
directory and this is where binaries are
kept and a lot of times you'll notice
that many that many times when
installing linux packages additional
libraries are automatically downloaded
and they almost always end up in the
live directory somewhere and just to
simply put it these files
or files that are needed for your
program to work on linux and just to
relate it to windows you can think of
this folder as somewhat an equivalent of
the program files folder on windows but
keep in mind it's not 100
exactly the same and just to explain
these other folders that are in there
that says live live 32 is basically if
you have a 32-bit
piece of software this is where the
libraries are stored for that as well as
system
64-bit software that is where those
libraries files are stored as well and
then there's a lib x32 and this contains
library files as well now the media
directory which is the next directory
i'm going to skip over that lost and
found that's just a typical folder
that's in aext4 partition but the media
directory is basically another place
where external devices such as usb
drives whenever you plug them in they'll
they'll pop up in there or you can mount
them in there and it all depends on the
linux distribution sometimes you may not
even see that media directory you'll see
a mount directory which is the next one
i want to show you guys and this is
basically a placeholder folder used for
mounting folders or drives and this is
where i typically mount external drives
or remote drives to my operating system
and like i said it is simply a
placeholder and a lot of times i'll
create multiple folders underneath that
depending on where i'm connecting to
let's say i'm connecting to
a shared drive or i want to mount a
shared drive on another server that's
within my network and i wanted to always
to that location i'll create a folder
for it and i'll name it like the server
name or something or the share name and
then i'll set it up where that share
drive is mounted at that location every
single time the system boots up now the
next folder is the opt directory and
this is for optional software for the
system and that's the simplest way to
put it and i never have used the app
directory for anything but it all
depends on the distribution you're using
as well now the prod directory is an
important directory as well this is the
processes folder where a lot of systems
information is represented as files
and it basically provides a way for the
linux kernel to send and receive
information from various processes
running in the linux environment now the
next directory is the root directory and
this is different from the actual root
location this is basically the home
directory for the root account you know
like we have the home folder and then
josh where there is a built-in user
called root that has full permissions to
pretty much everything on the system
with ubuntu they have this account
disabled by default but it has its own
home directory so if you ever logged
into that root account which i don't
recommend this is where the files are
stored for the root directory so if you
download something uh it'll default to
the root directory while you're running
as the root user now the next directory
is the run directory and this is where a
lot of drives are auto mounted
when you like plug in a usb drive and
this is something that's really only
relevant to desktop environments so if
you have a desktop environment installed
a lot of times they'll have the run
directory under your route where a lot
of those drives that are like auto
mounted to the system they'll pop up
under run and you can unmount them from
that location and let's say you want to
mount them under the mount directory or
the m t directory then you can easily do
that but they put that there for newer
modern linux distributions so that when
you plug in a usb drive it'll
automatically mount at that location i
don't normally use it but it is there
for a lot of users that are
transitioning from different operating
system just to make it more user
friendly now the next directory is s bin
and it's similar to the bin directory
except that is dedicated to certain
commands that can only be run by the
root user or super user and this
directory kind of depends on the
distribution as well now the temp
directory this is basically where files
are temporarily stored and most of the
time when you shut down the system it'll
delete those files from that directory
and i actually missed one of the
directories and that's snap snap is a
new way of actually installing
applications by somewhat containerizing
the application uh using they call it
snap packages and you'll see that a lot
in ubuntu systems but this is where that
is stored now the us or directory it
basically contains files and utilities
that are shared between users that's why
i call it i i just said the usr but it's
i typically call it the user directory
that's simply what that is it's just
utilities that are shared between users
and then the var directory is basically
where variable data is kept and it's
usually system logs but can also include
other types of data as well like for
instance if you're running this thing as
a server then the default location for
apache is var and then there's a folder
underneath that called www and then html
so that's where that's actually stored
as force files and then they also have
log files within there like if you're
running a server and you have an apache
server setup then you typically
will see your log files under war and
there's a directory called log and then
also under the root directory you'll see
a swap file uh depending on if you have
swap on the system and typically if you
install it without making any changes or
modifying the way the system is set up
you just take the defaults when you're
going through the installation then
you'll typically have a swap file
and this is just an extra place to store
things that are stored in memory that
haven't been accessed for a while so
let's say you have a browser open but
then you go over and start working on
something else and you eventually get to
the point where it needs to store your
system needs to store
some information that you have open that
you're not currently using well
sometimes it'll write it to the swap
file so that's essentially what that is
but that's pretty much the linux file
structure i just wanted to cover it this
way just to make it super simple where i
just talked about each one of the
directories and you can see them on the
system as i go through them so let's go
down and move on to the next section
in this next segment i want to cover
some systems information commands that
you can run within the linux terminal
now when you have a desktop environment
there are gui tools that can provide
most of the information that i'm going
to show you within the command line
but it's a good idea to at least
understand how to get this information
from the command line and just to show
you the gui version of kind of what i'm
going to show you
from the command line i just wanted to
open it up right fast you can basically
go
hit those activities and then you can
search in here
for a system
and you should bring up the system
monitor and like i said this will give
you a lot of information so this is the
system processes that are running on the
system
uh and this is similar to
opening up the computer management on
windows
systems but you can see your resource
information as well
uh file system information as well so
hard drives and all that good stuff
now i'm going to show you how to look at
all this information
from the command line
because all this information is pulled
from some of the folders that i actually
showed you
within the linux file system
and it's just put in a graphical user
interface
so you guys can see it a little bit
better but you can easily do the exact
same thing from the command line which i
will go down and show you now so let's
go down and close this
and open up the terminal
and let's zoom in again and sorry i
closed it but i need to
show you guys the gui version of
the commands i'm about to show you now
let's start off with a couple basic
commands like for instance i want to
show you guys uptime
up time so we can type man
man
up time
just to show it to you but it basically
tells you how long the system has been
running so let's quit that and let's run
up time
and press enter and that's basically the
information that it gives you it gives
you the time that the system has been up
as well as the amount of users and the
load average of the cpu which is some of
the information that's pulled
into
that system monitor
now the next command i want to show you
guys is the free command and this deals
with memory so we can type man
and then free
and press enter and as you can see it
says displays amount of free
and used memory in the system so we can
press q for quit
and run free all i'm gonna do is just
run the basic command but it gives you
these this information
for the memory usage on your system
and like i said i just kind of wanted to
show you guys a high overview or the
base level
of what the command is used for
because a lot of these commands are used
by systems administrators because when
you're running a server you don't have a
graphical interface you have to do
everything from the command line
and i don't want to make this course too
advanced
i just want to touch on some of these
commands
because it will definitely help you
when you start going for
linux certifications
now the next command i want to show you
guys is the ps command and this command
will display
linux processes that are currently going
on it's and it's simply a snapshot
so it won't refresh it'll just pull in
what's currently happening at the moment
on the linux operating system as far as
snaps as far as processors
processes that are running on the system
so the first thing let me open up the
main page for the ps command just so you
can see
that it does have a man page as well as
some detailed description on how to use
it but the basic way i typically run it
is ps
and then dash capital a
this is the only way i think you should
actually run it and like i said this is
just a snapshot of all the processes so
let's say you need to
kill a process because occasionally that
happens uh you need to go in and kill a
process well this is the process id
right here uh that number that shows the
process id so you can actually kill a
process if you need to via the command
line i won't show you guys how to do
that but that's something you may have
to do in the future once you get a
little bit more familiar with
using the operating system
now let's get into some hard drive or
hard disk commands that i want to show
you guys from the command line
and i don't know if you remember but
within that system monitor
application
you'll see that it showed some of the
disk information and partitions and all
that stuff well let me show you how to
find that information from the command
line if you need it and the first
command i wanted to show you guys was
the df command so let's type man
df
and basically this reports file systems
disk space usage so let's go down and
quit the
man page and run the command
and we could just run it it has a number
of options but i'll just run it just to
show you guys how to actually use it but
as you can see it pulls in a lot of
information based on the disk space
like for instance this is the
partition that housed the root directory
and you can tell by it being mood
mounted or the mount location but it's
mounted at root so that pretty much
holds the operating system right there
and just to make
the information look a little bit better
so you can understand it because it's
kind of hard to read this stuff in bytes
well there is an option just like i
showed you on other commands but it's
dash h for human readable and that'll
basically give you
the sizes in a readable format and as
you can see that breaks it out right
there so as you can see the full size is
30 gigabytes and the operating system is
taking up about nine gigabytes
and you have 21 gigabytes available and
so 31
is actually taken up but this is a lot
of great information you can get
about hard drives and hard disks and
partitions that are connected to your
linux operating system
now let's clear right fast because i
want to show you guys another command
and it's called f this so let's type man
f this and press enter and as you can
see you can manipulate this partition
tables now this is a great command but
just to pull information
about your partitions you want to run
the dash l option which is represented
right here so that's the way we're going
to run it that's typically how i pull
information that i'm trying to see about
partitions on the
system so eftis
dash l and press enter they may not work
because you need permissions and this is
where the pseudo command actually comes
in on
and i'll still cover that pseudo command
in the next segment but i'll just run it
so you guys can kind of see but i really
want to explain what sudo is actually
used for in
the purpose of the actual program but
sudo
and then f this
dash l and press enter and it should
access for our user account password or
our pseudo password so to speak and this
gives you a little bit more information
about all
the partitions on the system
and as you can see right here this is
our main hard drive again a vda 32 gig
uh and it breaks out all the different
partitions as well as the partition
types
and the sizes and all that good
information about the disk
now let me clear because i want to show
you one more command that i think is
beneficial for you guys to actually
learn or check out but let's type man
and then there's another one called ls
block
and let's press enter and as you can see
it lists block devices so let's press q
and actually run the command so let's go
ls
block
and see the results that actually comes
up and as you can see it gives you a
little bit more information but as you
can see it breaks it down a little
further it shows you the boot locations
of pretty much everything or the mount
points which it did using the other
command
but this is just another
command that can help you while you're
trying to
check on discs that are connected to the
system
and i know you guys are probably
wondering what are these loopbacks just
ignore them you don't have to worry
about it a lot of times that's just
special block devices
that are mapped to like normal files
and it shows up as a virtual black
device
that's essentially what that is
now let me go down and clear again but
now let's put all this information
together i showed you guys how to look
at the processes that are running on the
linux operating system
as well as the
cpu load the uptime
and the memory information well there
are some built-in utilities that you can
use to look at all this information just
like you would in the gui version but
it's for the command line so
the first one i wanted to show you guys
is top so if we run man
top
this will just give you some information
about it but it basically says displays
linux processes but it it displays more
information than
what you think so let's go down and hit
q and just run top so you guys can see
it
and as you can see it will update just
like
the processes were updating in the gui
but this is all on the command line it's
a little bit difficult to understand if
you don't know what you're looking for
so that's why i wanted to throw in the
other one and the way you get out of it
you just hit q and it'll drop you back
down to the terminal but let's clear
again and let's run man
h top and i'm 100 sure this application
is stored stored on here and it might
not have a
manual but i'm sure this application is
on here but
so let's go down and install it right
fast uh because i want you guys to
actually see it because there are some
utilities that have gotten
a facelift and as you can see h top it
has the same
word in it as top
you know i'm saying it just has a
facelift so it'll look a little better
within the command line and you can get
a little bit more information
and it runs pretty much the same as top
okay cool so let's install let's
uh run h top as you can see it gives it
a it gives a better representation of
what you're actually looking for and i
recommend you install h-top if you don't
have it installed on your system most
systems comes come with h-top install by
default i'm not sure why
ubuntu decided to remove that but h-top
is a very valuable utility that's
beneficial when trying to troubleshoot
applications
so as you can see you can get out of it
using f10 or q
and that'll exit out of h top so that
concludes this segment showing you guys
how to get some systems information from
the command line so i'll see you guys in
the next one
now the next command i want to show you
guys was dealing with networking
now
if you have a desktop environment there
probably is a network manager
uh in the gui and i'll just go there so
you can see it but under wire
connections you can go to wired settings
and this will bring up the network
connections which is under settings and
you can go through and modify your
settings as far as like setting a static
iop address
or changing up your dns servers you know
all that good stuff you you can do it
right here within a gui but i also just
wanted to show you how to gather that
information from the command line by
showing you two specific commands the
first one is an older command that's
been around for very long time but it's
called if config similar to
ipconfig on a windows operating system
so i have config press let's go to the
man page and looks like it isn't a man
page and they might have
removed this command from the system um
because i know it's becoming the oldest
version or it's like an older version to
look at the ip addresses associated with
the system yeah and as you can see it's
not on the system by default so let's go
down and install that as well so let's
go sudo apps
install and you can easily install these
uh packages that way you can
use some of these tools that i'm going
through you can follow this i'm just
writing sudo app install and then the
net tools and
i know i haven't covered the software
management
piece
but i'll get into that in a little bit i
just wanted to
show you guys these commands that should
be
on the system by default it all depends
on the distribution that you're using
because you could probably install a
debian
operating system and it may or may not
have this tool on it but i still wanted
to show it to you guys because it's
still relevant it's something that a lot
of people still use but i'll show you
the newest version of this command in a
couple seconds next
now let's uh clear the screen and run if
config
and press all right actually let's go to
the manual because it should have a
manual now so if
config
press enter that'll open it up and
basically what it says is configure a
network interface so most people use it
just like ipconfig just to get the
get the ip information on your system so
ifconfig press enter as you can see it
pulls up the network device which that
is the name of the network device on
this system
yours may have a different name but it's
essentially the exact same thing and as
you can see
this is my ip address as well as the
ipv6
address there as well
and other basic networking information
uh now i won't cover all of this but i
just want to at least show you how to
gather that information now the newest
version of this command is actually ip
and this should be installed by default
now uh man ip yes and it is it says
shows manipulate routing network devices
interfaces
and tunnels and this is a
way more detailed command
there's a lot of options that go along
with this command and
hence this is why it's replacing
ifconfig so let's press q to quit to get
out of it and let's clear and just run
ip
and press enter and that should show you
the help but i wanted to go let's uh ipa
that'll pull all the
ip information as you can see it pulls
up basically the same information
this is the device name right here as
well as all the ip addresses underneath
it so
ipv4 in ipv6 as well as your other
device information on this system and
once you learn this command you can make
changes to it you can set an ip address
a static ip address or you can add more
connections to it and force your system
to pull another ip address
and you can change how you write route
traffic but a lot of that goes into
these systems admin type of roles but i
at least wanted to cover the command so
you guys can see how to actually gather
this information if you need to
so within this segment we're going to
cover the sudo command as well as the
software center and the apt package
manager which is what you'll use to
manage software
now before we get to the package manager
as well as the software center i wanted
to talk about the pseudo command just so
you guys can get a clear understanding
of what it actually is
and just to simply break it down for you
sudo stands for
super user do
and is used to access
uh restricted files and operations
because by default the linux operating
system restricts access to certain ports
of the system preventing
sensitive files from being compromised
and what happens when you run the pseudo
command it temporarily elevates
privileges allowing users to complete
sensitive tasks without logging in as
the root
user
so first thing i want to do is run
man and sudo that way you can get a
little bit more information about it and
like i said i always run these man
commands so you guys can see
where to get the information for each
one of these commands so let's press
enter
uh sudo and it says x execute a command
as another user and typically is used to
elevate a user to a super user status or
as the root user of the system and the
simplest way to relate it to a windows
operating system when you want to run
something as administrator you right
click on the application
and hit run as administrator
now it doesn't actually for a password
you know in windows but you do have to
take that extra step to run things as
the administrator it'll just simply pop
up with a prompt asking you if you want
to run this application as an
administrator
but in linux it's totally different you
have to type in your password anytime
you want to elevate your privileges
so let's go down and quit and the way
i'm gonna show you guys
is what i typically use the sudo command
for and that is updating
your system now there are multiple ways
of updating it i believe in earlier
parts of the course i covered how to
install
packages within the software center
which i'll bring it up after this just
to show you that it's actually using
sudo
while using the software center as well
but i wanted to cover in the command
line
how to update the system
but before i do that let's run the man
command against apt as well because most
applications do have a manual
and this is the case for the app package
manager and as you can see it says
command line interface and what it's
used for is to install and update
packages now let's go down and quit that
i just wanted to kind of show it to you
but apps actually stands for advanced
package management tool
and basically it facilitates the process
of installing and uninstalling linux
software packages
an app is typically the package manager
for debian based distributions so
majority of debian based distributions
will have the app package manager
installed and ready for you to use to
install packages on the system
and depending on what distribution you
are using there are other package
managers out there but like i say that i
want to focus on apps so now let's use
the sudo command and app command to
update our system now the first command
i'm going to run is sudo
apt
update
and just say break this command down
first we're using sudo to elevate our
privileges because we can only make
changes to the operating system files
if we elevate our privileges because a
lot of the packages the where the
binaries are and all that stuff is in an
area that's owned by the root
user of the operating system and in
order for us to make changes to it we
have to elevate our privileges so that
we're running the command
as root so this is simply what the sudo
command is for and then we have apps
which is our package manager
and then there's an option called update
and what update will do
just to break it totally down most linux
distributions have repositories
where they store authorized software
that you can install in the system and
the update command basically updates the
cache of the available packages to your
operating system and this is something
that you want to do because it'll let
you know if you have updates so if it's
if a new package is on their repository
that's installed on your system
then it'll let you know after running
the update command so let's go down
running now so you guys can kind of see
what is what it's going to do and
anytime you run sudo you have to type in
your password for your user account
unless
it's timed out because i believe it's a
time period of five minutes or so
once you authenticate once if you run
the sudo apt updated command again
within that five minute time period it
won't actually for you for the password
again
and so
basically what it's doing is hitting all
the ubuntu servers where packages are
stored
and it's refreshing that the cache on
the system
and as you can see
we have three packages that can be
updated on the system now and so in
order to update our packages there's
another command you basically run sudo
apt
upgrade
this is how you actually
upgrade those packages
so you have to use the upgrade option
with the app package manager in order to
upgrade the packages because right now
it didn't do the update it just told you
that you had updates to the actual
packages
but in order to upgrade them you have to
type upgrade and just to point this out
right right fast you can actually look
at what's being updated by
uh running apps lists and then dash dash
upgradable that'll list out the actual
packages that are about to be upgraded
before you run the upgrade command so
now let's just go down and run it so you
guys can see
an update to the system and then right
here it kind of shows you what packages
are being updated and right now the
python 3 update manager is being updated
uh update manager is being updated and
update manager core is being updated and
then it tells you
three upgraded
applications will be installed and it
also tells you
how much additional space will be taken
up by these upgrades so as you can see
that's not much uh but let's go down and
press enter
or you can type y for yes and that's
basically confirming that you want to
upgrade these packages
and essentially that's pretty much it
that's how you update your system and
now that we've done that let me go down
and show you guys the software center uh
and this will allow you to install
applications i believe i showed a little
bit earlier but i didn't go through and
install anything so
let's go down and install something here
so you can see that the sudo command
works pretty much the exact same way so
let's install which is an image
manipulations
program
and essentially all you have to do is
click on it and then there's a button
that says install and one cool thing
about this package manager right here
it it has reviews of the packages
uh from everyone that's using it and you
know information about the actual
package
that you're installing
and all you have to do is hit install
and this is basically running it as sudo
because it has to authenticate
it's exact same thing as if you were
running it within the command line so
let's press authenticate and then it'll
go through the process of installing the
packages package
and at the end of the day this is doing
exactly what you can do
within the terminal
and within my first couple years of
learning linux i forced myself to not
use the package manager i forced myself
to install things from the command line
and i recommend you do the same that way
you can get the hang of actually
updating installing packages from the
command line because that's the best way
to actually do it but let's go ahead and
wait for this thing to finish this is
kind of uh a pretty decent sized uh
program so it'll take a little while to
actually install
but as you can see it's almost there
it's right at 90 percent so
let's wait a couple more minutes but i
just wanted to show you guys that that's
the full process of opening
installing an application
and that's pretty much it and if you
ever want to remove an application all
you got to do is hit remove
so let's go down and close this i'm not
going to open up the package
that i installed
but before we move on i want to show you
a couple more things you could do with
the app package manager right fast i
figured that would
be better for you to understand the
actual program but if we type sudo and
then apps and let's say we want to
search for a package uh and you got to
kind of know the names but all you have
to do is type sudo app search and then
the package name let's look for that
same package that we just installed so
uh search and it'll
search the repository for
the package menu or the
package that we just installed now it
doesn't narrow it down too much because
a lot of these packages have in it
but
uh if you scroll through here you'll see
the actual package and maybe that was a
tough one to actually
look for so let's go back down to the
bottom and search for something else
and let's uh press the up arrow and
let's search for a zip program
and we all know zip from windows how you
compress files and folders you can use
the the zip
package where there is a ported version
of zip on the linux operating system
that you can use to zip and unzip files
so let's go down and search for that and
see if it's there
and as you can see i believe is a zip
tool or a zip
not zip tool but it should be yeah here
we go zip it's uh that is the actual
package so archiver for zip
files so
that's a way to search for applications
so let's say we want to install that
application the package name
is what's in green at least on the linux
operating system and like i said other
distributions use different package
managers so different commands
to actually search for packages but
let's say we want to install zip let's
go down
and install it right fast and the
command to install it and let me move my
mouse out the way but it's sudo
apps
install
and then zip
and you can press enter and that'll
install the zip package as you can see
zip is already installed it already
already has the latest version that's
why it didn't do anything because zip is
already installed so let's try unzip
because then
sometimes unzip is not on here let's try
that and see if it goes through now
unzip is on there as well
so anyway that's pretty much how you
install a package now let's say you want
to remove a package and one thing we can
remove is the unzip package and all you
have to do is type sudo
apps
and the command to remove it is simply
remove so remove
and then and
zip or actually let's uh remove the
package and
just press enter and i'll go through and
remove and i believe i might have
installed a snap package so that may not
work so it wasn't installed through app
through the package manager sometimes
it'll default to the snap version and i
know i didn't explain that guys but a
snap
is essentially a containerized piece of
software that you can install it's they
call it a snap package
it's a new thing that they're pushing to
manage
packages
but app is still relevant and it's
something you need to learn in order to
use that linux operating system so let's
try removing unzip
all right fast and we can remove that
actual application
should be good to go so unzip is going
to be removed and then we'll just
install it back on the system but that
rip fully removed unzip from the system
now let's go down and install it back on
the system by just running uh sudo apps
install
unzip so you can see
you know something actually being
installed
and that's pretty much it so you can use
the zip and unzip
package on this system and that's pretty
much how you use the package manager on
a linux operating system
and this mainly will work for debian
based distributions
if you're using a different distribution
then you'll have to refer to the package
manager's documentation
for that distribution of linux
okay so in this segment i'll cover a
couple text editors
and this is very beneficial to
understand
so you can make changes within the linux
operating system and i'm talking about
like configuration files
for various applications within the
operating system
that you'll occasionally have to do
like when you install
certain applications
for example an apache server then there
are configuration files that you have to
modify in order to get apache up and
running
the proper way and so it's beneficial
it's very beneficial to understand how
to use a text editor so i'm going to
show you two of the major ones that i
recommend you guys start learning
in order to get proficient with editing
within the terminal because if we look
around the desktop we can easily look
around the desktop and there is what
they call a text
uh like i forget it's called text editor
yeah and most links distributions if it
has a desktop environment it'll come
with a text editor it could be like
mouse pad or something like that and you
could easily make changes in here but
it's better to understand how to use it
from the command line so i wanted to
cover it right fast
uh so you guys can get a better
understanding of it so first one i want
to show you guys is nano and nano is
the easiest and simplest one to actually
use so let me go down and show you guys
how to get
started using nano and the first thing i
want to do is open up the main page for
it so you guys can at least see the
information about the actual
program
and if we check it out you know i'm
saying the manual has a lot of good
information that can help you understand
how to actually use it now let's go down
and find a file in order for us to edit
so let's go cd
um and i know under documents and
ansible
and i think it's uh
i think we have uh let's see a couple
files in here we can edit so lamp
uh simple let's go into there
and press enter
and then let's ls this directory right
fast and there or
let's try that host file right fast so
uh actually let's cat it out right fast
because i want to see how long it is
which it really doesn't matter it
doesn't have to be too long
yeah that's a good enough file size so
let's edit that file so
let me clear right fast and
the easiest way to use nano is just
simply type in nano and then the actual
file name which was
host
host and press enter there we go so
let's just go down to the bottom i just
kind of want to show you guys you can
just easily edit this thing simply like
this so let's type uh ubuntu
and then let's just type 20.04
uh lts but that's simply how you use the
text editor now let's cover some of the
menu options now let's say you needed
help
uh while you're actually using this uh
you could just with the up arrow right
there on each one of these that's
basically the control button
so ctrl g so let's hit ctrl g and
that'll open up our help so as you can
see that's the help right there you can
go through it you know i'm saying it
kind of explains a little more uh and
explains those commands down at the
bottom
uh now we can uh just press q and
that'll get us back to the
actual file itself but just to cover
some more of these options you got exit
right believe right below it uh you got
ctrl o which is writing out the changes
so let's like for instance let's use
that now we made changes by adding this
ubuntu 20.04 lts so we can do control o
and that'll write out our changes to
that file name it's basically going to
access are we sure we want to write it
to that file
uh and that name or we could change the
format or we could change the file name
if we wanted to like make a copy of it
but let's save it as that file so that's
cool it says write
wrote nine lines
and it basically overwrote that file and
then we have read so that's uh control
or
uh control w is where is and that's
beneficial if you're let's say looking
for something
in a big long
file or a configuration file
that's basically your search and then
the control backslash that's actually a
find replace then you got control k so
let's say we want to
cut this whole line all you got to do is
be at the front of the line and hit ctrl
k and that'll cut that actual line now
let's say we want to paste
whatever we just cut
uh we can uh just do control u
and that'll paste whatever you had there
or whatever you'd recently cut so super
cool that that's actually there cut
paste you know what i'm saying uh then
you got your ctrl j for justified
uh ctrl t to spell
and then ctrl c cursor position and then
control underscore
go to specific line and one thing that's
beneficial for let's say you're a
programmer or something a lot of times
when you're programming an application
or a script or something uh it'll throw
an error and it'll tell you what line
the error is on
so it's beneficial to use that if you're
looking for a specific line within the
file that was thrown from the error
while you was building whatever script
or application that you was working on
especially if the file has like a
thousand or something lines you know
within it it's very beneficial now
that's pretty much the high level
overview of the nano
text editor so let's go down and exit
out of it and just to show you how to
exit it you can just hit uh control and
then x and then we did make some more
changes to it so it's basically asking
you if you want to save those changes so
all we have to do is type y for yes and
then it's going to access if we want to
write it on to that same file name press
enter and that'll actually save out that
file and we can cat it out right fast
right fast by typing uh cat host press
enter and i'll cut out that file we can
see that those changes have been saved
to that file
now the next text editor i want to show
you guys
is vim now vim doesn't come on ubuntu by
default you have to install it so all
you have to do is type uh sudo
apps
install
vim and that will install it on your
operating system and
let's go down and run it again
uh even though i already have it
installed on here
i just want to run it so you guys can
follow along
and see how to install the vim
text editor
but vim is based on vi or v i believe vi
came first and then vim it it's just
basically
vi on steroids it has a lot of features
uh you can set key bindings and all kind
of stuff uh using the film text editor
and a lot of people rant and rave how
great them is
but i'm one of these people that like to
i don't know just get things done it
doesn't matter how it gets done so
a lot of times i'll use nano but i do
understand how to use vim and i see the
power in using them so shout out to all
you vim users out there um
i definitely like the program but let's
go down and give you a simple usage of
the vim application
and let's clear right fast and let's go
down and open up a file using film so
i'm just open up this readme.nd file
there we go and
as you can see the navigation is pretty
much the same as nano but the problem or
the thing that kind of kind of messes
people up when they're first learning
you have to use commands in order to do
certain things like for instance you
can't just type right now into the
actual uh program you know what i'm
saying into the text file you have to
put it in what they call insert mode and
the way you get the insert mode is just
simply by typing i
and then you'll see down at the bottom
insert mode so scroll down add some
changes to here so let's type ubuntu
20.0
and then lts boom
so in order to get out of insert mode
all we could do all we need to do is
just hit exit and that will take us out
of insert mode and we can go back to
just navigating the file or whatever but
now this is basically stored in memory
you know what i'm saying whenever you
open up an application you make changes
to something it's kind of stored in
memory it hasn't been written out to the
actual file and that's similar to the
nano text editor as well whenever you
make changes to the file it's re is
basically changed in memory and then
until you actually quit the application
or save the actual changes
then it's actually just in memory and
there are commands in order to save
things in
them and so i want to show you guys some
of them right fast so in order to let's
say we want to write out those changes
that we made
um in order to do that all you have to
do is hit the escape button
and then type colon
and then w and that'll write out the
actual changes so let's press enter and
as you can see we made those changes uh
it tells you at the bottom right there
written out so those changes we made or
in the actual file now let's verify that
we actually save those changes by let me
show you guys how to quit it so all you
have to do is type colon
and then queue and press enter and i'll
actually quit the file
and then let's just cut out that file
right fast to read me
that way we can see that those changes
are there and if we
and if we look right here uh you'll see
the ubuntu 20.04 that we may change to
you know the file those changes were
saved so let's go down open it up again
uh in film
and let's say we want to make those
changes or change
uh let's say we want to remove that lts
out the end of it so let's go insert
mode uh and then we could delete
that text out of there
now let me show you how to actually quit
it instead of just writing the changes
out let me show you how to quit it and
save it at the same exact time so all we
have to do is type escape and that will
get us out of insert mode and then we
just type colon
and then right and
q so w and q and that'll write changes
and then quit the actual file so let's
press enter and we can cut it out again
just so you guys can see but if you look
up here uh the lts is gone so that's
basically how you make changes to the
actual file you just go into insert
mode and then you can write out those
changes or you can quit and save those
changes and then let's go back into it
right fast and i just want to show you
guys how to quit it without making
changes uh and
simply you can go back into insert mode
right there and let's say we want to
type lts and then let's say this is a
very long file we start going through it
and we don't remember what all the
changes or the changes that we made
within this file so let's say uh we
don't want to save
any changes that we actually made to
this file so all we have to do is type
colon
or actually get out of insider mode
first then control i mean then hit colon
and q and then bang or the exclamation
point and press enter and i'll actually
exit out without saving those changes
and we can cut it out again just to make
sure
uh but the changes that we did made
uh they're not they weren't saved to the
actual file so good to go now like i
said i just wanted to give you guys the
basics i could go like very deep into
this actual command or into this actual
text editor as well as nano i mean nano
is you know
awesome as well it's pretty basic but
bim you know you can go super far with
it but most people had issues with
saving and exiting the actual program
there is a meme that goes around a lot
of times
with a joke on it basically saying how
do i exit them you know what i'm saying
and it's kind of funny or whatever but
hopefully these guys get you started
with working with with text files within
the terminal
using a text editor
so this concludes my introduction to
linux course
i hope you learned at least the basics
of using the linux operating system
because i think this will motivate you
to want to learn more
and throughout my years of working in
the i t field i have always heard people
say that learning linux is too confusing
and i hope this course
dispels that myth
so make sure you keep practicing me
because the way to become a guru is to
keep using linux
so i hope you have a good day and keep
it techy
[Music]
you