Do you want to develop skills to prototype embedded products using state-of-the-art technologies? In this course you will build a hardware and software development environment to guide your journey through the Internet of Things specialization courses. We will use the DragonBoard™ 410c single board computer (SBC).
This is the first in a series of courses where you will learn both the theory and get the hands-on development practice needed to prototype Internet of Things products. This course is suitable for a broad range of learners.
This course is for you if:
- You want to learn how to use learn how to use Linux for embedded purposes.
- You want to pivot your career towards the design and development of Internet of Things enabled products
- You are an entrepreneur, innovator or member of a DIY community
Learning Goals:
After completing this course, you will be able to:
1) Know where you can find resources and help in the 96Boards ecosystem.
2) Describe the DragonBoard™ 410c peripherals, I/O expansion capabilities, Compute (CPU and Graphics) capabilities, and Connectivity capabilities.
3) Understand how to navigate and make use of the Linux terminal.
4) Configure at least one integrated development environment (IDE) for developing software.
5) Make use of Git and GitHub for version control purposes.
6) Create and build projects that interface with sensors and actuators through GPIO and Arduino.

講師

Ganz Chockalingam

Principal Engineer

Harinath Garudadri

Associate Research Scientist

字幕

Hello, everyone. In this video we'll be discussing how to navigate through the Linux File Tools and System. So first off we go through a quick overview of everything we're going to talk about. First off we're going to go through some File tools essentially a command line basics and some basic commands just to navigate through the File system. Next, we're going to go through like how the terminal links to the desktop environment? And like how it connects to like a normal file manager? Like if you've ever gone through folders and files on a graphical interface, just how those two connect? And after that, we'll go through some terminal permission basics like whether or not, so each user has certain permissions and we're going to discuss how you can gain more access, more permissions to do more advanced stuff. After that section, we'll do talk about the File system and just generally what the structure is like. And it's an important directory use stash folders. And we're going to first start off with some few commands. The first command is ls and this basically lists all the files in the current directory. I'll be just showing us what this actually does in the file system? The first thing is if you guys haven't used the terminal before. You can get to it through the Start Menu and then go to System Tools. So this is the traditional File Manager, which is the Graphical Interface. And then you can use any of these terminals and just choose one. We're using Alex Terminal, well, we actually don't have it set up here. And that's what we're going to be doing ls. So when you first open up the terminal, this will be starting directory and you'll see most of everything here. You can ignore embedded programming and video and demo and sketchbook because that's just for the folders and directories that we've created. Then we can move onto the next command and teach you guys some more stuff. The next command is ls-la and this shows all the files in the current directory including hidden files and permissions. If we just do ls-la there's going to be a lot more like folders and files than you saw earlier. There's all these dot files, as you can see. The first one, the first dot file, will first discuss what the dot files are? Dot files are files and folders that start with a dot at the beginning of their name. So they won't show up traditionally it even in the File Manager or even in the terminal when you do ls. You actually have to do that extra part of that command that -la to make these all show up. So you can see there's a dot, that's stands for the current directory and there's a double dot. And then, that stands for the current directory. We will be demoing how to go through directories in the command after this. But you can see there's plenty of extra dot files and these are usually your configuration files or settings and stuff. But there's a lot more to the File system than we've seen. The next command that we all go over is cd and this is changing directories from one directory to another. Yeah, so as you can see, I'll just do ls again, so you can see all the folders. Actually that's old command. There we go, ls. And then you can see all the folders that we have. Now, let's say we want to go into the Video1Demo, we're going to just do that. And then we can just go in. So now, we're in the Video1Demo folder, I don't see everything inside. If we do the, as I said before, the two dots represent the current directory. So if we do cd dot dot, we'll go to the directory before us that we were just in. So as you can see that now we are in the old directory. Now, we want to go back to that one since that's where we'll be doing most of our work. One thing to know about these folders and directories, they're actually the same as if you're going through them on the File Manager. I'm sure you guys have experience going through folders and files on your own computer and just seeing all the folders clicking through. So we actually click into the same folder that we did before. We see the exact same files. You can see here the bashScript, the emptyFolder and a fileFolder and then we have hello.txt. All the same files are there. And if you go back you'll see everything is also the same Desktop, Documents, Downloads. There just to help you make that connection, we're going through the exact same File system. It's just a different way to access it. All right, so we can just continue on with the next command. The next command will be mkdir and this is just making a new folder or directory. Yeah. I'll show you a quick demo of just making a folder. So the way you use it is you do mkdir, so make directory and then you type the new name of the new folder you want to make. So press "Enter" and then you'll see anything yet, but if you type ls just use it out again, then you see the new folder and we just created it. And that's essentially what mkdir does. And you could also see it in the file explore if you click there, the same thing will appear there. If we go in here, I'll actually click go into it. You can see that this new folder has been created, the exact same one. So anything you do here, affects anything you see on there. The next command will be rm and this removes the file. I just remove a quick file first. Let's remove a hello.txt. And it's gone. You just do rm and then hello.txt. Now, you would think that you can just do rm and do the same thing with folders, we'll show you just what happens when you try to do that. It gives you an error. It says, it's a directory because this isn't the command that you're supposed to use to remove the directory. The next command we want to go over is rm-r and this removes a directory. Sometimes they'll ask for permissions if you just do rm-r because it contains files that you may not want to delete. You can either just click "Yes" for all of these or you can just type in rm-rf, which just forces the removal of that file. And this can be dangerous if you accidentally just remove a file using -rf, so just use whatever fits your needs. We just use rm-r and we try to remove the folder we just created. One thing to know is that the -rm means recursive, so that it has to move anything inside the folder. And then recursively removes the folder itself, so that we just continue all of this. And it's gone. So if you really want to delete something, you know how to do it now. We all go over cp, which is copying a file from one directory to another. And the way to do this is just cp followed by the two names. Let's say, I want to do, I want to copy this file, I call it a bashScript and I want to copy it to fileFolder. As you can see nothing happened during our home directory but the directory the we are currently working in. And if we go into the fileFolder we can see that exact same file that we created or that we copied over is there with the exact same thing. So I mean this would be like if you were copying, pasting stuff, you just use this command instead. The next command is a little different, its mv and this is moving a file from one directory to another. This is similar to cutting and pasting where the original copy will disappear. Let's say we want to move this bashScript and we want to move it to an empty directory. As you can see here, it actually disappeared because they actually moved into the empty directory or emptyFolder. And you can see there's two files here. On a side note, one other thing you can use mv for is renaming files. So we can rename this bashNew.sh and if we do not specify directory and just leave it here, it will actually just move the file to here with a new name. And as you can see here, that's a change the file name. Two important commands that you may want to get familiar with are sudo and su. And what sudo does is it allows the command to work in superuser mode. And what superuser mode is it just gives you full control over the File system. So you can think of this as running programs as administrator on Windows, if you're familiar with that. It's just the way to give you more power than what you have. And su is the same thing except every single command that you do after you press su and you type in su and enter will be in superuser mode. Yes. So, the way you would use sudo is you just do sudo. Let's say I want to move this file, I could either just do a move bashNew and just move it to whatever, let's say back one, it would just work the same. But the way you do sudo is any command you'll normally do, you add sudo to it, and you bashNew. So you choose a thing. You just literally append sudo to the front of any command you want to do that needs permissions or that you want to. So let's say I want to move it back or work exactly the same. In this case, we didn't necessarily need sudo because we aren't doing anything that we needed extra permissions for. Well, let's say we don't want to put sudo in front of every single command because we're going to be doing a lot of commands that need permissions. We can do sudo and then su. And now, let us enter Superuser mode. As you can see, our actual name changed from linaro li, the rest of that to our root@linaro. This is actually the name of the Superuser. So now, we are a Superuser. And we can exit Superuser mode by just typing exit. We'll go more into this command in a bit. And now, we are back at our normal user. So we'll be going over clear, and this is basically clearing all the contents of the terminal to back when you first started the terminal, which is just one line that says @linaro or whatever, that one thing. So here's the command in action. As you can see here, we have all of this clutter and it's not clean at all. It might be a little distracting. So a good command to use is clear. And I would just go straight back to the empty terminal screen and with just that one line. Personally, I think this is a little more relaxing because you just focus on that thing that you are working on. So I kind of use clear a lot. So we just go back to teach you more about some file tools. So we have which exit, which is exiting the terminal, if you're not in Superuser mode, but if you're in Superuser mode, the access to Superuser mode, as Simon showed earlier. Yeah. We won't be going over this now since we need the terminal more, but this is just a note. The next thing is bash scripts, and bash scripts just combine Unix commands into one file. It does it sequentially, so it would do the first command first, the second command second, and so forth. This is pretty useful when you're running the same five commands, or 10 commands every single day, and you don't want to do this every single day, so you just make a bash script, run this once, and you're set for that day, and you can do this every day, instead of running the five commands or 10 commands sequentially on your own. So Simon will show you how to do this. So the first thing we're going to do is actually go into the bash script and see where it is. Well, we won't be going this over now, but this is actually just like opening up a file and seeing its contents. So we'll just be using this command called vim and going in. So as you see here, this is just a plain text file or almost plain other than it's got the.sh extension. We start out with this thing called a shebang. It just identifies the script as a bash script. They're both duplicates of this type of shebang, but we just chose to use this one. So as you can see here, these are the exact commands that we would type in if we wanted to create like type it on ourselves like mkdir and then create a bash folder. Go into that folder. Make another one inside it. And then echo done running. So echo is actually another command that we won't go over, but essentially, as in you type in, it echoes back. So, as you can imagine, if I entered an echo done writing the scripts, it would just say, done writing the script. So now, we'll just exit, and then we will just run it. So the way you can run a bash script is just by running bash and then bashNew. And it says done running the bash script. Now, we can see the changes that we're gonna see createBashFolder. And then if we go inside here, it created another folder within that. So, if you do a lot of commands really often and they're pretty iterative you can just use bash scripts and come on there. We also want to show you how you could change the permissions of files that you saw before using the bash script. Yeah. So another way of executing bash scripts, as you can see on the terminal, is sometimes, you don't want to type in bash into the commands unless you want to just execute it. So on the terminal, we can see that we have bashNew. So I won't be explaining this too much. You won't need it currently. You do chmod and then +x and then bashNew. So what this does is it turns into an executable. So if you used the programs for a computer, you just have to double click thumb and then do run. So in the same sense, if you change submission to make it executable, it will make it so that you can just run it, you just essentially click it and run it. But in our file system, we don't want to click it. We have to execute it in this way. Also, you've noticed that it changed color to green. So green indicates that this is the executable script or executable program that in this way, you can execute it. And you do bashNew. Now, this is another way to do that same bash script, but instead of using bash, we just do this. It actually came into an error because it tried to create something that was already there. So we'll just show you guys how to do it again, cd Video. There we go. So I'll just show you guys how to do it again, but deleting everything inside here. So we use a command that we used to use before, rm -r. And this will cursor delete this folder and everything inside it. And as you can see, it's gone, and we'll just execute that bash script again. And it came out the same output and did the exact same thing. There it is. So we'll just go back to the slides and teach you more. So here are more tools that you can find about these Unix commands. We don't want to tell you guys that this is a forward tutorial on every single command. Every single command is a lot more complicated than we showed them to be. So make sure, if you guys want to learn more about these commands, to go on your favorite search engine or go on this website that we provided and learn about more. Yeah. So we'll have more links in the readings so that you can just go to them and they'll be constantly updated so that they're always good. So we will be going over the file system. And the file system comprises of multiple different directories starting from the root. And the root directory is basically the top of the hierarchy. It's where every single file and directory comes from. So if you keep doing cd.. cd.., you will eventually get to the root directory. The home directory is noted by the tilde side, the squiggly line. The home directory is the home directory of the user that you're signed up on. This is a little different than the home directory that's denoted by -home. And we'll talk about this in a little bit. -live is where all your library files from C and C++ or other language files may be. And the dev folder is where all your device drivers are located and these are useful for locating like cameras and other stuff that are connected through your ports, especially the USB. /media is for your memory folders and this is important for hard drives, so if you put in USB hard drive onto your DragonBoard or an SD card, you will most likely find a file in your media folder. And the -home folder is a little misleading, but the -home folder is basically showing you all the homes of all the users. So if you look at tilde, tilde is actually -home -linaro because you are signed up in linaro. And then there are a lot of other file system directories that we want you to go over, but these are all the basic file system directories that you start off with without you actually creating them. And another note is that if you want to work in this low-level directory system, then you have to use sudo or su because the permission is as a root. Yeah. Yeah. So a lot of the files are protected so that you don't mess with like some important files accidentally. You have to intentionally try to change them. Yeah. So the takeaway is that you can easily access files and folders through the terminal. Yeah. And anything you can do as a file explorer, like moving files, copying, creating a new text file, you can do everything on there on the terminal. So running commands as a Superuser is important. But remember to use it with caution. You don't want to mess things up like accidentally delete certain necessary Linux files because that means you can't do anything. Yeah. Yeah. So folder is in the root directory contain user files that are the user root directory. They're usually all created by the OS itself or if you install some files and then they try to create stuff there. Yeah. And we want you guys to use the file system as much as you can. Then we all see you guys next time. Yeah.