1 00:00:00,090 --> 00:00:01,470 Hello, the beautiful people. 2 00:00:01,470 --> 00:00:06,980 And in this video, you're going to begin to use the command line to move around your Linux file system. 3 00:00:06,990 --> 00:00:08,570 Very, very exciting stuff. 4 00:00:08,580 --> 00:00:13,020 Now, once you learn the techniques that you'll learn over the next few videos and begin to use them 5 00:00:13,020 --> 00:00:18,210 for your everyday tasks, you'll begin to find that they are faster and more effective than the graphical 6 00:00:18,210 --> 00:00:21,360 point and click methods that you are most likely using right now. 7 00:00:21,360 --> 00:00:26,790 So in this video you're going to learn how to use the P and the less commands to know where you are 8 00:00:26,790 --> 00:00:28,800 on your file system and what is around you. 9 00:00:28,800 --> 00:00:32,670 And by the end of the video you'll know where you are on your file system and what's around you using 10 00:00:32,670 --> 00:00:36,990 the command line, and you'll be ready to start moving around using some other commands that I'll show 11 00:00:36,990 --> 00:00:38,190 you in the next video. 12 00:00:38,580 --> 00:00:40,170 So I hope you're very, very excited. 13 00:00:40,170 --> 00:00:42,540 Let's go ahead and jump right into it. 14 00:00:43,300 --> 00:00:43,610 Okay. 15 00:00:43,690 --> 00:00:45,280 So here we are in the terminal. 16 00:00:45,310 --> 00:00:49,560 Now, the first thing we'd like to know when navigating the file system is where we currently are. 17 00:00:49,570 --> 00:00:51,940 And the shell already tells us this. 18 00:00:52,120 --> 00:00:56,260 Over here on the left, you'll see a bunch of text that is known as your shell prompt. 19 00:00:56,260 --> 00:00:56,950 And the shell prompt. 20 00:00:56,950 --> 00:01:00,160 Is everything up to this dollar sign? 21 00:01:00,700 --> 00:01:02,730 Now let's break it down and show you what each bit means. 22 00:01:02,740 --> 00:01:07,120 First of all, it tells you the user of who is logged in, which is Zeyad on this computer. 23 00:01:07,150 --> 00:01:12,820 Then you've got an app symbol, then you've got the name of the computer, which is VB. 24 00:01:12,850 --> 00:01:18,220 We called it this when we set up an install the virtual machine and VB is short for virtual box, then 25 00:01:18,220 --> 00:01:23,320 you've got a colon, which is these two dots on top of one another, and then you have this squiggle 26 00:01:23,320 --> 00:01:25,170 that's called Tilde. 27 00:01:25,660 --> 00:01:30,730 Now in the bash shell, which is the shell that we're currently using, that tilde, that squiggle is 28 00:01:30,730 --> 00:01:34,510 a short way of representing the current user's home directory. 29 00:01:34,510 --> 00:01:39,880 So whenever you see that, Tilde, when you see that squiggle, it just means the path to the current 30 00:01:39,880 --> 00:01:41,320 user's home directory. 31 00:01:41,320 --> 00:01:47,260 So our shell prompt is basically telling us that we are in the home directory for the current user, 32 00:01:47,260 --> 00:01:49,270 which we can tell is Ziad. 33 00:01:50,200 --> 00:01:56,560 So we can actually confirm at any time what directory or what location our shell is currently operating 34 00:01:56,560 --> 00:01:59,020 in by using the P command. 35 00:01:59,080 --> 00:02:03,100 Now the P command stands for print working directory. 36 00:02:03,280 --> 00:02:06,990 The command will just tell us the folder that our shell is currently operating in. 37 00:02:07,000 --> 00:02:13,930 So if I type P and I hit Enter, we'll see the full path to my home directory appear, which is slash 38 00:02:13,930 --> 00:02:15,580 home slash Ziad. 39 00:02:16,420 --> 00:02:21,550 Now the path starts all the way from the root directory, the very base directory which is the slash 40 00:02:21,550 --> 00:02:26,560 and works its way down until we get to the home directory for the user, Ziad, which is me. 41 00:02:26,770 --> 00:02:30,870 Now we can actually see this if we click on our files and that opens up. 42 00:02:30,880 --> 00:02:34,690 Now if you click on other locations, then click on computer. 43 00:02:35,320 --> 00:02:38,500 This will open us up in the very base directory. 44 00:02:38,710 --> 00:02:41,110 This is the this is the base directory for the system. 45 00:02:41,420 --> 00:02:45,400 Now, if I click on home up here, then click on Ziad. 46 00:02:45,700 --> 00:02:49,570 That is where we currently are in the shell at the moment. 47 00:02:50,020 --> 00:02:56,050 Now, because the path starts all the way from the base directory, from the slash, it's known as an 48 00:02:56,050 --> 00:02:57,790 absolute path. 49 00:02:57,940 --> 00:03:02,470 So now that we know where we are and we know that our shell is operating inside of our home folder, 50 00:03:02,470 --> 00:03:05,290 how can we take a look around and see what's in the home folder? 51 00:03:05,320 --> 00:03:08,200 Well, first of all, we could do it using a graphical user interface. 52 00:03:08,200 --> 00:03:12,490 We could click on our files here, and that's automatically going to open us up in our home folder. 53 00:03:12,490 --> 00:03:19,390 And we can see this folders such as a desktop documents, downloads, pictures and so on and so on. 54 00:03:19,810 --> 00:03:24,700 Now to see something similar on the command line, we need to use the L. 55 00:03:24,700 --> 00:03:25,560 S command. 56 00:03:25,570 --> 00:03:31,390 Now the LS is short for list and the LS command will list out our files in the directory. 57 00:03:31,810 --> 00:03:38,650 So if we take a look at the main page for ls the manual page for ls will see that ls can take a path 58 00:03:38,650 --> 00:03:39,700 to some folders. 59 00:03:39,700 --> 00:03:46,150 It says here file says list information about the files, which is the current directory by default. 60 00:03:46,510 --> 00:03:52,270 As a side note, LS does not accept standard input, so you can't pipe to it and instead you need to 61 00:03:52,270 --> 00:03:54,610 give it everything as command line arguments. 62 00:03:55,360 --> 00:03:56,590 That's just an aside. 63 00:03:56,740 --> 00:03:56,940 Okay. 64 00:03:56,950 --> 00:04:02,240 So now let's try and use the LS to the command to see what's going on in our home directory. 65 00:04:02,260 --> 00:04:03,690 Now there's multiple ways to do this. 66 00:04:03,700 --> 00:04:08,110 I could do with the long way and I could give it the full absolute file path. 67 00:04:08,110 --> 00:04:12,180 I could type ls slash home slash Ziad. 68 00:04:12,520 --> 00:04:13,660 That's the long way to do it. 69 00:04:13,690 --> 00:04:17,220 Or because I know that the tilde represents my home folder. 70 00:04:17,230 --> 00:04:18,430 I could give it a shortcut. 71 00:04:18,430 --> 00:04:20,649 I could do ls then give it the tilde. 72 00:04:20,649 --> 00:04:22,270 And that's exactly the same thing. 73 00:04:22,270 --> 00:04:26,950 The tilde is just the home directory and for the current user it's just a shortcut. 74 00:04:27,160 --> 00:04:33,400 Or even better because I know LS will by default list out the contents of the folder that I'm currently 75 00:04:33,400 --> 00:04:33,850 in. 76 00:04:33,850 --> 00:04:42,580 And because I'm in my home folder I can just type ls ls will by default list out the contents of the 77 00:04:42,580 --> 00:04:44,080 directory that your shell is currently in. 78 00:04:44,080 --> 00:04:48,850 And because we're in our home folder, I can just do ls without any command line arguments. 79 00:04:48,850 --> 00:04:50,410 So let's go ahead and do that. 80 00:04:50,830 --> 00:04:51,640 There we go. 81 00:04:51,640 --> 00:04:57,580 So in there now what's come out, we can see several blue words now by default, blue text from the 82 00:04:57,580 --> 00:05:00,100 LS command indicates folders. 83 00:05:00,100 --> 00:05:05,380 But to make that clearer, we can we can give the LS command the uppercase F option. 84 00:05:05,380 --> 00:05:12,370 So we put a dash on an uppercase F and F is meant to mean classify with emphasis on the F. 85 00:05:12,790 --> 00:05:18,640 So now when I do that, if I do ls f now we can see that the items that have a slash at the end are 86 00:05:18,640 --> 00:05:19,390 folders. 87 00:05:20,920 --> 00:05:26,950 Now if I just make a file in our home directory by echoing the word hello into it, I'm going to call 88 00:05:26,950 --> 00:05:29,670 it file txt. 89 00:05:29,680 --> 00:05:31,840 So here we're using redirection to create the file. 90 00:05:31,840 --> 00:05:32,500 There it is. 91 00:05:32,770 --> 00:05:33,850 You can see there's been made. 92 00:05:33,850 --> 00:05:40,570 If I knew and if I now do ls dash f we can see that the folders all have slashes after them and are 93 00:05:40,570 --> 00:05:42,670 in blue, but the file itself doesn't. 94 00:05:42,750 --> 00:05:45,270 Have a slash after it and it's text is in white. 95 00:05:45,270 --> 00:05:51,060 So you can see that the LZ command allows us to see the difference between files and folders, files 96 00:05:51,060 --> 00:05:51,840 and directories. 97 00:05:53,430 --> 00:05:59,910 But something to bear in mind is if I take that LSB f output and put that into another file called list 98 00:06:00,150 --> 00:06:04,170 txt, then I open up a list of txt. 99 00:06:05,610 --> 00:06:14,130 You can see that there is no coloring, but you can see the difference between folders and folders and 100 00:06:14,130 --> 00:06:16,920 files just by looking for the things that end in slashes. 101 00:06:16,920 --> 00:06:21,360 Things that end in slashes are the folders and the things that don't are the files. 102 00:06:21,360 --> 00:06:25,800 So, you know, this is really good if you want to save the information to a file and be able to tell 103 00:06:25,800 --> 00:06:30,390 at a glance or have make a program tell at a glance, what's a folder and what's not. 104 00:06:30,390 --> 00:06:33,090 So you can selectively operate on specific files or not. 105 00:06:33,090 --> 00:06:34,470 So it's just a call it or shortcut. 106 00:06:34,500 --> 00:06:34,890 Okay. 107 00:06:35,040 --> 00:06:40,650 Now a much more useful option than the F than the F option for the LS command is the l option. 108 00:06:40,650 --> 00:06:44,580 Now if I do ls dash l actually let me clear the screen first. 109 00:06:44,580 --> 00:06:46,230 If I do ls dash l. 110 00:06:46,740 --> 00:06:51,450 This puts everything in long form format and you can tell here that we get a lot more information about 111 00:06:51,450 --> 00:06:55,410 our files and directories, including the file permissions over here on the left. 112 00:06:55,860 --> 00:07:00,540 Anything that starts with a D is a directory and then there's file permissions. 113 00:07:00,540 --> 00:07:07,710 So for the user read, write, execute for the group the user is in, the group being here is this column, 114 00:07:07,710 --> 00:07:08,580 the user is this column. 115 00:07:08,580 --> 00:07:12,600 So the user read, write, execute for the group, just read and execute. 116 00:07:12,630 --> 00:07:15,810 No writing and for everyone else just reading and executing. 117 00:07:16,650 --> 00:07:21,180 Then you've got the user that the the file belongs to the group. 118 00:07:21,180 --> 00:07:28,110 The file belongs to how large the file is when it was last edited and what the file is actually called. 119 00:07:28,110 --> 00:07:28,450 Okay. 120 00:07:28,590 --> 00:07:34,680 So this is a this is the LZ dash command is a command that you'll use probably very, very often because 121 00:07:34,680 --> 00:07:40,020 you can get a lot of information about your files, much more than just using the normal LS command. 122 00:07:40,410 --> 00:07:44,910 The other thing I should mention is that this column here with all the numbers in the file sizes, this 123 00:07:44,910 --> 00:07:47,370 shows the file size in bytes. 124 00:07:47,370 --> 00:07:52,350 And to make that a bit clearer, you can give the LS command, not only the L option, but also the 125 00:07:52,350 --> 00:07:53,250 Hatch option. 126 00:07:53,250 --> 00:07:55,440 And the Hatch option stands for human readable. 127 00:07:55,440 --> 00:07:58,140 It makes the file size a bit easier to read. 128 00:07:58,140 --> 00:08:04,230 So if we do ls dash l hatch, we can now see that it's telling us that the desktop thing is about four 129 00:08:04,230 --> 00:08:05,040 kilobytes. 130 00:08:05,040 --> 00:08:06,900 This is about four kilobytes. 131 00:08:07,260 --> 00:08:08,790 This one is just six bytes. 132 00:08:08,790 --> 00:08:10,890 This is 93 bytes and these are four kilobytes. 133 00:08:10,890 --> 00:08:15,930 If you had things that were megabytes in size, it would it would say an m If you had things that were 134 00:08:16,230 --> 00:08:18,120 gigabytes in size, it would say a G. 135 00:08:18,120 --> 00:08:20,940 And in general, it just makes this stuff a bit easier to read. 136 00:08:21,180 --> 00:08:23,520 So that's the dash with the with the L option. 137 00:08:23,520 --> 00:08:25,980 You've got the the permissions on the file. 138 00:08:25,980 --> 00:08:28,860 So it begins with a D, it's a directory, it begins with a dash. 139 00:08:28,860 --> 00:08:29,910 It's just a file. 140 00:08:29,940 --> 00:08:32,909 The first three things are the permissions for the user. 141 00:08:32,909 --> 00:08:34,559 Read, write, execute. 142 00:08:34,830 --> 00:08:39,990 The the next one is for the group that the that the file is in the in this case it just has read and 143 00:08:39,990 --> 00:08:40,770 execute but no. 144 00:08:40,770 --> 00:08:41,220 Right. 145 00:08:41,220 --> 00:08:43,559 And then this third column is for everyone else. 146 00:08:43,559 --> 00:08:46,110 This is the so just read and execute in that sense. 147 00:08:46,110 --> 00:08:48,090 This is the amount of hard links to the file. 148 00:08:48,090 --> 00:08:49,260 But don't worry about those. 149 00:08:49,260 --> 00:08:51,390 This is the user the file belongs to. 150 00:08:51,420 --> 00:08:53,820 This is the group the file belongs to. 151 00:08:53,850 --> 00:08:56,340 This is the file size in bytes. 152 00:08:56,340 --> 00:09:02,130 This is the date the file was last edited and then this is the file itself. 153 00:09:02,340 --> 00:09:06,090 So I'll make sure that that information is available on the cheat sheet at the end of the section. 154 00:09:06,090 --> 00:09:11,010 But now you can start to see if I clear the screen the we can now use the p command to see where we 155 00:09:11,010 --> 00:09:13,680 are and the RLS command to see what's around us. 156 00:09:13,680 --> 00:09:19,980 All that's left to be able to understand is how to use the command to actually change where we are on 157 00:09:19,980 --> 00:09:21,990 the file system so that we can move about. 158 00:09:22,470 --> 00:09:26,550 But I think in the interests of time, we're going to save that until the next video. 159 00:09:26,880 --> 00:09:31,080 So in the next video, we're going to be covering how to use the CD command to actually change where 160 00:09:31,080 --> 00:09:35,820 you are on the file system and also be going through a few examples to see how these three commands 161 00:09:35,820 --> 00:09:41,100 work together to help you navigate the file system much faster than would be possible using just pointing 162 00:09:41,100 --> 00:09:41,670 and clicking. 163 00:09:41,670 --> 00:09:44,820 So for all that goodness, I'll see you in the next video.