Beginner's Guide To The Linux Terminal

DistroTube
233 followers
Oct 25, 2024
in the last few months we've got a lot
of new subscribers to the channel
and i've got a lot of new subscribers
that are very new to linux
and they don't know anything about the
terminal or the command line
and they really want to learn how to use
the terminal i've been getting people
messaging me
asking hey dt you use the terminal all
the time and it looks really cool i want
to learn all these terminal commands
can you point me to a video to learn it
all and
i've made dozens of videos about the
command line and about
bash but there's really no one video i
can send these absolute beginners to
that would properly teach them how to
use the terminal in the command line so
today i wanted to make a comprehensive
video
for the absolute beginner on how to use
the command line in linux
so let me switch over to my desktop here
and this is linux mint
20.1 i'm running linux mint inside a
virtual machine here today
and the first thing we need to do is
open a terminal
now you can open your terminal in
several different ways
in your desktop environment if it has a
traditional kind of menu system you can
navigate through the menu system to
locate the terminal application
if the terminal has a quick launcher on
the panel you could click
that and on a lot of debian and ubuntu
based systems such as linux mint
control alt t is a hotkey that should
bring up the terminal so let me hit ctrl
alt t
and the terminal pops up now i'm going
to make the terminal full screen here
and i want to zoom in a lot of times to
zoom in and out on most terminals
it's control plus sign or control
minus so if i do control plus i should
zoom
in if i did ctrl minus i'd zoom back out
but i want to
zoom way in so you guys can see the
commands i run today
now because we have a lot of information
to cover i'm not going to spend much
time on each of these commands we're
going to rush
through this but you can always go back
and re-watch the video
if you have problems understanding some
of what is discussed today
so the very first terminal command i
want you guys to run
is just open up your terminal and type
pwd that stands for print
working directory this tells us what
directory we are
in and right now i'm in my home
directory your home directory is
typically slash home
slash your username and
even without doing the pwd command i
actually knew i was in the home
directory because
this little squiggly sign here this
little tilde symbol
that is an alias for your home directory
that simply means uh that's just another
way of writing slash home slash dt in my
case so anytime i see the tilde sign
that's actually slash home slash dt
uh the next command i want to run is cd
now cd
means change directory meaning go to
another directory somewhere
on my system so maybe if we're already
in my home directory maybe i want to go
to the
downloads directory so i start typing
downloads and then i'm just going to hit
tab
and tab is a way to auto complete the
path
that you're typing so cd and then start
typing downloads and then just hit tab
if you don't want to type the whole
thing and it will just auto complete it
for you
then hit enter and now you can see we
are actually in the
tilde slash downloads directory so that
is actually
my home directory slash downloads if i
did pwd
you know it would print the full path
you know it would expand the tilde
character
out to slash home slash dt downloads
now that we're in the downloads
directory maybe i want to go back to the
home directory well how do i get back to
the home directory well you can do that
three different ways with cd you can do
cd and then space slash home slash dt in
my case
would take me back to my home directory
but let me get back into the downloads
directory so i cd back in there
i could also do this cd space and then
the tilde
symbol here because remember tilde is
just an alias for
slash home slash dt and that would also
take me
back home and if i hit the up arrow a
couple of times here it remembers the
history i'm going to run the cd
downloads command again to go back into
the downloads directory
also i can simply run cd without any
other argument cd without any argument
always
cds back into the home directory now let
me clear the screen
so i'm going to type the word clear and
hit enter just so all the information
that was already on the screen goes away
and we get a clean
terminal you could also do control l on
the keyboard to clear for example let me
do pwd
so it prints out my home directory and
then let me do
control l and that also works for clear
so
you can clear the screen two different
ways you can just type the word clear or
you can do control
l the next command you really need to
know is the ls command it's probably
one of the most common if not the most
common command people run in the
terminal
this is the list command what is it list
it lists the contents of the directory
you're currently in
if you don't give it any other arguments
it simply lists everything
in the directory we're in which is in
this case my home directory
but that's not really what it does it
doesn't list everything in this
directory it
only lists the files in the directories
that are not
hidden files and directories because in
linux
there are certain files and directories
that have a period at the beginning of
their names
we call them dot files and these dot
vols are really
hidden files they're files that are not
normally displayed when you run an ls
command or when you open a file manager
and you and you're viewing a directory
to actually show
all the files including the hidden files
what you need to do is run
ls space and then give it dash
a for all files including the hidden
files
and now you see i get all of the files
and directories
in this system including the ones that
begin with the period you know the dot
falls and the dot directories another
interesting flag for the ls command that
most people use
is the l flag and let me show you that
so i'm going to do ls
space dash a because i want to be shown
all the files
in this directory including the hidden
files and then i'm going to give it the
l
flag for long listed format
and what this does is instead of just
giving me a horizontal kind of list it
actually gives me a vertical listing of
all the files and directories
in this directory including the file
permissions who owns the file
the size of the file the date of the
that the file was created so it gives us
a lot more information and that is
typically my ls command typically i also
give it one more flag i give it
an h flag so my ls command is typically
ls
dash l for long format a for all files
including the hidden files and then i
usually give it a
h flag for human readable numbers
because
by default it lists the file size and
bytes
and some of these file sizes get into
kilobytes megabytes even gigabytes and
these numbers get huge and they're not
comma separated
so if you give it the h flag you know if
a one gigabyte file will actually read
as one gigabyte instead of you know a
bajillion
bytes or whatever it is now let me clear
the screen so ctrl
l to clear the screen now what if you
didn't know
all the flags that were available for
the ls command because there's a lot
many more than what i just showed you
and maybe you want to go and read about
some of the flags that are available for
a particular command such as ls
well what you need to do is read the man
page so if you type
in the terminal man and then space and
then the name of the program you want
the man page for the man page is the
manual page it's the instruction manual
for that command so do man space
ls and you get the man page for the ls
command and you can see
all of the flags the a flag we discussed
there's a b flag a c
flag a d flag so you can nf flag so you
can
list out just the directories or just
the files there's a g
flag which is group directories first
you can do a lot of really cool stuff
with the ls command
so any command i discussed today that
you want to learn more
in depth about a particular command just
view the man page
now let's talk about creating a file
there are a couple of different ways to
create a file
if you want to create an empty file and
maybe you don't want to actually
do anything with this file just yet you
want to create an empty file but you
don't want to
actually open it with a text editor and
put anything in it
you can just do this command here touch
and then we'll call
this particular file file one dot txt
it'll be a text file and if i get an ls
you see in my home directory we now have
an empty file
called file1.txt now
many times when you create a file you
actually do want to open it in a text
editor and start you know adding stuff
to it right away so typically when you
create a file you actually don't usually
use
touch typically you use your favorite
editor
let's use nano for this example you you
do nano and then
name a file so maybe i want to create a
file
called file2.txt and i want to edit it
right away and then i'm going to do
nanospacefall2.txt
and this opens this new file that was
just created it's still an empty file
but now we can actually type something
this
is a line of text well if i can type
and then what i could do is ctrl x to
exit out of nano y to save
hit enter and there you go if i did it
ls
file2.txt is there and if i actually
wanted to
check and make sure that the contents i
wrote to that file are
there we could use the cat command we
can run cat
file to and just tab complete and then
hit enter and you it cats out that file
every line of that file which there's
only one line
and that line is this is a line of text
now that we've shown you how to create a
file how do you create a directory well
you use this command here mkdir
for make directory so make deer space
and then let's create a new directory
i'm going to call it test
so we're going to make a new directory
and name it test
and now with that we've done that let's
run the ls command
and see if we have the test directory
and we do
now we could cd into the test directory
if we wanted to go there
cd into the test directory let's run a
ls uh
ls doesn't return anything because this
is an empty directory
well let's move something into this
directory so it's no longer empty so let
me
cd back into the home directory now i
could just type cd
and hit enter and go back to the home
directory but another interesting thing
you can do with cd
is cd space and then the dash character
and this
cds into the last directory that you
were in
so maybe i wasn't in the home directory
maybe i was in my videos directory or
something cd space
dash always goes to the last directory
you were in
before you went to this directory i hope
that makes sense so
that cds back into my home directory let
me
clear the screen let me run an ls and
what i want to do is i want to move
so let's do mv for move and let's move
file1.txt
where do we want to move it to let's
move it to the test directory
and hit enter and now let's run a ls
except we're in the home directory i
want to do a ls on the test
directory so let's give it a path to the
test directory
and then run an ls and you see file1.txt
is inside the test directory now if i
run a ls without any arguments you know
we'll run ls in the directory we're
currently in the home directory and you
see file one is not here because we
moved file one to the test directory
but what if you wanted to just copy a
file
instead of moving it completely well you
could copy with cp
instead of mv for move do cp for copy
and i'm going to do file 2 this time
and we're going to move file 2 of course
into the test directory
and now again if i do ls on the test
directory
we now have file1.txt and file2.txt
in the test directory but if i ls in the
home directory
you know file2.txt is also still in the
home directory because we copied it so
we have two file twos
right one in the home directory and then
the copied one that
is now in the test directory now how do
you remove
files and directories well to remove a
file what you can do is use the rm
command for remove and in this case i
want to remove file2.txt from the test
directory
now right now i'm in my home directory
right you see the path the tilde
is signifying the home directory that's
where i'm at now so to remove
file 2 from the test directory i need to
type the full path to it so i need to
type test
slash and then file to
dot txt let's run that and now
when i do an ls on the test directory
file2.txt it's no longer there because
we removed it
and if i up arrow to get to that last
command i ran this time let's run
file one so let's remove test file1.txt
and now when i run the ls on the test
directory it is now an empty directory
and now to remove an empty directory you
can't use the remove command
it doesn't work on directories typically
you can force it to work on directories
giving it certain flags we'll get to
that in a minute but typically to remove
a
empty directory you do rmdir for remove
directory
remove directory test let me hit enter
now let me ls and the test directory is
no longer there now how do you remove a
directory if it has stuff in it how do
you remove the
directory and remove everything within
the directory
well it's a dangerous command but you
need to know it so
let's go ahead and make the test
directory one more time so i'm going to
mk deer test and then let's put
something in it let me copy uh
file2.txt over to test one more time
and now if i did an ls on the test
directory you see it's not an empty
directory now so rmdir
on test actually will fail it says fail
to remove because the directory is not
empty you can't
rmdir a directory unless it's empty
but you can use the rm command with
these flags
dash r f and what this is is
remove recursively and forcefully
at a directory now this is a dangerous
command because
make sure that you actually want that
directory deleted
recursively because if you messed up and
removed recursively the root directory
for example you would destroy your
linux installation or you rem rf
your home directory you just lost all of
your home
user data so you know all your documents
and everything are
wiped out so be very careful if you run
the command
rm space dash rf make sure that that
path to the directory
is correct and you really want that
directory and all of its contents
removed
in this case it's pretty safe because
the test directory was just the
directory i created and there's
really nothing in it now let me clear
the screen here and let's talk about
finding programs on your system uh
one of the things people often want to
know about at the command line
is where a particular program's binary
is on the system
so any program that you can run from the
command line anything that you can
execute from the command line has a
binary somewhere on the system for
example the ls command
that we've been running let me do this
command here which
space ls and it's going to give me the
path to the actual
ls program the ls executable binary on
the system it's going to tell me exactly
where that
lives on the system i did which firefox
i'm pretty sure firefox is the default
browser here in mint
it will tell me where the binary for
firefox is now
i typically don't use the which command
there's a better command
called where is where is does the same
thing
except it lists multiple things it will
give you
the path to the binary it will give you
the path to the libraries for firefox so
user bin firefox is the binary that's
the executable user lib firefox is where
all the firefox library should be
and it also typically gives you the path
to the
man page for that program so user share
man firefox in this case
now how do you search for files and
directories on your system
maybe you are searching for a file that
contains a specific name
or a specific string of characters well
there's a couple of
popular commands to do this probably the
easiest command is the locate command so
i could run locate
firefox and it will give me all the
files and directories on the system
that have firefox as part of their name
now
not every linux installation is going to
have the locate command available
uh to install locate uh sometimes the
package is not called
locate i'm not sometimes it's called m
locate so
let me actually check that here on yet
so if i did a sudo apt install
mlocate it's gonna ask for my password
and mlocate is actually the package so
that is actually
the program you need to install is m
locate but the command to actually run
is actually called locate not m locate
so locate
and then a string of characters that you
want to search for
now the locate searches a database it
takes a snapshot of your system so every
now and then you need to update
the m locate database how you do that is
run
sudo and then update db all one word
and then once you have the new scan of
your system you know then run another
locate command
i don't know let's locate something that
contains the word
linux it's probably going to be a lot of
stuff on the system that contains the
string
linux as part of the the path to that
file or directory
now let me clear the screen another kind
of find command
is just the standard find command that's
part of the gnu core utils
so if i wanted to search through the
entire root file system i could do sudo
because we need sudo privileges to
search through certain root directories
i'm going to do sudo
space find space slash because we want
to search
the root directory when the root
directory is the slash symbol space
i'm going to give it this flag dash i
name because i want it
to search uh case insensitively meaning
i don't care whether the names
the letters and the name are capital or
lowercase
and what do we want to search for we
want to search for linux
and it's going to give me in this case
some directories that
have linux as part of the name and it
doesn't matter whether linux
began with a lowercase l or a capital l
because i gave it that i name flag
now the find command is very powerful if
you read the man page it's a gigantic
man page with a ton of flags and options
available for it i've done videos about
the find commands specifically
so check out my videos about find to
know more
now let me clear the screen let's talk
about uh
printing text right here at the command
line
probably the most common command for
just uh printing something out at the
command line
is the echo command so i could do echo
and i could do
in double quotes here i'm gonna do hello
world
you could have done double quotes or
single quotes it really doesn't matter
just wrap it
in quotes and it will spit out hello
world that's the output
now echo is a pretty standard command
but there's actually a better version of
echo
there is the print f command printf is
interesting it's a
upgraded version of echo because it
allows you to do things like uh
include special formatting and escape
sequences so i could do
for example one and then i could do
backslash
n for newline two backslash n for
newline
three and then do the ending double
quote and watch what happens
now i get three lines one two three
because
i could add those escape sequences for
the new lines if i tried to do that with
echo
it wouldn't work because echo does not
allow those escape sequences i hope that
makes sense
you say echo just echoes exactly what i
typed
rather than swapping out the backslash n
as
line breaks now an interesting character
that you need to know about
is the greater than sign and what this
does it redirects
output to a file let me show you let me
run
that printf command that we ran a minute
ago i'm going to printf
one two three and one two three you know
will be
on their own lines and then i'm gonna do
uh the greater than sign so i want to
take that output
which is one two three and i want to
direct it to a specific file
and it can be any file it doesn't have
to be a file that exists on the system
we can create a new file
remember i deleted file1.txt earlier so
let's
create it again file1.txt and hit enter
if i do a ls you will see file1.txt is
now back
if i wanted to see what was in it let's
just run the cat command
on file1 and you see one two three
is catted out so the greater than sign
that is for redirecting output
into a file by the way that cat command
it's really interesting
but you know sometimes you cut out a
file and it's a gigantic file
let me do cat on our dot bash rc which
is uh the bash shell configuration file
we'll talk about that later but let's do
cat
space dot bash rc and this is a gigantic
file
you know we're already at the end of the
file but i would have to scroll
up a lot to actually read this file so
cutting out
a file a lengthy file doesn't make a lot
of sense there's a better way to view
this
and you use this command here less and
then dot
bash rc and it cuts it out but it starts
it at the top
and if you want to scroll down the file
to actually read it which makes more
sense than being at the end and having
to scroll back up
less starts at the top of the file and
to read it
you just hit enter just hit enter and
you go down line by line and you could
actually read it
to get out of less type q for quit now
let me clear the screen
typically when you cataphile or less a
file you're looking for a specific
line of text a specific string of text a
better way to actually find that line of
text you're searching for
is to use the grip utility grip is
essentially a
search utility so run the command grip
and then the string
you're searching for maybe i want to
search for the word
alias so i'll wrap that in single quotes
space
and then the location of the file that i
actually want to search for the word
alias in i want to search
in my dot bash rc file let me run that
and you see the output it prints out
every line
that had the word alias somewhere in
that line
let me clear the screen one more time
earlier we talked about a very special
character we talked about the greater
than sign that
redirects output to a file another
really interesting character
is the pipe symbol what is the pipe
symbol well it
takes the output of one program and
directs it into
another program so let me give you an
example let's run the ls command let's
do ls
and let's do dash l for long format
so this is the ls command maybe i want
to run the ls command
and then i want to take that output and
pipe it into another program
maybe i want to pipe it into you know
what another gnu utility kind of like
grip
is said what is said well said is often
used as a search and replace
kind of tool and the way it works is you
do s slash
and then the old text slash then the new
text that you want to replace
and then slash g and then the ending
double quote
so in this case what i want to do is
there's a lot of
vowels in this ls command what i want to
do let's replace them all so what i'm
going to do
is i'm going to do inside square
brackets i'm going to do
a e i o
and what i want to do is i want to
replace every a e
i and o with the letter u
and watch what happens uh there are no
vowels anymore in this except the u
actually every a
e i o is still there it was just
replaced with
the vowel u i hope that makes sense so
we took the ls command
and the output from the ls command we
piped it into another command the sid
command
and then it ran the sed command i hope
that makes sense
i know that can be a little complicated
but piping is one of the most
unique things about the bash shell and
linux and the command line
and you could keep piping so we run the
ls command we piped it into sid and then
we could pipe it into another command
maybe when you want to run i don't know
the sort command which sorts
alphabetically or numerically
in this case uh it's not going to do
much because the very first letters are
either d
or dash so that's how it sorted it but
you know you can keep piping stuff when
you
we can after we sort it we could run the
grip command maybe i want to search for
specific lines which include
how about just the lines that include d
r w
x r so it's going to include all of
these lines but these last two lines
it's not going to return those
you see so you can keep piping and keep
piping into more programs and more
programs
so that's really the interesting thing
with
the shell and eventually with shell
scripting once you
start creating your own custom scripts
now let me clear the screen
we've talked about cutting a fall so
again let's cat
dot bash rc just as an example again it
cuts out the entire file we're already
at the end of the file i'd have to
scroll back
up to read it we've shown you less less
is a better way
it still cats out the whole fall but you
start at the top and have to read from
the top
but a lot of times you don't need the
whole fall
a lot of times you just need specific
groups of lines from the file
typically you just need a few lines at
the top or a few lines at the bottom of
the file and
if you run head space dot bash rc
if i can type it correctly what it does
is it prints out
by default the first 10 lines of the
file so
head name a file prints out the first 10
lines
if instead of hid iran tail
dot bash rc it prints out the last
10 lines by default now you can actually
specify
a number of lines if 10 is not what you
want you could do
headspace dash n for number of lines
space
and then maybe instead i want 15 lines
and then space
name a fall now i get a head but i get
15 lines
of the head and if i wanted to do that
on tail
i could do that as well till again dash
in for number of lines and then the
actual number of lines you want
and then the name of the file and in
this case
we just ran the tail command and got the
last 15 lines of our dot
bash rc now let me clear the screen now
let me run a ls space dash
l for the long format of the ls command
what is all of this stuff at the
beginning
of the files and directories these are
the file permissions
now this will be a lengthy discussion
that i don't have time to get into on
this video
i have done a video about file
permissions on linux
and i suggest you guys watch that the
command you use to change file
permissions is
chmod space and then whatever
file permissions you want to set and you
can set it in the
drwx rwxrwx format or you can just
do it as numerical values maybe i want
to change
file1.txt and give it permission
755. so chmod space 755
and then file1.txt
so i just changed it from it looks like
it was 644 before to seven five five
so if i do ls dash l again you see file
one now instead of being rw
dash rw dash r dash dash is now rwx r
dash
x r dash x now you
again watch my file permissions video to
understand what all of that means just
know that the chmod command
is what you use to change permissions
now let me
clear the screen here now one of the
things you often will
use chmod for is to give yourself
execute permissions for a file for
example let's
in nano let's create a simple bash
script so i'm going to do nano and i'm
going to do
script dot sh for shell script
and we want this script to run echo and
then
we want to do hello world
a very simple script here right so then
control
x to exit y to right and then just hit
enter
now let's try to execute this script if
we execute it it should print out hello
world right here in the terminal
to execute a shell script what you need
to do is period
slash and then the name of the shell
script so in this case
we're going to do period slash script
dot sh
and we're going to get an error because
permission denied why
is permission denied well if i do ls
space dash l
and go to script.sh we do not have
execute permissions no execute
permissions are the x's
that are in some of the files so we do
not have permission to actually
execute that file meaning we don't have
permission to actually
run that script how do we get this
permission typically you're going to do
chmod space
plus x meaning add the x's
to the file permissions add x three
times basically
to script dot sh now that we've done
that
let me up arrow and now when we try to
run the script
it actually runs and you get on the
output
hello world now let me clear the screen
one very useful command that you will
often use
inside the shell is the history command
so make sure you guys
know history just type the word history
and it gives you
you know the last well it will vary
depending on your bash
rc settings but it will give you several
hundred or maybe even several thousand
uh commands that you've run recently in
your history once you've run the history
command of course you could always just
copy and paste the command you were
looking for but
interesting thing about history is it
gives you numbers it lists them by
numbers
for example maybe i want to run the
command that's
numbered 84 which is the till dash in 15
on the bash rc
how would i run that well you simply do
exclamation point
and then no space just the number that
is listed in the history
so do exclamation 84 and it will run
the 84th command in your shell history
another interesting
history kind of alias is just the two
exclamation points the bang bang
that signifies the very last command
iran
and this is extremely useful so let me
clear the screen and i will show you why
you need to know about the bang bang
command so maybe i want to update my
system
on a debian or a ubuntu based system or
here in linux mint
typically what you want to do is apt
update so let's run an apt
update it's going to say sudo password
for dt
so it actually knows we need sudo
privileges but
i'm going to cancel that a lot of times
when you run a command that needs sudo
privileges
that you didn't give sudo privileges to
it's going to say you can't run that
command so let's imagine that that
command failed
well what i could do is go back right
afterwards and
then do sudo space and then bang bang
meaning
run sudo and then space and then the
last command i ran so it's basically
going to run
sudo apt update and it prints it out
sudo apt update
now run give your you know root password
or whatever it is and it will actually
update the system i'll actually let that
run since i started it all right clear
the screen
let's talk about how to kill a program
because this is something you often do
at the command line
you got programs running and you want to
close them and there's
several different ways to close a
program or kill a program is how we call
it here
in linux you could simply run kill space
and then the process id
for that process that's running or
sometimes you can just give it the name
of a program right now i'm in the
gnome terminal i think if i did kill
gnome terminal
it would probably kill it i don't want
to do that because i just have to reopen
it
and then zoom in again another thing you
could do is if you have
several instances of a particular
program maybe you have
multiple instances of the gnome terminal
running you could do
kill all space you know gnome terminal
or whatever
it is that you're trying to kill another
interesting way to kill a program
is the x kill command so let me open up
uh
something i don't mind uh killing so
let's open up
the file manager here now that i have
the file manager
open let me uh
minimize this and i'm going to run x
kill x kill
will turn your cursor into an x meaning
anything you click on
will be killed it only does it one time
so if i click on the file manager with
the x
we just killed the file manager so three
things you need to know
kill kill all x kill another
way to kill a program is through h-top
if h-top is installed
h-stop is not currently installed let me
sudo apt
install h-stop and then let's run h-top
and h-top shows all the processes that
are running on your system
so what i could do is i could just arrow
down here and find
you know the program that i want to to
kill maybe i want to kill
most of this stuff or demons running in
the background but just imagine i want
to kill this particular process that i'm
highlighted on right here
r cis log d now i don't actually want to
kill it but if i did
i would type f9 you see at the bottom it
tells me let me move my head out of the
way
f9 for kill you see this at the bottom
it gives you the hotkeys for it
so just type f9 and then another menu
will come up let me show you
f9 another menu will come up it's
already highlighted on sig term
just hit enter and it will actually kill
that process
now i actually don't want to do that so
let me get out of h top
let me get my head back up and let's
clear the screen one more time another
interesting command you sometimes need
uh not necessarily on some of the more
beginner
friendly distros like linux mint and
ubuntu and things like that but a lot of
times
you know if you're doing more minimal
installations like maybe you're doing a
server install like a debian server or
ubuntu server or maybe you're doing a
minimal
arch install or a gen 2 install and you
know during the installation process
you're wondering hey is networking
actually working do you have internet
well a good way to test it is just to
run the ping command ping
and then the address to some website or
some ip address that you know
just ping it and you know obviously
google.com
is a popular website let's see if we can
ping google and we can you see it just
keeps returning it now do control c
on the keyboard to kill the ping another
common command as far as internet
is wget what is w get it allows you to
download something from the web
that's basically a download command so w
get and maybe i want to do
https colon slash and then i don't know
some linux dot com you know this is
the website for some linux os i don't
know
and slash and then new dash release
dot iso right that would be the command
i could run
at the terminal you know if i knew the
path to the or the url
for some particular linux's iso you know
for a download i could run wget to
download that iso i hope that makes
sense
some other interesting command line
utilities are the date command the date
command
just returns the date now you could give
it several different flags you know you
can change the format drastically again
just
if you're ever wondering about flags for
a program just do man space
name or program so let's read the date
man page and you know you get
various flags formatting options and i
won't cover that you guys can
cover that on your own just read the man
page so that is date
another one you can run is cal
self-explanatory is a calendar and
another interesting one you can run from
the command line is bc
and this is your basic calculator so
type bc
and you have a prompt and i could just
start doing simple
mathematics here so if i did two plus
two
hit enter and i get four returned and
let me quit out of that
control c should get us out of that and
then actually
return an error it says use quit to exit
so let's just type the word quit
and we get out of bc let me clear the
screen
i don't want this tutorial to run too
long the only thing i want to discuss
real quick let me do a ls dash la
for all files and long format and hidden
files
because i want to show you guys in your
home directory look for
dot bash rc what is bash rc
that is your config file a lot of linux
files if they end with
the two letters rc that signifies they
are
a config file so do nano space
dot dash rc and now we have our bash rc
opened in our text editor and you could
go in here
and you could edit some stuff change
some stuff but
really the interesting things are
aliases and you see
alias ll is ls dash
alf so if we don't like doing our
standard ls command
what we could do is just use the ll
command because they created an alias
for it so let me open up a new terminal
let me zoom in a little bit here there
we go
and do ll and ll is the same as running
ls dash la that's what
is the exact same command i hope that
makes sense that's what a bash alias
is i've done some videos on bash aliases
before
and you know you can add other bash
aliases for example let me
quit out of this do i want to save now i
really haven't changed anything anyway
to update your system on a debian or an
ubuntu based system typically you have
to run this command
sudo apt update
space and and sudo apt upgrade
and i suggest you guys get used to
installing software removing software
updating your system at the command line
but the problem with this particular
command
you know you're going to want to update
your system probably once a week twice a
week and this is a lengthy command
to type it may be hard to remember the
command if you're not used to running
this command
what i would do is i would create an
alias for this command so what i would
do
is get back in your bash or c so do nano
dot dash rc
and somewhere where you have aliases
already written
i would just add a new alias so there
was already some aliases here
so i'm going to go to this line down
here
and let's do alias
space we need to create a name for the
alias i'm going to do apt
up for update or upgrade apt up
equals no space between the alias name
and the equal sign it has to be name
equals without a space
and then we'll do a single quote and we
want this alias to run this command
sudo apt update and and sudo
apt upgrade and then do the ending
single quote and then do control x to
exit
wide or right and hit enter and we have
to restart
bash here now i could just close the
terminal and then reopen it
you know to for the changes to take
effect but if i want to do that without
closing the terminal
i can do this command source and what i
want to source is the path
to my dot dash rc which is i'm going to
type the full path
the tilde character which is the alias
for my home directory slash
dot bash rc let me hit enter and now
that i've done that we've sourced
the new bash rc file the one we just
added that new alias for
let's try that new alias apt up
hit enter and it is running sudo apt
update
and then it's also going to run sudo apt
upgrade it's asking us do we actually
want to take the upgrade i'm going to
type in for no because i'll upgrade off
camera
so that's all i wanted to cover on this
tutorial
on learning some of the basic terminal
commands and i came at this
for those of you that are absolute
beginners i know we covered a ton of
commands
very quickly so you're gonna probably
have to go back and re-watch this
two or three times to to get everything
down but honestly
if you just rewatch the video two or
three times and actually run the
commands that i ran
it'll stick in your head these are not
complicated and
once you've learned them you will always
use them you will never open up a file
manager
to move files copy pop files or you know
see the contents of a directory no
you're always just going to open up a
terminal and type ls to see contents of
a directory it's just faster
same thing with moving files you're just
going to envy path to file especially if
you use the tab complete in the best
shell
it's actually much faster than trying to
drag
files and you know with multiple file
manager windows open
you're never going to do that stuff in a
gui program again
i think one of the things i think a lot
of people think the terminal and the
command line are harder than they
actually are and i really hope that uh
this video inspires
more of you to actually learn the
command line now before i go i need to
thank a few special people
i need to thank abc devon fran gabe
corbinian mitchell economy arts 530
chris chuck david the other david donny
dylan gregory lewis paul pickvm scott
wes and willie they're the producers of
this episode without these guys
this episode about learning basic
terminal commands wouldn't have been
possible
the show is also brought to you by each
and every one of these ladies and
gentlemen as well these are all my
supporters over on patreon
a sincere thank you to each and every
one of those ladies and gentlemen as
well because
distrotube is sponsored by you guys the
community
if you'd like to support my work look
for distrotube over on patreon
alright guys peace
