1 00:00:00,000 --> 00:00:01,690 [No audio] 2 00:00:01,690 --> 00:00:03,178 System utility commands. 3 00:00:03,214 --> 00:00:06,162 These are very basic commands that 4 00:00:06,236 --> 00:00:09,550 are being used in Linux environment. 5 00:00:09,670 --> 00:00:12,214 Some of those commands are just like, in Windows 6 00:00:12,262 --> 00:00:13,918 we have time, we have calendar. 7 00:00:13,954 --> 00:00:15,894 Now Windows is a GUI environment and you 8 00:00:15,932 --> 00:00:19,074 could view those time and calculators and stuff 9 00:00:19,112 --> 00:00:21,466 like that by going to the accessories. 10 00:00:21,538 --> 00:00:23,418 But in Linux it's not possible. 11 00:00:23,564 --> 00:00:26,238 So that's why there are commands that are 12 00:00:26,264 --> 00:00:28,746 being built that tells you to the date, 13 00:00:28,928 --> 00:00:33,149 the uptime information, the hostname, the uname, 14 00:00:33,149 --> 00:00:36,018 then about the operating system, which means where 15 00:00:36,044 --> 00:00:39,858 the commands are located, the calculators, sorry, the 16 00:00:39,884 --> 00:00:43,630 calendar and the bc is binary calculators. 17 00:00:43,750 --> 00:00:46,054 Now let's look at our Linux machine 18 00:00:46,102 --> 00:00:48,426 and run these commands one by one. 19 00:00:48,608 --> 00:00:50,682 In Linux machine when you are logged in through the 20 00:00:50,696 --> 00:00:53,442 GUI, through the console, you'll see the time here. 21 00:00:53,516 --> 00:00:55,434 You also have the option to go into 22 00:00:55,472 --> 00:00:59,934 the applications and pull up the calendar and 23 00:01:00,032 --> 00:01:03,490 you'll see all the information that are automatically 24 00:01:03,550 --> 00:01:06,837 viewed without running any command. 25 00:01:06,934 --> 00:01:09,306 But what if you are logging in 26 00:01:09,428 --> 00:01:11,314 through the PuTTY or the terminal client? 27 00:01:11,362 --> 00:01:15,774 And as I said before, 98% of the time you will be 28 00:01:15,812 --> 00:01:19,842 logging in through the PuTTY client to the terminal where you're not 29 00:01:19,856 --> 00:01:22,810 going to be able to see all those GUI environment. 30 00:01:22,930 --> 00:01:24,798 So let's look at the view through the 31 00:01:24,824 --> 00:01:27,966 PuTTY. Again, we'll put in our IP address. 32 00:01:28,028 --> 00:01:35,310 It's 192.168.56.101, and I remember by now and 33 00:01:35,360 --> 00:01:37,218 if you don't, you could just simply go back 34 00:01:37,244 --> 00:01:41,682 to your console and type ifconfig, enter. 35 00:01:41,816 --> 00:01:44,742 And at the top right here, this is the IP address. 36 00:01:44,876 --> 00:01:46,614 You punch in that IP address right 37 00:01:46,652 --> 00:01:49,246 here and click on Open Terminal. 38 00:01:49,378 --> 00:01:51,500 It will open up, you login as yourself. 39 00:01:51,950 --> 00:01:55,734 Put in the password and you are logged in. 40 00:01:55,772 --> 00:01:57,966 Once you clear the screen, and you will see here 41 00:01:58,028 --> 00:02:03,934 there is nothing but the black terminal. So when you wanted to run, 42 00:02:04,032 --> 00:02:06,070 when you wanted to find out what time 43 00:02:06,120 --> 00:02:08,014 is it or what date it is, 44 00:02:08,112 --> 00:02:09,681 you just type date. 45 00:02:09,876 --> 00:02:11,978 It will tell you today is Tuesday, March 46 00:02:12,014 --> 00:02:19,022 13, the time and the second and Eastern 47 00:02:19,106 --> 00:02:21,754 Daylight Saving time and the year. 48 00:02:21,912 --> 00:02:24,382 So that's what the date command is used for. 49 00:02:24,456 --> 00:02:28,010 It's very simple, and sometimes the date command 50 00:02:28,070 --> 00:02:30,734 is used to combine with the script. 51 00:02:30,902 --> 00:02:33,362 So a script will wake up, it checks 52 00:02:33,386 --> 00:02:35,702 the date, and it will run certain scripts, 53 00:02:35,726 --> 00:02:37,750 we'll cover that in our scripting session. 54 00:02:38,310 --> 00:02:42,370 The next one is uptime. 55 00:02:43,170 --> 00:02:47,374 uptime simply tells you how long been the system 56 00:02:47,472 --> 00:02:51,734 up for, and how many users have been logged 57 00:02:51,782 --> 00:02:54,610 into the system, and the load average. 58 00:02:54,610 --> 00:03:04,990 [No audio] 59 00:03:04,990 --> 00:03:07,994 The next one, it tells us about the 60 00:03:08,032 --> 00:03:10,934 hostname, right here, the hostname. 61 00:03:10,972 --> 00:03:14,306 Let's move this little to the side. hostname, 62 00:03:14,368 --> 00:03:16,418 we could go back to our console, we could 63 00:03:16,444 --> 00:03:19,322 do the hostname, and you'll see this is 64 00:03:19,336 --> 00:03:22,010 the hostname of our Linux machine. 65 00:03:23,170 --> 00:03:27,834 And hostname is one of the important command 66 00:03:28,002 --> 00:03:30,650 that I would recommend you to run every 67 00:03:30,700 --> 00:03:32,318 time you log into the system, 68 00:03:32,464 --> 00:03:35,070 so you would know you are not logging 69 00:03:35,130 --> 00:03:37,646 into the wrong system, and you are not 70 00:03:37,708 --> 00:03:41,080 running very critical commands on the wrong system. 71 00:03:41,470 --> 00:03:42,818 You clear the screen. 72 00:03:42,964 --> 00:03:44,474 The next one we have uname. 73 00:03:44,512 --> 00:03:45,662 When you type uname, it will 74 00:03:45,676 --> 00:03:47,330 tell you it's a Linux machine. 75 00:03:48,070 --> 00:03:49,962 Again, in the Linux machine, 76 00:03:49,986 --> 00:03:52,610 you do need to run this command because sometimes 77 00:03:52,780 --> 00:03:55,770 in an environment you have Linux, you have Solaris, 78 00:03:55,830 --> 00:04:01,230 you have AIX, many different Unix flavors. 79 00:04:01,350 --> 00:04:03,206 So it's good to run uname. 80 00:04:03,268 --> 00:04:04,850 If you want to know more details about 81 00:04:04,900 --> 00:04:08,750 uname, you type uname -a. 82 00:04:08,860 --> 00:04:11,678 It will give you a lot more detail than just 83 00:04:11,704 --> 00:04:14,094 Linux. It will give you the hostname, the Kernel version, 84 00:04:14,202 --> 00:04:20,680 the time it was built, and other architecture information. 85 00:04:21,130 --> 00:04:24,726 The next command we need to learn is which. which command 86 00:04:24,798 --> 00:04:28,694 tells you the location of your command that you run. 87 00:04:28,792 --> 00:04:31,646 Let's say you run the command pwd, right? 88 00:04:31,828 --> 00:04:35,500 And it tells you that the command is 89 00:04:36,250 --> 00:04:39,038 telling you which directory you are in. 90 00:04:39,184 --> 00:04:41,850 So where is that command located? 91 00:04:41,970 --> 00:04:43,958 Of course, every command is a 92 00:04:43,984 --> 00:04:47,214 file itself, and it's located somewhere. 93 00:04:47,322 --> 00:04:51,402 To find out, you type which pwd, and it tells 94 00:04:51,426 --> 00:04:59,570 you this command pwd is located in /usr/bin/pwd. 95 00:04:59,890 --> 00:05:02,478 If you want to know more attributes about this command, 96 00:05:02,514 --> 00:05:08,402 you will run ls l-l /usr/bin/pwd, and you 97 00:05:08,416 --> 00:05:11,358 will see right here, this is the script 98 00:05:11,454 --> 00:05:14,310 actually, the command itself is a script. 99 00:05:14,430 --> 00:05:17,610 The script itself is a text file 100 00:05:17,730 --> 00:05:19,686 that has been written by developers. 101 00:05:19,818 --> 00:05:22,638 And it tells you right here it is owned 102 00:05:22,674 --> 00:05:25,638 by root, and the group is owned by root, 103 00:05:25,794 --> 00:05:30,714 and these are the permissions of this file. 104 00:05:30,762 --> 00:05:33,242 Everybody has the right to execute it. 105 00:05:33,316 --> 00:05:36,210 If I take this bit out, then I cannot 106 00:05:36,270 --> 00:05:38,826 run or nobody else can run this command. 107 00:05:38,958 --> 00:05:41,210 So this is what which command does. 108 00:05:41,320 --> 00:05:42,314 Let's clear this out. 109 00:05:42,352 --> 00:05:45,582 If you want to know where is date command located, 110 00:05:45,726 --> 00:05:48,974 date command is also located in /usr/bin/date. 111 00:05:49,132 --> 00:05:50,642 So, as you can see, most of 112 00:05:50,656 --> 00:05:54,050 the commands are located in /usr/bin. 113 00:05:54,850 --> 00:05:57,098 You do ls -l, and you 114 00:05:57,124 --> 00:05:58,878 see a whole bunch of commands. 115 00:05:58,914 --> 00:06:01,034 If you want to view one page at a time, you could 116 00:06:01,072 --> 00:06:04,562 do more, and you could see all these commands that we have. 117 00:06:04,636 --> 00:06:07,634 There are a bunch of commands that Linux has. 118 00:06:07,792 --> 00:06:09,698 What if I wanted to know how 119 00:06:09,724 --> 00:06:14,726 many total commands are in Linux? Very simple. 120 00:06:14,788 --> 00:06:17,066 You do ls -l and if you remember, 121 00:06:17,128 --> 00:06:19,970 you pipe it, you do wc -l. 122 00:06:20,080 --> 00:06:22,730 This would give me the total number 123 00:06:22,780 --> 00:06:25,322 of all these lines that are coming up. 124 00:06:25,516 --> 00:06:29,118 It's telling me there are 1597 commands 125 00:06:29,274 --> 00:06:32,630 that are inside of this Linux machine. 126 00:06:32,630 --> 00:06:36,050 [No audio] 127 00:06:36,050 --> 00:06:37,280 Moving on. 128 00:06:38,390 --> 00:06:41,254 What if I wanted to know calendar? 129 00:06:41,302 --> 00:06:43,854 If I just type cal, it will give me 130 00:06:43,892 --> 00:06:46,940 the calendar of this month and this year. 131 00:06:47,330 --> 00:06:51,718 What if I wanted to know the month when I was born 132 00:06:51,754 --> 00:07:01,338 let's say? For training I'll do cal, September 18, 1977. 133 00:07:01,424 --> 00:07:06,358 So I'll type September 9, sorry September which is a 134 00:07:06,444 --> 00:07:12,974 month, 1977, and it would give me, I could look at it, 135 00:07:13,012 --> 00:07:18,460 September 18 was Sunday, so you could type any 136 00:07:19,390 --> 00:07:22,466 month followed by the calendar. If you just wanted 137 00:07:22,528 --> 00:07:26,826 to know all the months in the year 2016. 138 00:07:26,898 --> 00:07:30,350 So you just type cal 2016 and it'll give you 139 00:07:30,400 --> 00:07:35,690 all those months starting with January ending in December. 140 00:07:36,130 --> 00:07:38,570 That's what the cal command is used for. 141 00:07:38,680 --> 00:07:40,969 Next command we have, let's clear this, 142 00:07:40,969 --> 00:07:44,394 bc. bc stands for binary calculator. 143 00:07:44,502 --> 00:07:46,730 If you want to do the calculation, of course 144 00:07:46,780 --> 00:07:49,842 you could go in here and bring the calculator. 145 00:07:49,986 --> 00:07:51,774 But you don't want to bring the calculator 146 00:07:51,822 --> 00:07:54,378 GUI mode, you are in terminal mode. 147 00:07:54,414 --> 00:07:56,250 So you wanted to use the calculator. 148 00:07:56,310 --> 00:07:59,800 Then what you do, you type again bc, hit Enter. 149 00:08:00,190 --> 00:08:04,454 Now if you want to do two plus two, hit Enter. 150 00:08:04,552 --> 00:08:05,546 It will give you four. 151 00:08:05,668 --> 00:08:13,120 What if 256 times 321? 152 00:08:13,570 --> 00:08:14,822 That's the answer. 153 00:08:15,016 --> 00:08:16,974 So this is just a basic calculator. 154 00:08:17,022 --> 00:08:18,618 You could do division, multiplication, 155 00:08:18,654 --> 00:08:19,658 or anything that you want. 156 00:08:19,684 --> 00:08:21,074 If you want to quit out of it, just 157 00:08:21,112 --> 00:08:24,482 type quit, and you will be out of it. 158 00:08:24,496 --> 00:08:26,754 So these are a few system utility 159 00:08:26,862 --> 00:08:29,714 commands and you could run that. 160 00:08:29,752 --> 00:08:33,520 These are fun commands, come up with the different options, 161 00:08:33,520 --> 00:08:36,025 and of course to look at the options, 162 00:08:36,207 --> 00:08:37,994 you could do man on every 163 00:08:38,032 --> 00:08:40,734 command and run with few options. 164 00:08:40,734 --> 00:08:43,626 [No audio]