Time
6 hours 20 minutes
Difficulty
Beginner
CEU/CPE
3

Video Description

The Linux Command Line Interface This lessons covers the command line interface. The command line interface can be used to navigate the graphical file system. In this lab-based lesson, participants learn step by step instructions and learn different commands that can be used to show that amount of time someone was logged in, what happened on a system and what time and also allows you to view how much disk space is available. Participants also learn about the copy and move command, which can be used to move things from the desktop to one file up.

Video Transcription

00:04
Welcome to Cyber very 18. I'm great, Stuart. I'm your subject matter expert for Lennox. Plus
00:09
So in this
00:11
part four of module to the installation and configuration module,
00:15
I'll be covering the command line interface
00:18
earlier parts. We talked a little bit about the command line interface and even saw some examples of how to use. It's very simple example some simple commands
00:27
to help you understand how to navigate the file system a little bit easier.
00:31
So we know that you can also use the graphical interface user interface to navigate the file system.
00:37
I prefer to do it through the through the command line. So I'm gonna go ahead and launch the terminal here, which is pinned on my my took my taskbar.
00:47
Launch it. It brings me up. Let me blow this up for you
00:52
when I launch it brings up the the terminal window,
00:57
Jane.
00:58
And when I am, why I'm automatically dropped in is my working directory is tthe e home directory for my user Cyberia Admin.
01:07
So you can see here The prompt is Sai Berry admin, which is my user name
01:11
at Cyberia Lennox BM and what that is That's the name of my virtual machines. This is who's using it and on one machine. And again, if I do a p w d
01:22
sorry, she shows them in my slash home slash library admin working directory. So that's my home directory.
01:30
No,
01:30
if I want to change directories again The Commander's CD so much changed just to show you a CD to the root directory. There I am.
01:40
And again remember, you have to be extra careful when you're working with the root directory is here at the very root of the file system.
01:46
Anything you do here could have a recursive reaction on the entire file system. Shut everything down.
01:52
So just let me show you a um let me give you a quick example of that. So I had a good friend that teaches a different class. It's certified problem master class,
02:01
and he once told me of, ah, situation where he was using Lennox for General Motors.
02:07
Well, he's an employee at General Motors. He actually
02:09
ransom of living systems and what he did One day it was he was trying to delete a directory that he had created by accident
02:17
and need it renamed, so he didn't realize he was at the root level of the actual entire file system. He's where we were, where we are right now, just to show you it's a
02:28
It's just the slash There is room. What he did was an R E m Dash are
02:32
RN Dash are in any other situation. We remove recursive lee, remove
02:38
anything that's in that working directory.
02:40
So you either type in our M and then the file name or the director named that you want to delete that exist within the working directory you're on currently.
02:50
And it would delete that. However, if you want to delete every file system in the working underneath, the working directory that you're in, you're type of dash are it's recursive. That means it's going to delete everything.
03:00
So when he did that, he was at the root level. So he did that pressed enter and then he said it was like
03:06
something out of a movie. He watching. All of a sudden, all the lights and the General Motors factory started shutting down
03:13
and just kind of going off going off, going off. All the machine stopped, everything stopped and General Motors was down for about four hours,
03:21
and what they ended up finding out is that when he realized what he did, they came to him. He said, you know, packed my stuff. It's okay.
03:28
And the guy said, No, you gotta You gotta fix that. You're the guy that did this. You gotta fix it. And what? What they said was that you shouldn't have had root level access like this and actually fired his boss in his boss's boss for not putting the user permissions in the right place. User access control or say
03:44
so. You know, he went on fixing it, got it all back online, but it ended up costing General Motors about a $1,000,000 a minute. That's how long being down for that long. How many hours did for them?
03:54
So it's It could be a very dangerous place to be if to make sure that you're doing what you should, and especially if you're just working at the root level with a root account,
04:03
that's that's That's the most powerful account on the box. You can pretty much destroy the entire file system. So just a word of caution to be aware of what you're doing when you're working with it. And what Working director? You're actually in here in here, using commands and deleting things and copying files, etcetera. So just a word of caution.
04:21
So now I'm here. There's a couple of things I can do right off the bat.
04:27
So, just like in Windows, when you need to do something that requires administrator privileges If you're doing it from a command line, you're gonna run in command
04:34
using command line and I'm a Windows machine. You have to right click it or a shift right click and select runners administrator.
04:42
What that does is it drops you into administrative motor administrative account on the machine, which allows you to do a lot more.
04:48
Let's see you do a lot more processes that require administrative permissions. Then you would normally do with your regular user town.
04:58
Well, the same applies with Lennox Box, however, with blanks. There's a couple of different things you can do so with with a bun, too. It's slightly different from the other Destro's slightly different from red hat. Where's in Red hat? You would simply typed S U B s you command, which is switched user,
05:15
and then the command and Then there were the count that you want. So s you root.
05:19
So that drops me here and I would type in my password.
05:24
However, in a bun to what you can see here is that it's telling me authentication failure because the route user in a bun too is completely 100% locked down.
05:33
So when you don't want to unlock it, why don't you want to unlock it? Because there's a different commanding and use that basically does the same thing that keeps you from constantly being
05:43
in the root account, which is a good safety feature.
05:46
So on red hat, if you do this and you type s you route it, give you the password you lie would let you log in, or Fedor are Santos will let you log in, and then you'd be the route user and you be, you know, you could do any command and there'll be no stopping you. Spare the dangerous to use
06:00
with Sue Commander pseudo. Everybody pronounces a little bit different. I say suit pseudo
06:06
uh, Sue, do what it does. Is it saying
06:11
switch user and do as route would do
06:14
for this command gain and so It's a one time command. Want one for one.
06:18
So what I want to do?
06:20
Oh, let's say I want to download the G parted program. And to do that, I would type after get
06:30
all right,
06:31
install
06:32
g
06:34
departed. And this is the partition editor that we talked about. An early one. I'm gonna install it. Click that, and it couldn't is Just
06:42
see what they see with the air. Says here could not open long file. Okay.
06:47
Permission denied. Unable to lock the administrative directory Are you root and ask you a question or using route will shoot. Obviously, I'm not. I'm not using it.
06:57
So I need to show them that I have the privileges to do that. So I'm gonna go ahead and do that. And the way I do, there's I put a suit do in front of the app, get
07:04
basically the same command, hit the up. Ever give me the same command.
07:09
Well, I'm gonna go back in front of that command. I'm gonna type the studio sugo space.
07:15
Well, that's gonna do when I want to hit Enter. That's gonna give me a prompt for my past. Verceles, try.
07:20
Okay, now it's saying, What's the soup password for Cyber? We had him.
07:24
So it's basically gonna be my password the way I have a computer. It's just the same password. Know some people have administrator accounts and windows and regular accounts
07:31
for the purpose of this class. I just keep it all the same just to keep things easy.
07:35
So I'm gonna go ahead and typed. Password was just my regular
07:40
one and right right away kicked off the installation of G parted. So it's asking me what I want to do. So it goes through and it's telling me, dependency list done. It checks. Everything is gonna be installed here.
07:53
Here's the suggested packages, et cetera.
07:56
Um
07:57
and it says after this operation very last thing. 6169 kilobytes of additional data disk space will be used to You want to continue? You just type? Yes.
08:09
And it will go ahead and it's gonna download and unzip the package.
08:16
Fergie part is going to stall it. Okay.
08:18
How do I know that installed? How do I know that? Where do you think we could look?
08:22
Well, if you remember, we could go back to our
08:26
We go to places we can go back to our software center. We clicked. Darrell shows all the software center and that what's been installed. So let's check there first.
08:33
Hopefully you remembered in this way, that was your answer.
08:37
Now, instead of going to all software, I'm just gonna go to installed
08:43
as installed, comes up here,
08:46
is going to show me
08:48
accessories
08:52
under accessories
08:56
popularized
09:01
Let's go to history.
09:05
And today and there it is,
09:07
showed today that I actually downloaded departed
09:09
Where else can go, I can go here
09:13
right
09:13
to my spotlight on my search tool I could type g parted. There it is
09:20
Hit Enter.
09:22
It's gonna ask me for a password to run the deep part of tradition editor again. It's just my administrator password on my regular user account password Lets go Launch Cheap Parted.
09:35
Now what is it doing right now? It's searching my partitions to find G part in. This is gonna come up and still launch the actual G part of program.
09:45
I'm not gonna waste your time watching paint dry, so let's just skip out of that now that we know where to look for a software.
09:50
That's the nice thing about command line. Now you'll notice
09:54
that by
09:54
me when I when I by going out and actually having to find the software, download it once I downloaded going to download fuller click Double clicking on the X, C and windows.
10:05
By doing that, I've taken a whole bunch of time, right?
10:09
So in linens here, all I did was type of single command and it downloaded a download, went up to the Internet, found a package downloaded it. Unzipped it
10:16
asked if I want to keep asking. I wanted to install its gonna take up this much this space. It shows me all that's built in. I typed yes and done Bang. It's totally installed
10:28
on and taking care of. So it's It's a much easier and quicker process than actually going through the process, going to Internet Googling and finding the package you want downloading et cetera.
10:37
Your typical way that you'd install an application
10:41
in windows or even in lyrics. So using the command like to be a very powerful tool. So that's just one wondering. So now if I go to do the same command again, app get
10:52
stall,
10:52
he parted
10:54
again. It's not gonna let me I have to use the suit to command every time. But I wanted to, but I'm gonna do something that requires route privileges. Okay,
11:03
Now let's say you want to. Just You're tired of typing, sued over and over and over again. A quick command that you can use. This is a little a little tip for a trick that you can jot down our commit to memory. Use this occasionally when I'm just when I'm in the process of doing a lot of administrative things, editing files, etcetera. I just want to be
11:22
at the root type level. I could take Sue
11:24
Bash.
11:26
What that does is it drops me right into, like, a root type account. If I type act yet
11:33
install.
11:35
She parted
11:37
automatically. Didn't ask me for a password. It didn't ask me for anything like that. So if I am an administrator and I'm not logged onto the route account, which you can't do that gun too.
11:48
But I'm just gonna do Sue bash. So I'm constantly en route, and I could do the administrator from that one that you don't want your your regular users to have its power. So you're not gonna You're gonna put a password lock up so they don't actually have these permissions rights. But
12:01
you will, and you'll know about it, and you can do that. Enough. I want to come out of that room is type exit. I'm back to just being cyber Eri Admin.
12:09
Okay,
12:09
so there's two different ways you can do that that will help you thio navigate a little bit easier.
12:16
So some other commands that we can go over,
12:20
they're very helpful. I'm gonna give you a couple.
12:24
The last command is a really good and helpful tool to use to understand, kind of gives you a little bit of an audit trail. Who's been doing what, what, what they've been doing for how long they've been doing it, what account they used. So I'm just gonna type last.
12:39
It's gonna show me basically a paper trail who's been using a lot. So here's a cease. I bury admin
12:45
along on January 29th 23 13 still logged in.
12:50
But these other times I also logged in. I used this one time here five minutes, one for 11 minutes. Here, 22 hours. It was up and I was logged in
12:58
et cetera and tell them what I did. I did a reboot here, another reboot system reap of here and tells me all the things that what's been going on with last command.
13:07
Okay, so this is a really good way justice to see who's been using a computer.
13:11
And, you know, if you do that, you can find out something's happened and you could You need to find out who's who's done it, tracked the user down, and, you know, for disciplinary issues or tracking down to help
13:24
give them. Now, if you understand how to fix the issue they broke,
13:26
this is Ah, this is a good way to go.
13:28
Case. Let's the last command.
13:31
So the D F command
13:35
is another good command. You're gonna use this if you need to, you know, give you an idea of the free space If you feel like a snapshot of what you're just spaces. Okay. Um, so
13:45
all you do is basically type D f
13:48
type of here,
13:54
j just give me, like, right away a snapshot of my file system.
13:58
Much space. Amusing How much space I have left? You could see right here on death sda one. If you remember back when we're installing Lennox, Move on to that.
14:07
The devices sda one, my raw devices. Just SDA. But SDA one is actually my route. Partition
14:15
tells me how much I've used
14:16
how much is available. Tells him. It tells me I'm using 22%
14:20
you know, fairly good information. Have If you need to know if you need to be jumping around and figure out if you're pressed for for hard disk space me understand how much you got left, that's a good command to use. Okay,
14:31
also, let's just say you're doing a lot of RAM intense or memory intensive applications of processes You want to know how much ram do you have left?
14:41
Another good command is the free command that does that gives you a snapshot of your memory. Okay,
14:46
how much memory you have on your system? So it's another good command to use Kay. Um, another good command is the d you command Duke man.
14:56
Um and that's how you can find out
14:58
how big an actual file is. So
15:03
we have a file, and just for the purpose of this, let's go ahead and named the smiles we could get an idea.
15:07
This is There's nothing in it. I'm gonna open up this file that we created a lot in the last, uh, the last part.
15:16
Let's just put
15:18
this is a test. Let's file.
15:24
It's not very big.
15:28
Look, save it.
15:31
Okay? It's on my desktop.
15:35
All right, so
15:37
I'm gonna go to the directory. That file's in, right? And where is that file? So it was going here. Is it in here?
15:43
It's is not in here is actually in my, um,
15:48
desktop. Right.
15:50
So what I need to do is print working directory that tells me where I am. A mint route. Well, I need to go to
15:56
my real drinks. We could do this. The number two is you actually go to the directory that file system exist in, or you can type the entire path of the file.
16:06
Let's do them both. So as you can see the difference, let's start with typing the entire path.
16:10
What this do command is gonna do is actually gonna tell you.
16:12
Um,
16:14
you know it will give you It will give you an idea of how big the file is. K.
16:19
It's It's There's different switches. You can use for the dude. Ashby where when I say switches, it's the dash B or the dash A By doing l s dash a dash ese All to tell me all the things that are listed in that directory
16:33
The dash B is gonna be for bites. He'll give you exact figure bites.
16:37
Okay, so by default, if you just type, do it give you kilobytes. Okay, so let's let's give you let me give you an exact a couple of examples. So it's doing do let's go both ways of navigating that file. So if I do a first of all, if I just do a list for you, l s
16:55
home again. I'm using auto complete
16:57
by tapping out line. If I type my things, type h o I tap out in those days, I'm going home,
17:03
and then I'm gonna type desktop. I'm sorry, Sy Berry admin
17:08
and that Stop.
17:11
Okay.
17:12
And there's a mental doctor. Forgot to title this. Let's title it. Let's rename it
17:18
real title of test lyrics.
17:22
Okay. And again, it doesn't automatically show up. I actually have to do another l s. So I just hit my up barrow with same
17:30
there it is test leading stock. Okay, so now I'm gonna go ahead and do it. Do command to find out how big that file actually is. And again, this command is good for space saying, or if you have a command files, they're huge video files. You won't be able to free up some space quickly. This is a good command to use a drill down and find that file, see how big it is then deleted or move into a different
17:48
data store file structure.
17:52
So what must I do?
17:53
And I'm gonna go to home
17:56
Siberian desktop
18:00
and then I'm gonna type test.
18:02
I have a tab.
18:03
There's two different things called test so you can see how it it did A backslash after test That just means there's more than one thing. That's name. Start with the test. So let me go back,
18:12
backspace that I'm gonna do a test on a new space and time l
18:18
and it will tell me
18:22
Let's do this test
18:27
home Cyberia Admin.
18:30
That's Tom
18:38
Inter sees no one. So let's just go there. Let's go to the director yourself
18:48
Twist and Leo to CD into desktop.
18:52
Of course, that
18:55
now I want you to
18:56
be
19:06
Move along here,
19:12
Control C Control sees actually how you get out of any commander and commands not working. Or if you're running a ping command and you need Thio,
19:21
stop being commandos in limits. The Ping Command does not stop. It just keeps going, going going much like a dash T and Windows system will keep pinging. Being over and over again doesn't stop. So in this case, I'm trying to get to ripen. Do it do
19:34
Let's hear
19:37
those. Which Fowler directory.
19:55
Okay, so, um, it's not working for So this may be a red hat or a fedora. Sendoffs type specific command.
20:03
It depends on the legs. Destro. But this is a command that you can use another just rose that you can actually go and see how big or file it actually is. OK,
20:12
um so it's just one of the command,
20:15
Um,
20:17
and let's see here. Let's go to
20:21
P s command. Okay, this will give you a list of the process is running on your system.
20:26
So when we go back to route
20:30
okay and shows me the different processes that are running on my system right now,
20:33
process I d
20:36
you know, with different things. Okay. And what else? It seems well, good contenders kill command
20:42
kill, you know, implies death way. We're talking about process. I d Did you want to kill? A specific process is kind of like your tests passed, Manager. You can do in the command line
20:52
kill specific processes, but we're not gonna
20:56
Well, I couldn't do anything because we don't want to kill you know any of our specific processes? Que, um
21:02
no, let's try V. Find command.
21:11
Fine command. If I do, that's going to go through all the processes you can see. It's just going, going, going, going right? Because I did. If I find that I did a wild card of the asterisk there
21:23
still finding it Sze kind of absurd to do that is going through every single thing
21:29
on. Did you do this? I am buying by mistake and just hit the control, see? And it will stop it in its tracks. Right?
21:37
But those that's how you could do You could do a find process, and it will find it that you can do it. Kill it. You need to do that, and you can go go there, do those different commands. So there's there's some other commands. So let's look at some basic network commands. What if you want to find your i p address again, you talk if config
21:56
And that tells your I p address, etc. Rosier your network card, your network interface you confined there
22:03
you go with that. See what other commands you can use. Um, is
22:10
l s really Okay, this is this is listing your your files in your ownership of your file system. You could see the ownership here of your file systems.
22:21
So, uh, you're different files in your fastest. OK, so you can see in my directories here that bin directory and this is in a reed, right? Execute, read, right, Execute. And who could do what? We'll cover that later. In the permissions of file ownership section of this course.
22:36
This gives you an idea of what it's like, what it looks like.
22:38
Okay, with l s minus. L. A. Is gonna show you all the different
22:42
Who owns the fire? Who has rights for the files and who owns the files here? You could see that route is all the files.
22:49
Obviously, this would look a bit different. If you're in a larger organization where people have access to a shared directory,
22:56
you'll see that it would be a bunch of different user names with different, uh, different file names, different user names in different permissions for each file.
23:03
And again, Like I said, you can see here that these were actual these air, actually, the permissions
23:07
read, write and execute R W X. Okay, so they're some of the other commands that you can use.
23:15
Okay? And we're also gonna look at the
23:18
copy in the move command.
23:21
So I created my file again. This is gonna be a little bit more of this. Could be a little bit longer module. So are not part of this module. So if you need to take a break, by all means, take a break. I'm gonna keep going and stop and go back. Go forward if you need to, but we're gonna go on the next type commanded, uses a copy and move command. So it's gonna be CPI or
23:40
are in easy.
23:41
Okay, so I'm back to my test Lennix stocks. Let's go back and find that. So it is.
23:48
I'm in route so I'm gonna go back. Thio
23:52
Holy
23:55
and Sigh Berry.
24:00
Uh, I guess, Tom.
24:04
Okay,
24:07
Now I'm back to my home working many of my working drag my home working directory,
24:11
and I have my test legs up, So I'm gonna take my test folder. I'm actually gonna create another folder, full room, you name it
24:21
Test folder, too.
24:23
Okay.
24:26
And I want to move that dock into the test folder, right?
24:33
So don't do envy
24:36
again. This case since the test
24:41
burns,
24:41
doc.
24:42
Oops. Sorry.
24:56
And again. So Lenox doesn't like spaces in filings,
25:02
So
25:03
you know what I'm gonna do to make this easier. So when when you have a space and a file name, you have to put a backslash in its place. Otherwise, it will be able to read the file name. So to make this easier, I should do this in the first place. Won't go ahead and rename this file.
25:15
I'm just gonna rename without the spaces.
25:21
So my apologies on that. Let's just make it easier.
25:23
Well, this this would be something you might encounter with users in your organization.
25:29
And let's let's remove the spaces in the folder. She was just making it easy.
25:34
Oh, let's see here.
25:41
Now you can use underscores as well if you need to make it easier.
25:47
I tried to capitalize the first letter of every word.
25:56
So let's back this out.
25:57
Let's just do a list again. All right? So you could see the renamed there.
26:03
Let's see if that fixes, aren't you?
26:11
Yeah. Okay. So you can see that the Do command actually does work with this. It just needed to be the spaces were throwing off. Okay,
26:18
so that gives you an idea. This is 55 bites. Now, if I just do it, do
26:25
test.
26:27
Let's talk.
26:30
Yeah, is dead killed by so four kilobytes. Right. So what we need to do now is we want to move it. Okay, so we're gonna move and let's look at our
26:38
I guess we're going to move it from
26:41
desktop to one. File one file level up
26:45
to run to envy. In the name of the dock
26:48
test one. Thanks.
26:52
Two
26:53
slash home
26:55
flesh. Same brand.
26:57
Don't.
26:59
Now, you can see if you're watching on the desktop. It just disappeared
27:03
from the desktop. Worried to go. That's fine. We go. So let's go back or ah, PVT. Let's find out where we are. So let's go back. We'll run desktop by the sea needed It takes me back one level and now I'm back at the my heavy D is now home cyberia Admin. If I do a list, there's gonna be my document right there. Test leading stock.
27:22
So that's the way that you could move files files around in your file system in your in your directories.
27:27
Now, hold it. Copy. Want Take a copy of that document in place in a different directory. I want it back on the desktop. So I'm gonna do a CPI test winning stock too,
27:45
You see? Right now.
27:48
So one copy
27:49
test when he stopped, I want copy it to home
27:53
Cyberia. And then
27:59
and you can see that it appeared back there on the desktop.
28:02
So it's moving. Copy. Okay. And so I'm now, I want to go back to listing it,
28:07
and you can see that I'm
28:10
I'm still in cyber admin where I moved it originally. It's still there. There's now just a copy in desktop. So we go to see the desktop do list. You can see that testimony docks, test clinic stock is there. So we're going to move it into a folder. I can do that as well. I could do it. Move still. Copy what we'll do. Moves. You can see this pier.
28:30
So I'm in the desktop. Right? Go to move,
28:34
test.
28:37
Let it stop. You want to move it to
28:44
test folder
28:45
and it's disappeared again. Check.
28:48
Now. I want to go and, uh, list my directory test for some of CD into
28:55
test folder
28:56
when there's my document.
29:00
Conversely, I could just go over your test colder and double click on it. And there's the documents. Well,
29:04
so the ways that you can move around the file system was where she seem common
29:08
common commands they're gonna use day in and day up to get around the false system to make commands, et cetera. And what we're gonna do is we're gonna go ahead and wrap this one up, and we can talk a little bit more about the actual making of the directories and making the files. And another another
29:27
Montreuil that's gonna be model three and sister administration module.
29:32
But it gives you an idea of the power of the command line of what it could do for you how to use it, how to move around the file system. It's a very good tool to use, and if you get good at it, it's a very good skill set toe. Have
29:42
a lot of jobs out there require that you have some command line experience. So,
29:47
uh, take this module, Watch it over again. If you need to. Really just play around that, create your own files, try and move around. Try copying them. We're gonna go. We're gonna do some removing and deleting et cetera and one of the other in Module three and this administration module. You'll see what it's like that to remove
30:03
directories and files and and make them etcetera, so we'll get more into the system administration of it. You're gonna get some more good hands on
30:11
experience with it and play around the sorts. It's really at this point. Time should really have your own either live CD that you can play around with or your own isolation so you could do hands on labs
30:22
and we'll have some in module four for exam pressure preparation. When I put together some exam, some hands on lab exercise that you used to play around swell.
30:30
So that's it for now. Thanks for watching Hope you enjoyed it

Up Next

Fundamental Linux Administration

An open-source operating system modelled on UNIX, first released by Linus Torvalds in 1991. Why do I need this Certification? With the increasing popularity of cloud based systems and data centers, organizations need system administrators

Instructed By

Instructor Profile Image
Greg Stuart
Instructor