Hey there, Linux newbies! Ready to unlock the power of the Linux command line? In this fun and approachable guide, we dive into the Ubuntu terminal to teach you the essentials of command-line magic. Perfect for beginners, this video covers everything from launching a terminal (like the awesome Terminator emulator) to mastering commands like ls, cd, mkdir, and rm. You?ll learn how to navigate the file system, create and delete files, edit code with Nano (sorry, Vim fans!), and even compile C++ programs with GCC. Plus, we?ll show you how to install cool programs like GIMP using apt and wield sudo like a pro. Whether you?re switching from a GUI or just curious about the terminal?s hacker vibes, this video is your gateway to a whole new world of open-source tools. Stick around till the end for a quick peek at graphical editing and a heartfelt call to join our community! Hit that subscribe button, scan the QR code to check out more tutorials, and let?s keep exploring Linux together. Drop a comment with your favorite command or what you want to learn next! #Linux #CommandLine #Ubuntu
Introduction to Linux Command Line 00:00:00
Ubuntu Linux Terminal 00:00:04
Benefits of Terminal Usage 00:00:09
Desktop Environments (XFCE vs. GNOME) 00:01:07
Launching the Terminal 00:01:55
Terminal Emulator (Terminator) 00:02:06
Understanding the Shell (Bash) 00:04:00
Echo Command and Variables 00:04:06
Clear Command 00:07:34
Navigating File System (PWD) 00:08:21
Listing Directory Contents (LS) 00:08:56
Using Man Pages 00:10:37
Changing Directories (CD) 00:13:15
Creating Directories (MKDIR) 00:14:51
Going Up Directory Levels 00:15:57
Creating and Deleting Files (Touch, RM) 00:19:03
Editing Files with Nano 00:21:00
Editing Files with Vim 00:26:24
Installing Programs with APT 00:28:06
Using Sudo for Root Access 00:32:29
Updating and Upgrading System 00:34:54
Graphical File Editing 00:36:05
Compiling C++ Programs (GCC, G++) 00:39:53
Executing Programs 00:40:57
Conclusion and Subscription Call 00:43:04
Thanks for watching!
Find us on other social media here:
- https://www.NeuralLantern.com/social
Please help support us!
- Subscribing + Sharing on Social Media
- Leaving a comment or suggestion
- Subscribing to our Blog
- Watching the main "pinned" video of this channel for offers and extras
Introduction to Linux Command Line 00:00:00
Ubuntu Linux Terminal 00:00:04
Benefits of Terminal Usage 00:00:09
Desktop Environments (XFCE vs. GNOME) 00:01:07
Launching the Terminal 00:01:55
Terminal Emulator (Terminator) 00:02:06
Understanding the Shell (Bash) 00:04:00
Echo Command and Variables 00:04:06
Clear Command 00:07:34
Navigating File System (PWD) 00:08:21
Listing Directory Contents (LS) 00:08:56
Using Man Pages 00:10:37
Changing Directories (CD) 00:13:15
Creating Directories (MKDIR) 00:14:51
Going Up Directory Levels 00:15:57
Creating and Deleting Files (Touch, RM) 00:19:03
Editing Files with Nano 00:21:00
Editing Files with Vim 00:26:24
Installing Programs with APT 00:28:06
Using Sudo for Root Access 00:32:29
Updating and Upgrading System 00:34:54
Graphical File Editing 00:36:05
Compiling C++ Programs (GCC, G++) 00:39:53
Executing Programs 00:40:57
Conclusion and Subscription Call 00:43:04
Thanks for watching!
Find us on other social media here:
- https://www.NeuralLantern.com/social
Please help support us!
- Subscribing + Sharing on Social Media
- Leaving a comment or suggestion
- Subscribing to our Blog
- Watching the main "pinned" video of this channel for offers and extras
Category
🤖
TechTranscript
00:00Hello there.
00:02Today I'd like to show you a little bit about the
00:04Linux command line
00:06inside of a terminal. More specifically, I'm going to be doing
00:08this on Ubuntu Linux.
00:10This is great for beginners to start to get
00:12to know how to issue commands
00:14and do things like that.
00:16If you're used to doing everything
00:18in a GUI, in a graphical user interface,
00:20then you probably have no
00:22idea how much fun it is to actually
00:24work inside of a terminal. There are tons
00:26and tons of programs that
00:28you can gain access to once you start
00:30getting more comfortable with the terminal.
00:32When you look around at the open
00:34source world and all the wonderful
00:36tools that people make, you'll
00:38find out pretty quickly that a lot of programmers
00:40just write tools that only work with the command line.
00:42And
00:44maybe later, if someone else comes
00:46along and wants to add a graphical interface
00:48for it, then they do.
00:50But lots of times that doesn't actually
00:52ever happen. And so, you sort of
00:54open up a whole new world for yourself
00:56when you learn to use the terminal.
00:58Anyway.
01:00And then you also look really cool, like a hacker.
01:08So, I'm on
01:10a desktop engine called
01:12XFCE, or a desktop environment called
01:14XFCE. Most new Linux
01:16users who are on Ubuntu
01:18are probably looking at the GNOME
01:20desktop. So let me just say real fast, if you
01:22have a desktop that looks nothing like this
01:24and you think you're on GNOME because you
01:26just installed vanilla Ubuntu or
01:28something, then you probably want to
01:30take a look at the top left corner
01:32of the screen for a little button called
01:34Activities, or at the bottom left
01:36of the screen for a button
01:38that I think is like nine dots.
01:40Both of those buttons will allow you to
01:42search for programs on the system.
01:44What you should do is basically
01:46click one of those buttons and then start typing
01:48in the word Terminal until you see a
01:50Terminal pop up and then you can click on
01:52it and then you can launch it.
01:54Okay, so for me though, I already have this
01:56set up on my desktop. So
01:58I'm going to click on my little
02:00Terminal icon and I'm
02:02going to launch a Terminal. For those of you
02:04who don't know what Terminal I'm using
02:06right now, this is called Terminator. I think it's really cool.
02:08I'm personally a huge fan
02:10of this Terminal. The main reason
02:12is that it's really easy and fast to
02:14split the panes. So you can
02:16do multiple
02:18sessions if you're connected to multiple remote
02:20machines at the same time
02:22later in your career.
02:24It's really convenient. It's actually
02:26kind of broken right now a little bit, but
02:28not too bad. I still love it.
02:30Okay, so I open up a Terminal.
02:32Technically, this is called a Terminal Emulator.
02:34The real Terminal would just
02:36be like a completely black screen
02:38and you wouldn't be able to see anything else graphical.
02:40So this is
02:42sort of like a windowed program
02:44that runs another program
02:46under the hood that helps this program
02:48talk with the operating system
02:50and it sort of performs
02:52two-way
02:54communication and shows you
02:56what the operating system is saying to you and doing
02:58and things like that.
03:00But for all intent and purpose, this is a
03:02Terminal. I always call this a Terminal.
03:04Okay, let's see. Maybe I need to increase the font size
03:06real fast.
03:08I go to Profiles.
03:10How about if I do Monospace
03:12and I just do it like
03:14a little bit
03:16bigger than the default so it's easier to
03:18watch on a video.
03:20Okay, how about that? Is that better? I think that's probably better.
03:22Okay.
03:24So for starters,
03:26you're looking at a command line interface. You're looking
03:28at a Terminal. This is a Terminal Emulator
03:30program. We have
03:32like a blinking cursor. You can enter commands
03:34and stuff like that. It's important
03:36to understand at first that
03:38you're actually already inside of a
03:40program. Remember I said that
03:42the Terminal Emulator is a program. It's a graphical
03:44program and it helps go between you and
03:46the operating system. There's also
03:48another program that sort of interprets the things
03:50that you're saying before sending that off
03:52to the operating system.
03:54The program is different depending on
03:56what environment you're using, but in Ubuntu
03:58it usually defaults to
04:00Bash. So I'm going to type a quick
04:02command. We'll explain what these commands do in a second.
04:04And I'm going to type
04:06echo shell and that's going to tell me
04:08what interpreter we're using.
04:10So by default we're using an interpreter called
04:12Bash. So if you hear anybody say
04:14hey I'm in Bash or I got a
04:16Bash script, well this is what
04:18it is. It's a program that will be understood
04:20by Bash.
04:22Okay, so what did I just type? I typed
04:24echo and then I typed a dollar sign and then I typed
04:26shell. So
04:28on the Terminal you can type
04:30any command you want. It may not actually
04:32work, but you can type. The way
04:34that your command is usually interpreted
04:36is if you type just one
04:38thing, then that's considered
04:40the program that you want to execute. So if I
04:42type the word echo by itself and hit enter,
04:44then Bash, or
04:46I'll just say the shell
04:48or the Terminal, is
04:50going to look for a program named echo
04:52and if it finds it, it'll execute it.
04:54There's a special
04:56way that it searches for programs like
04:58the program echo, for example.
05:00It has to
05:02go somewhere in the operating system, right? There has to be a
05:04path. So if you type which echo,
05:06you can see exactly where it is on the operating
05:08system. So slash user
05:10slash bin slash echo.
05:12That's where it is, but I can just type echo
05:14by itself because the system
05:16knows how to go search through special
05:18system paths
05:20looking for the echo program that you
05:22typed so it can find the real location.
05:24Anyway, so I type echo
05:26and this program launches and
05:28it doesn't really do anything. The thing about
05:30the echo program is if you just type
05:32something right after it and hit enter,
05:34then the echo program will
05:36actually receive what you
05:38typed after the echo program
05:40executable name
05:42and it'll just print it back
05:44to you. So what's happening
05:46here is the bash interpreter, the
05:48shell, it'll always take the
05:50first argument. We call these arguments
05:52words or symbols
05:54separated by spaces. The first
05:56argument is echo. That's considered the program
05:58that you want to run and every argument
06:00after that is actually just
06:02sent into the program that you launched. So the
06:04only thing that's actually launching here
06:06is the echo program.
06:08And then hello is a string that gets
06:10sent into the echo program. You can do
06:12as many arguments as you want. Actually, I don't know if
06:14there's like a huge limit. Huge limit.
06:16You can probably type a lot of these before you run out.
06:18And so I've typed
06:20three arguments. Technically
06:22the echo program is argument
06:24zero, the first argument, but
06:26I've typed out three arguments
06:28that will get sent into the echo program
06:30and you can see that echo received
06:32all three of them and just printed them out.
06:34And that's it.
06:36The echo program is pretty simple, but
06:38if I type a dollar sign
06:40and I like
06:42actually let me just type shell by itself.
06:44If I say echo shell
06:46it just prints the word shell because that's interpreted
06:48as just like a regular string.
06:50But if I put a dollar sign in front of it
06:52then bash considers that
06:54to be a variable. And so what it'll do is it'll
06:56go into memory wherever the
06:58variables are stored and it'll try to
07:00find a variable named shell.
07:02And if there is one, it'll take the value
07:04that's inside of shell which in this
07:06case is just bash
07:08and it'll convert the symbol
07:10dollar sign shell into
07:12the actual variable value
07:14and then it'll print that.
07:16It'll send that into the echo command.
07:18So if I say echo shell
07:20step one it looks for a variable named shell.
07:22Step two it grabs bin bash and
07:24replaces that where the dollar sign shell
07:26was written and then it sends that
07:28into the echo program.
07:30So now you know how to launch
07:32a program.
07:34Here's another program. It's called clear.
07:36If you just type the command clear
07:38then a program called clear gets launched
07:40and all it does is just help you clear the terminal
07:42if you want to keep things a little clean.
07:44Just to prove to you that this is a
07:46program we can type which clear
07:48and notice how it actually has a path in your
07:50operating system. User bin clear.
07:52This will be different if you're on a different
07:54operating system than mine but
07:56it's all okay.
07:58Where am I?
08:00You can see that I'm at some sort of a
08:02location. This is Mike at lectures.
08:04That sounds like the name of my computer
08:06and the name of my profile.
08:10Where am I in the file system?
08:12Your computer is like a big file system.
08:14There's lots of files and folders
08:16all over the place. Where is the terminal
08:18sitting? Is it sitting anywhere in the
08:20file system? It actually is.
08:22It's sitting in your home directory by default
08:24unless you've made some customizations.
08:26I can access
08:28the current working directory
08:30by typing the command
08:32pwd, print working directory.
08:34Again, this is a program and its
08:36whole job is just to print where
08:38the working directory currently is.
08:40The working directory means
08:42where you're currently at, where you're situated,
08:44where you're looking at, and it's saying
08:46that I'm in my home folder. In Linux
08:48the home folders are usually
08:50slash home slash your username.
08:52If I want to see what's
08:54inside of my home folder,
08:56I can use another program
08:58called ls which just lists the contents
09:00of a folder. I'm going to type ls
09:02and it tells me
09:04I've got all these folders, desktop documents,
09:06downloads, and so forth.
09:08ls takes arguments. Remember
09:10we have arguments like if we did echo hello
09:12then it'll print
09:14the word hello, but we can give the ls command
09:16some arguments too. We can say ls
09:18I'd like you to do some stuff.
09:20So what do we want it to do?
09:22Let's make it print all the
09:24files and folders, even those that might
09:26be hidden because
09:28on Linux if a file or folder starts with a period
09:30in the name, it'll usually
09:32be hidden by default. So if we want to print everything
09:34we can say dash a.
09:36And if I want to print in a vertical list
09:38style, I can put an l
09:40in front of there. So I can say ls
09:42which is the program, and then dash la
09:44is the arguments I give it, and that's going to tell it
09:46to print my directory vertically
09:48with all hidden files and folders shown.
09:50Notice how
09:52all this stuff showed up that wasn't there before
09:54like bash history, I have a
09:56cache folder, but then there was also some
09:58stuff that was there before like the documents folder
10:00the music and the
10:02pictures folder and so forth. So you saw these
10:04things before
10:06like let me just
10:08at least highlight one.
10:10So you saw the videos folder there before
10:12you just didn't see all those other hidden ones
10:14because they had dots
10:16in front of their file name
10:18or folder name depending on what they are.
10:20Okay, and then of course you can
10:22see that this is a vertical list, and you're getting
10:24a little bit better now at giving arguments
10:26to programs.
10:28So how did we know that
10:30ls takes dash la as an argument
10:32or as some arguments?
10:34You could search on the internet, which is pretty fast
10:36usually. You can also use a program
10:38called man. The man
10:40program will give you information on
10:42another program. Most
10:44programs have man entries, so
10:46when you install the program
10:48there will be like a new manual page
10:50that shows up in the man program. So I'm going
10:52to type man ls
10:54and hit enter. I'm basically going to launch the
10:56man program and I'm going to tell it that I
10:58want information on the ls program, so I hit
11:00enter. And then it
11:02sort of shows me like a big little
11:04instruction thing
11:06a little sheet, well it's actually
11:08not little. Depending on the program this
11:10could actually be huge. And notice
11:12how it tells you all the things that we can do
11:14with this program. So right
11:16here you can see the
11:18dash la part that we
11:20did earlier. Whoops, what did I do wrong?
11:22The dash la part that we did earlier.
11:24That's the dash a
11:26and we could also instead have just
11:28said dash dash all. That's what
11:30the manual is telling us. Where's that
11:32dash l, the listing? Let's
11:34see, it's somewhere in here.
11:38hijkl
11:40Maybe I should do a page down.
11:42Yeah, there we go.
11:44Well, there's no
11:46dash dash list. I was hoping that there would
11:48be a dash dash list, but this tells you
11:50at least that you can say dash l
11:52to use a listing format. And there's
11:54tons of other options that you can learn and read
11:56about if you just take some time
11:58to explore the man page.
12:00Kind of cool, right?
12:02How do you get out of this?
12:04By the way, how do you search for stuff?
12:06I'm going to search by using the
12:08slash key. So like, you know, the web
12:10slash key. I'm going to hit
12:12slash and then I'm going to type something.
12:14I'm going to say maybe block and
12:16then hit enter and notice how
12:18it highlights on the first match.
12:20I can do a regular end
12:22to go down to the next match
12:24or I can do shift n like
12:26a capital N to go backwards up to the
12:28previous match. So this
12:30helps you, you know, kind of search through
12:32man pages and things like that. And the cool
12:34thing about what the man page is using right now
12:36it's using a way to
12:38display itself. I think it's
12:40either using a program called less
12:42or it's using a program that works
12:44very similarly to a program called less.
12:46So the program less
12:48it just loads up a document for you
12:50and it lets you do things like this, scroll up and down
12:52search for things, go to a line number
12:54you know
12:56and just, you know
12:58it's very convenient, right? Like it
13:00pages in the terminal. If you want to
13:02exit this, you just got to hit Q.
13:04So I hit Q right now. So I'm going to do man
13:06LS again, hit Q and then I get
13:08out. So now we know
13:10a few commands. We know how to see
13:12where we're at in the file system and list
13:14directories and things like that.
13:16Let's go into the documents
13:18directory with a special command
13:20called cd.
13:22So cd stands
13:24for change directory and if I just say
13:26documents and
13:28hit enter, now the shell itself
13:30is inside of a different folder.
13:32It was in my home folder before, now it's in my
13:34documents folder. If you're ever
13:36unsure of where you are, use
13:38the pwd command again to figure out what's
13:40going on. Okay, oh look, I am
13:42inside of my documents folder.
13:44If you ever
13:46find yourself in some sort of a deep, deep
13:48subfolder, let's see, I don't even
13:50let's do like user lab
13:52lab
13:54labx32
13:56oops
13:58what am I doing?
14:00There we go.
14:02I'm just going into a random folder
14:04right now just to
14:06show you that we can go pretty deep.
14:08So I think that I've reached the end of
14:10that. Okay, so suppose I'm navigating
14:12around and I'm in some kind of a folder
14:14and I do pwd
14:16and it says, oh no, you're like way deep in
14:18some other folder. How do I get back to my
14:20home folder? Well, you could type
14:22out the whole home folder if you wanted
14:24to, but the easiest
14:26way to get back to your home folder is just type
14:28cd with no arguments.
14:30Once you hit enter, it'll drop back
14:32down to your home folder and if you're not sure
14:34then use the pwd
14:36command. Okay,
14:38so we're doing pretty well. We're kind of like
14:40navigating in here.
14:42Let's make a directory. I'm going to go
14:44into my documents folder again and
14:46let's see. So right here I've got like
14:48whoops, I've
14:50got some documents.
14:52Let me make a directory called temp
14:54with the command make directory.
14:58So, well
15:00mkdir is the name of the program.
15:02The first argument I gave it was temp
15:04and so it just created
15:06a folder for me called
15:08temp. So if I say cd temp, I
15:10can now go into the folder that I just created.
15:12If I list the contents of that directory again
15:14it's empty because I just made it.
15:16pwd lets me know where I am just to make sure.
15:18When you're new to the terminal you
15:20actually, I still use this all the time
15:22whenever I'm a little lost.
15:24I like to customize my terminal so it doesn't print
15:26the full path there. It just prints
15:28the current directory name so I kind of get lost
15:30sometimes. So you just
15:32use the pwd command to figure out where
15:34you are. And by the way, just
15:36as a reminder, we could always do man
15:38and the name
15:40of a program. So I'm going to say man make
15:42dir and there's options
15:44even for making a directory. I'm not going to go over those
15:46but just to let you know
15:48there's a lot to explore.
15:50Okay, so now I'm inside of the temp directory.
15:52I've made a folder.
15:54What if I want to go
15:56one level up? What if I don't exactly want to drop
15:58to the home directory but maybe I went one level
16:00too deep and I want to go back up
16:02one level? Well again, I could
16:04type out the whole thing. I could say go home
16:06and I could say documents
16:08and whatever.
16:10But, by the way
16:12I'm hitting ctrl-c when you see that caret
16:14c. That usually tries to get the
16:16current program to stop but when you're inside
16:18of bash it'll just sort of like
16:20abort the current command and go to another line.
16:22Okay, so how do I
16:24go up one level?
16:26Well, in Linux there are two special directories
16:28that
16:30have periods in the name. Well, they are
16:32periods. The directory
16:34known as period, actually let me show
16:36you the full
16:38Yeah, okay, well the empty directory
16:40listing. Notice how it actually does
16:42show me two things.
16:44It doesn't show me nothing. It shows me
16:46these two directories right here. That's not a mistake.
16:48So this directory
16:50the one with just one
16:52period, that always represents
16:54the current directory that you're in.
16:56So if I
16:58use just a period to go into
17:00a directory or to do something to a directory
17:02that
17:04period will represent something different based on
17:06where I am. Am I in my home folder?
17:08Am I in the desktop? Am I somewhere
17:10else? The period changes based on where
17:12you are.
17:14The double period, the double
17:16dot, it always means
17:18I'm getting used to
17:20this new pen setup. It always
17:22means
17:24There we go.
17:26It looks like an emo guy with his hair
17:28to the side.
17:30It always means the parent directory.
17:32So remember before
17:34we could type
17:36cd and then some
17:38directory name to go into a directory.
17:40Now we can type cd
17:42dot dot and that's basically saying we would like
17:44to change directories. We would like
17:46to go to the documents directory. Why? Because
17:48the documents directory is the parent
17:50directory of the temp directory.
17:52So if I say cd dot dot, notice how it goes
17:54up one level. Let's do that again just
17:56to be sure. So I'm going to say pwd
17:58and if I say cd dot
18:00dot and then pwd again,
18:02notice how we were
18:04in temp and as soon as we went up one level
18:06it went to documents.
18:08So it's just kind of a quick way.
18:10And just as you could
18:12use a bunch of directory
18:14names separated by slashes, you can also
18:16put dot dot
18:18in any directory
18:20that you want. So like imagine I'm in the
18:22temp directory again. I could
18:24say let's go up one directory
18:26and then a slash and then up another directory
18:28and then a slash and then up another
18:30directory and I should end up in the home folder.
18:32Isn't that kind of funny, right?
18:34So I'm saying like give me the parent directory
18:36of the current directory and then give me
18:38its parent directory and then give me
18:40its parent directory. So I went up three levels.
18:42So let me drop to my
18:44home folder and go back into documents and go back
18:46into temp. Whoops.
18:48I forgot to do cd.
18:50Now
18:52we're getting pretty good at navigating. Let me
18:54make another directory. I'll call
18:56it delete me because I intend
18:58to delete this directory. There's
19:00a program called rm
19:02remove that lets you delete stuff.
19:04Actually first before we delete
19:06that, let's use a program called touch
19:08and the program touch
19:10just sort of like creates a blank file.
19:12I think
19:14if the file already exists, it won't mess with
19:16the contents, but let's do an experiment in a moment.
19:18So I'm going to say touch blank file.
19:20It should create a file for me called blank file.
19:22So now I've got a directory
19:24and a file called blank file.
19:26Now I can remove the blank file with
19:28the rm command.
19:30So just rm and then give it the name of the file.
19:32Be careful with rm.
19:34He'll destroy your file system if you're not careful.
19:36And now let's
19:38remove the delete me
19:40folder. When you
19:42try to remove folders, you have to tell
19:44the remove command that you intend to delete
19:46a folder by specifying also
19:48the dash r command which means
19:50this is a folder I would like you to
19:52recursively delete it. So let me just type it without
19:54that real fast and it says hey I can't
19:56do it. It's a directory. So I'm going to
19:58say all right now how about just
20:00recursively delete a folder for me.
20:02And
20:04it did it.
20:06Some other
20:08useful flags you might want in the future.
20:10The first one that I like is v for
20:12verbose so it'll print everything that it deletes.
20:14And f for
20:16force. If you're absolutely sure
20:18that you know exactly what you're about to delete
20:20then force will make
20:22it so that this program won't
20:24start asking you are you sure, are you sure, are you
20:26sure. So it's kind of dangerous but it's
20:28also pretty convenient.
20:30Imagine that.
20:32Anyway so
20:34let's see what else
20:36can I talk about here.
20:38We know how to like touch
20:40to create a blank file and create a folder
20:42and navigate all around.
20:44Let's edit a file.
20:46Let's actually edit a file in the terminal.
20:48So
20:50there's kind of like an age old argument between
20:52the vim people or the v
20:54people and the nano people
20:56and so I just want to say that
20:58if you were a vim person don't ever talk to
21:00me again for the rest of your life.
21:02Just kidding. You're okay.
21:04We can sort of be friends.
21:06But I'm personally a nano
21:08person. So what am I talking about?
21:10Nano is just another program.
21:12It may or may not be on your system. I think on Ubuntu
21:14it should be there by default. Let me just double
21:16check. Yeah it should be there by default.
21:18We'll talk about how to install programs in a
21:20second. I'll go sudo apt install just to remind
21:22myself.
21:24But so you type nano
21:26to execute the nano program and then you type
21:28the name of a file that you want to edit.
21:30So let's edit a file called
21:32myprogram.cpp
21:38if you're writing some code.
21:40And this tells the nano program that you would like to edit
21:42this file named
21:44myprogram.cpp. You hit enter
21:46and you have like a nice little editor that
21:48shows up. Notice at the bottom
21:50you have a bunch of
21:52little shortcuts.
21:54So if you do
21:56actually let's look at this one over here
21:58first. If you hit ctrl
22:00o that means
22:02save the file. Write it out.
22:04If you hit
22:06ctrl x that means you'd like to
22:08exit the editor. So if I want to get rid of
22:10the editor and just like you know go back
22:12to the terminal, the normal command line
22:14I'll do ctrl x.
22:16There's a bunch of other stuff you can do
22:18and
22:20there's like a big help menu.
22:22I recently remembered that you can
22:24do alt n to see line
22:26numbers in nano. So that makes it a lot
22:28more convenient for coding. So I'm going to do
22:30alt n to get those lines off.
22:32Let me just type the word hello real fast. Hello.
22:34Okay so now
22:36I want to save this.
22:38Let's do
22:40ctrl o to just save it
22:42but we'll stay inside of the editor or we can do ctrl x
22:44to save it and then exit
22:46the editor. So I think I'm going to exit it. I'm going to say ctrl x.
22:48Notice how at the bottom
22:50it asks me do I want to save the modified buffer.
22:52That just means I've been editing
22:54inside of this like temporary
22:56area. Do I want to actually
22:58save it. So I'm going to hit y for yes.
23:00Then it asks me
23:02what's the name of the file that you want to save.
23:04Well since I specified
23:06my program when I launched nano it already
23:08knows what I want to do. If you didn't
23:10specify the name of a file then you could provide it
23:12here. So I'm just going to hit enter
23:14and now the program
23:16exits. If I list the contents of the
23:18directory I can see that I now
23:20have the world's worst
23:22C++ program ever because it's just
23:24hello that's not going to compile.
23:28So how do I see the contents
23:30of a file with the
23:32terminal. Well for starters obviously you could just
23:34type the name of the program again for nano
23:36and it'll show you. There it is.
23:38I'm going to hit ctrl x to exit out of it.
23:40But there's another popular command that people like to use
23:42called cat. Cat basically
23:44will go to a file
23:46load it into memory and spill it
23:48onto the terminal for you.
23:50Really what it does is it prints to something called
23:52standard output and then the
23:54shell interpreter grabs standard
23:56output and it renders it to
23:58the terminal. But we'll just say that this prints it
24:00to the terminal. So if I say
24:02cat and the name of my program
24:04then it prints it
24:06to the terminal. So you can check any program this way.
24:08Do yourself a favor, well do
24:10me a favor, and do cat
24:12at the following path.
24:14etc os release
24:16The etc
24:18directory off of the root of the file system
24:20in Linux is usually where all of the
24:22configuration files get stored.
24:24At least the ones that are system wide.
24:26So like system wide programs
24:28their configurations are usually in the etc
24:30folder. So there's a special file
24:32in many operating systems, definitely
24:34Ubuntu, called os release
24:36which just describes
24:38the operating system to you.
24:40Here if you're not sure what operating system
24:42you're using or if you just want to have fun
24:44and kind of see information on it
24:46well you can say
24:48cat etc os release and see
24:50your OS. So there it is
24:52all this stuff.
24:54Pretty fun.
24:56Ok so we
24:58did
25:00my program. Let's edit
25:02my program real fast. So I'm going to go
25:04myprogram.cpp
25:06and if I want to just say
25:08I don't know, maybe I want to make this look
25:10a little bit more like a program.
25:12So I can say integer, main
25:14and we'll just
25:16pretend that we're not going to do any
25:18arguments. Return zero. So this
25:20probably would compile.
25:22I think this would compile. If not
25:24then you might have to go into the number
25:26of arguments and then
25:28don't worry about this. This is not
25:30a programming video, a character pointer.
25:34I can never remember if the
25:36brackets go before or after the
25:38variable name. So I usually, when I
25:40start a new program, I usually compile
25:42both ways and see which one works.
25:44Ok so
25:46I did it too fast.
25:48So I edited and
25:50if I want to just save my changes, I'm going to say
25:52CTRL-O. Notice how it asks me
25:54again at the bottom, do you want to save it under the same name?
25:56I just say enter to say yes.
25:58If I wanted to
26:00instead just exit the program, I
26:02do CTRL-X and then yes,
26:04save the buffer, enter.
26:06If you find yourself
26:08inside a weird area
26:10where you can't really
26:12hit keys and you can't exit very well,
26:14you might be inside a Vim.
26:16Some operating systems
26:18use Vim as the default or some
26:20programs. So I'm going to just
26:22enter Vim manually.
26:24Whoops, what am I doing?
26:26Is it Vim or V?
26:28So I'm not a Vim user. Ok, there we go.
26:30So Vim is like, you know,
26:32it's very complicated. Some people say it's
26:34lightning fast and it's so useful, but personally I think
26:36by the time you need so
26:38many features, you might as well just mount
26:40the remote file system and use an actual
26:42graphical editor. I'm just, I'm just not
26:44a fan. Don't, don't hate me.
26:46You know, we can still be friends.
26:48So, um, if you're inside
26:50a Vim, you hit the insert key and then you can kind of like
26:52type and stuff like that, so it's whatever.
26:54But, um,
26:56what? Insert?
27:00Ok.
27:02I'm getting lost already inside a Vim.
27:04I'm just going to delete
27:06this stuff that I created.
27:08So if you want to exit from Vim,
27:10hit the escape key first to make sure
27:12you're not inside of insert mode or any special
27:14mode, and then say shift
27:16colon to enter command
27:18mode. You'll know you're in command mode
27:20because you see this little
27:22colon here next to
27:24your prompt, or next to a
27:26prompt. And then I'm going to say
27:28write quit.
27:30Write quit means save the file
27:32and then quit. If you want to quit
27:34without saving the file, you can just put
27:36Q, but Vim will complain
27:38if you've actually changed something and you're refusing
27:40to save the changes. So if you were
27:42absolutely sure you want to discard the changes, just say
27:44yes, I want to quit with an exclamation point.
27:46So Q exclamation, hit enter.
27:48Now you're out of Vim. Hopefully
27:50you'll never go back for the rest of your life.
27:52Sorry. Ok.
27:54So now
27:56we know, you know, a lot of
27:58stuff that we can do in the terminal.
28:00Maybe we should learn how
28:02to install programs real fast
28:04or search for programs.
28:06And then we'll do a little bit of
28:08some graphical stuff.
28:10Alright, so here's the
28:12command that I wanted to remind myself of.
28:14So how do we search
28:16for programs? If you didn't know this already,
28:18almost every single Linux distribution
28:20has a repository of
28:22pre-compiled programs that are open source
28:24that you can use for free.
28:26I personally think this is a lot
28:28better and a lot safer than
28:30the old Windows method of just sort of
28:32like going to random websites
28:34online and downloading programs and
28:36just kind of crossing your fingers that you didn't just
28:38download a virus.
28:40What happens is the people who run
28:42the operating system, they'll take the source
28:44code for popular programs and
28:46packages, they'll compile it for you,
28:48they'll store the binaries which
28:50are just the compiled executable files,
28:52and then you can use
28:54certain command line tools to
28:56install those programs one by one. There's so
28:58many available that it wouldn't make sense
29:00to install them all by default
29:02because you'll probably never use the vast majority.
29:04So we have
29:06a nice package manager in Ubuntu called
29:08apt. It's the apt package
29:10manager. If you want to see more information
29:12about it, let's see, is it called aptitude or just apt?
29:14We can say man apt.
29:16It's just a command line
29:18interface. This actually,
29:20I think this talks to
29:22dpkg under the hood, but you know
29:24it's just a package manager.
29:26One of the subcommands for apt
29:28is search. So we can say
29:30launch the apt program with
29:32apt, then we could say
29:34apt, I would like you to search, and what
29:36would you like apt to search for?
29:38I don't know. How about a program called mousepad?
29:40It's one of my favorite text editors
29:42on Linux. So what it does is
29:44it searches the Ubuntu repositories
29:46and it tries to find
29:48a package or a program that matches
29:50and if it does, it'll show you
29:52the listing. Okay, so what do I have here?
29:54Mousepad is already installed
29:56on this system. Yeah, that makes sense because I think
29:58I was just using it.
30:00And some other stuff
30:02that you could find.
30:04So you can just kind of search for
30:06anything. Do you want a free
30:08accounting program that
30:10you don't have to pay for? It's not necessarily going to be the
30:12best, but it's free and it works
30:14and it's good and a lot of people swear by it.
30:16Well, you can search for
30:18apt search new cache.
30:20And there it is.
30:22I don't have it installed on this machine, but new cache
30:24free accounting software. Do you want
30:26to learn to make
30:28memes against your enemies?
30:30Well, there's a program for that called
30:32GIMP. It's basically, it's kind of
30:34like at this point, I think an old school Photoshop
30:36clone, not clone, but alternative.
30:38It's really good for
30:40memes and there are actually a lot
30:42of very talented people who use GIMP
30:44to do like very artistic things.
30:46So there it is right there GIMP
30:48and it's
30:50GIMP because it's the GNU image
30:52manipulation program. There's also another one that's a little
30:54bit more artistic, I think. I haven't
30:56used it. I think I used it once.
30:58It's called Krita.
31:00Oops, sorry, not apt Krita, apt search Krita.
31:04And there it is.
31:06So there's like a bunch of different choices for any
31:08idea that you could have. Like just
31:10think of what you want. You want like another
31:12browser, another image
31:14editor, you want
31:16accounting software, you want an audio.
31:18Let's see, is there
31:20I think there's one called Ardour. Let me see.
31:22Apt search, you want to like mix music
31:24at home.
31:26So I want to type the name of the program Ardour
31:28but I want to see if I
31:30can find it by just
31:32searching for a music term. Let's say
31:34DAW, digital audio workstation.
31:36Let me scroll
31:38up a little bit. Yeah, there it
31:40is. Okay, so I searched for DAW,
31:42digital audio workstation and
31:44this program that came up right here, it's like
31:46a very, very, very popular free
31:48and open source digital audio
31:50workstation with like so many
31:52tracks that you can mix and
31:54effects and you can record with
31:56it and do all these crazy things.
31:58So I'm just trying to show
32:00you that Linux is not just for
32:02coding and
32:04boring stuff. There's a lot of fun stuff
32:06on Linux that you can access for
32:08free through these repositories.
32:10Okay, so let's actually install something.
32:12Suppose I'm ready to make memes
32:14against my enemies.
32:16So I'm going to say sudo apt install
32:18instead of search install
32:20and I'm just going to type the name of the program
32:22GIMP. Oh wait, hang on. I'm not
32:24supposed to show you sudo just yet.
32:26So let's do
32:28apt install GIMP.
32:30By the way, sudo is supposedly
32:32outdated and people are saying you should
32:34use something else but I don't know.
32:36Old habits die hard.
32:38So if I say apt install
32:40GIMP
32:42the system is telling me
32:44that I don't have permission to install a program
32:46on this machine and that makes sense. That's
32:48probably a good thing, right? You don't want to just
32:50let any user totally
32:52redo your system.
32:54So it's saying, could not open the lock file
32:56permission denied. Oh no.
32:58Unable to acquire the
33:00dpkg frontend lock.
33:02Are you root? Oh, okay.
33:04What this is basically saying is that in order
33:06for us to do root level activities
33:08like install a program on the system
33:10we need to elevate the command line to root.
33:12And how we do that
33:14is we pretty much just say
33:16sudo, which is the name of a program that
33:18helps us quickly elevate.
33:20It also actually does a lot of other stuff.
33:22But
33:24for now we're just going to use it to elevate the command
33:26up to root. So if I say
33:28sudo apt install
33:30GIMP, what's happening is the sudo program
33:32gets invoked.
33:34Then it receives apt install GIMP
33:36and then it just executes
33:38apt install GIMP as
33:40root. Let me just prove to you
33:42that sudo will elevate a
33:44command. So if I go
33:46who am I, it'll tell you
33:48the name of the current user.
33:50If I say sudo who
33:52am I, then sudo will
33:54launch who am I as the
33:56root user and then who am I should tell us
33:58oops, got to enter the sudo password.
34:00You actually have to be an admin to use
34:02sudo, just FYI.
34:04So if I say
34:06sudo who am I, notice how it prints root.
34:10So if I say
34:12sudo apt install
34:14GIMP, it's really just going to
34:16invoke apt install
34:18GIMP as the root user and it should allow me
34:20to install that program.
34:22GIMP is already installed. Okay, I guess I was making
34:24memes earlier and I forgot about it.
34:26Well, we could remove it.
34:28We could say sudo apt
34:30remove
34:32GIMP.
34:34Then it removes it. Yes.
34:38I don't think I was making memes on this machine.
34:40I think something funny is going on
34:42here.
34:44And now that it's removed, I could install it again
34:46if I wanted to. I could say sudo apt install GIMP
34:48and then it might ask you to push yes
34:50and enter and then
34:52it just kind of finishes.
34:54Also, if when you're trying to install things,
34:56you get a message that says
34:58repository could not be updated.
35:00It's like a 404 error
35:02cannot be connected to, not found.
35:04Your repo is out of date, you know, whatever.
35:06That might just mean you need to update your system.
35:08So I'm going to say sudo apt update
35:10telling apt that I would
35:12like to update its idea of all the
35:14packages and then
35:16sudo apt upgrade.
35:18So update just
35:20contacts the server and gets an idea of what
35:22packages there are
35:24and their versions.
35:26And then sudo apt upgrade actually
35:28updates the system, or it actually upgrades the system.
35:30When you're done with that, you usually want to do
35:32auto remove to
35:34just kind of get rid of any junk that's left over
35:36if you happen to remove things recently.
35:38This stuff up here, this is sort of
35:40like a corporate upsell. You can
35:42probably ignore that, at least for now.
35:46But yeah, so we know how to do lots of
35:48stuff in the terminal.
35:52Just to point this
35:54out, I'm going
35:56to open up the, let's see, we're inside
35:58of the temp folder. Okay, so I have the
36:00temp folder inside the terminal. I'm going
36:02to open up my file system here
36:04and I'm going to go into
36:06the same path. So we were inside of
36:08let me just show you again with pwd.
36:10We were inside of home mic documents
36:12temp. So let me go inside
36:14of the home folder. It's not downloads.
36:16Documents
36:18temp.
36:20And notice how I have the same file here.
36:22My program and my program.
36:24I can right click on this
36:26or even double click on it and I can open it up
36:28with a mouse pad
36:30or even this nifty little
36:32code editor called Genie.
36:34If you're interested in Genie, it's actually pretty
36:36nice. Sudo apt install
36:38Genie and it'll tell
36:40me that this program is already installed.
36:42I like to use it because
36:44VS Code and other IDEs,
36:46they're great for productivity, but they kind of
36:48help you a lot.
36:50And if you're trying to learn coding
36:52or whatever, sometimes
36:54it's a little bit better if you just use something
36:56kind of plain because then you'll learn
36:58more. It's harder.
37:00That's up to you.
37:02Anyway, so I'm going to right click on this
37:04and I'm going to say let's open this up with
37:06how about mouse pad I guess.
37:08Now I
37:10am graphically editing
37:12this file
37:14because maybe you want
37:16to edit everything in nano. Maybe you don't.
37:18Maybe you only want to use the terminal
37:20when you have to, but
37:22here you are. Let me do a cat command.
37:24I'm going to say my program cat.
37:26Notice how it's the same exact
37:28file.
37:30I can, I don't know, maybe
37:32put some empty comments up above
37:34the function name for fun and
37:36save the document
37:38and then just kind of do the cat command again.
37:40And you can see that
37:42my changes have been updated.
37:44So you can delete in the regular file system
37:46here. In XFCE, the file system is
37:48called Thunar and there should
37:50be a symbol somewhere or if you just
37:52kind of hit the start menu.
37:54Let's see. How about office?
37:56Where is
37:58Thunar usually? Oh, it's
38:00in accessories. Okay. And then if
38:02you're on GNOME,
38:04it's probably just called files
38:06or I forget what the name of the file system is, but you know,
38:08something that just looks like a folder.
38:10So
38:12we've edited that. We've got all
38:14the basics here.
38:16We know how to navigate. We know how to get to
38:18our home folder. We're like making
38:20directories, deleting directories,
38:22removing files, touching files,
38:24editing files.
38:26We're doing a lot. And just to let you
38:28know, there's like so much more you can do on the
38:30terminal. For instance, you can
38:32let's see, do we have GCC on this computer?
38:34No. GCC is what
38:36people use to code in
38:38C++, right? So I'm going to say
38:40sudo apt install gcc.
38:42Another thing you can do is install
38:44a package on Ubuntu called
38:46build-essential.
38:48I think it's singular, not plural.
38:50And this is sort of like a meta
38:52package, which means it's
38:54like a dummy package that installs a bunch
38:56of other packages.
38:58So build-essential, it'll grab
39:00all these other programs for you.
39:02It looks like
39:04a bunch of C++ stuff and
39:06there should be GNU Make in there
39:08and some
39:10Perl stuff, I guess.
39:14Yeah, I've never actually looked at this.
39:16That's not a lot of stuff that I use.
39:18There's just a few things that I use in there.
39:20But anyway, you install that and then you'll get GCC
39:22which will help you
39:24code in C++.
39:26You can also do sudo apt
39:28install yasm to install your
39:30assembler.
39:32What else?
39:34So gcc and g++ and yasm
39:36and make and an editor.
39:38I think that's kind of like almost all you need.
39:40Well, you can install a debugger.
39:42You can install gdb
39:44to install your GNU debugger
39:46which is already installed.
39:48Anyway,
39:50just to let you know, we can do
39:52gcc to compile some programs. It'll complain
39:54we don't have anything.
39:56Actually, let me go in there. Let me go to
39:58documents temp.
40:00Let's see if it'll compile this
40:02just as is. gcc
40:04my program output
40:06and I'll just say that we want a program called
40:08main. Is this going to work?
40:10Did it actually work?
40:12Oh my gosh! I got it right
40:14on the first try even though it was an empty program.
40:16It doesn't really do anything.
40:18Oh, by the way,
40:20in Linux or in the command line, you probably
40:22will see a lot of people do this sort of thing where it's like
40:24dot slash and the name of a program.
40:26The thing is
40:28in order to execute a program
40:30I'll tell you about
40:32permissions in a second. First, it needs permission
40:34to execute but then you need to provide
40:36a path to the program. You can't just type
40:38main as is because
40:40the shell is going to think
40:42that you're talking about a system program somewhere.
40:44It's going to look in all the system areas
40:46and it doesn't find a program named
40:48main. You have to give it a path
40:50to your custom programs to run. I'm going to say
40:52dot slash main
40:54and basically remember the
40:56dot was a special
40:58directory that meant the current directory.
41:00If I type dot main, it's
41:02actually kind of the same thing as typing
41:04home mic documents
41:06temp main.
41:08If I just type this whole path right
41:10here, it runs the program.
41:12Or I can do dot slash
41:14main. It also runs the program. In both cases
41:16it works. Let me edit this real fast
41:18to see if I can just get something exciting going on here.
41:22I'll stream and then I'm
41:24just going to go
41:30I'm just
41:32going to do that. Let me try to compile
41:34again. GCC, my program
41:36output to
41:38executable called main. Oh, what did I do wrong?
41:40Oh,
41:42GCC is for just regular C programs.
41:44You're not supposed to do that. I want to use
41:46G++ and then I'm going to say standard
41:48library
41:50I don't know, C++21
41:52or something.
41:54STD. What did I do wrong?
41:56STD equals C++
42:00Is 21 not
42:02a valid year? I don't even remember. I've been using
42:04C++17 forever. What did I
42:06do wrong?
42:08STD equals C++
42:10Okay, 17 I
42:12know definitely works.
42:14What am I doing wrong here? Okay, so 17
42:16I guess 19 wasn't a thing.
42:18Been using 17 for a long
42:20time. Okay, so I just compiled the program again
42:22with the C++
42:2417.
42:26Then what the heck was I doing yesterday? Was I using 23?
42:28Hang on, sorry.
42:32Okay,
42:34I forgot what standard I was on yesterday. Okay.
42:36So then if we run the
42:38program again
42:40it prints a message.
42:42Maybe I should retitle this video
42:44Your First C++ Program
42:46because that's literally what we just did.
42:48You know, I'll make another
42:50video.
42:52Anyway,
42:54I think we probably covered
42:56the basics of the
42:58Linux command line
43:00and
43:02well, you're off.
43:04I hope you enjoyed this video and you learned a little bit
43:06of stuff. Keep watching
43:08all the other videos and
43:10I'll see you in the next one.
43:16Hey everybody, thanks
43:18for watching this video again from the bottom of my heart.
43:20I really appreciate it. I do hope you
43:22did learn something and have some fun.
43:24If you could do me a please, a
43:26small little favor, could you please subscribe
43:28and follow this channel
43:30or these videos or whatever it is you
43:32do on the current social media website
43:34that you're looking at right now.
43:36It would really mean the world to me and it'll help make more
43:38videos and grow this community
43:40so we'll be able to do more videos, longer
43:42videos, better videos or just
43:44I'll be able to keep making videos in general.
43:46So please do me
43:48a kindness and subscribe.
43:50You know, sometimes I'm sleeping in the middle
43:52of the night and I just wake up because I know
43:54somebody subscribed or followed. It just
43:56wakes me up and I get filled with joy.
43:58That's exactly what happens every single time.
44:00So you could do it as a nice favor to me
44:02or you could troll me if you want to just
44:04wake me up in the middle of the night. Just subscribe
44:06and then I'll just wake up. I promise
44:08that's what will happen.
44:10Also, if you look at the middle of the
44:12screen right now you should see a QR code
44:14which you can scan in order to go to the
44:16website which I think is also named somewhere
44:18at the bottom of this video and it'll
44:20take you to my main website where you can just
44:22kind of like see all the videos I published
44:24and the services and tutorials and things
44:26that I offer and all that good stuff
44:28and
44:30if you have a suggestion
44:32for
44:34clarifications or errata or just
44:36future videos that you want to see, please leave
44:38a comment or if you just want to say, hey, what's up?
44:40What's going on? You know, just send
44:42me a comment, whatever. I also wake up for
44:44those in the middle of the night. I get, I wake up
44:46in a cold sweat and I'm like,
44:48it would really, it would really mean
44:50the world to me. I would really appreciate it. So
44:52again, thank you so much for watching
44:54this video and
44:56enjoy the cool music
44:58as I fade into the
45:00darkness which is coming for us all.
45:22So
45:52so
46:22so
46:52so
46:54so
46:56so
46:58so
47:00so
47:02so
47:04so
47:06so
47:08so
47:10so
47:12so
47:14so
47:16so
47:18so
47:20so
47:22so
47:24so
47:26so
47:28so
47:30so
47:32so
47:34so
47:36so
47:38so
47:40so
47:42so
47:44so
47:46so
47:48so
47:50so
47:52so
47:54so
47:56so
47:58so
48:00so
48:02so
48:04so
48:06so
48:08so
48:10so
48:12so
48:14so