Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iot:labs:02 [2015/07/17 14:54]
madalina.tanea
iot:labs:02 [2017/09/11 09:33] (current)
alexandru.radovici created
Line 1: Line 1:
-===== Lab 02. Linux =====+====== Lab 2: Linux ======
 Embeded boards run Linux, this is why when interracting with them you might need some basic notions concerning this operating system in case you haven'​t come across it so far.  Embeded boards run Linux, this is why when interracting with them you might need some basic notions concerning this operating system in case you haven'​t come across it so far. 
  
Line 6: Line 6:
  
 The prompt also offers you some information. First of all, it shows you the user currently logged in. The user's name is that you see before //@//. It also shows the host name of your board. The prompt also offers you some information. First of all, it shows you the user currently logged in. The user's name is that you see before //@//. It also shows the host name of your board.
-The most important information the prompt displays is the working directory. That is the directory where you are currently working in. It is displayed right after the colon in the prompt. You will notice that the default working directory is //\url{~}//. That is the user's home directory and its equivalent is ///​home/​username//​.+The most important information the prompt displays is the working directory. That is the directory where you are currently working in. It is displayed right after the colon in the prompt. You will notice that the default working directory is //~//. That is the user's home directory and its equivalent is ///​home/​username//​.
 ===== Paths ===== ===== Paths =====
  
 In order to access a certain file or directory, you have to take into account the path to it. There are two different paths you can use: absolute and relative.\\ In order to access a certain file or directory, you have to take into account the path to it. There are two different paths you can use: absolute and relative.\\
-In Linux, the directories'​ structure is like a tree. The root directory is //\url{/}// and it contains all the other directories and files.\\+In Linux, the directories'​ structure is like a tree. The root directory is ///// and it contains all the other directories and files.\\
 If you use an absolute path to a file or a directory, that means that you build the path to it starting with the root directory. Thus, you can say that any path that starts with // / // is an absolute path.\\ If you use an absolute path to a file or a directory, that means that you build the path to it starting with the root directory. Thus, you can say that any path that starts with // / // is an absolute path.\\
 On the other hand, you can use a relative path, which means that you build it starting from the directory you are working in, your working directory. Thus, all the files and directories are relative to it.\\ On the other hand, you can use a relative path, which means that you build it starting from the directory you are working in, your working directory. Thus, all the files and directories are relative to it.\\
Line 17: Line 17:
   * .  - current directory   * .  - current directory
   * .. -parent directory   * .. -parent directory
-  * \url{~ - home directory (/​home/​username)+  * // //  - home directory (/​home/​username)
  
 ===== pwd ===== ===== pwd =====
Line 30: Line 30:
  
 You already know that once you open a Shell, the working directory is your home directory. However, you will need to work in other directories too. In order to change the working directory, you will have to use // cd// followed by the directory you want to go to.\\ You already know that once you open a Shell, the working directory is your home directory. However, you will need to work in other directories too. In order to change the working directory, you will have to use // cd// followed by the directory you want to go to.\\
-For example, if your home directory contains a directory called //​homework//​ and you want to have that as the working directory, you use //cd homework//. You can notice that you used an absolute path. Some other alternatives would be //cd /​home/​pi/​homework//​ or //cd \url{~}/​homework//​. In the last two examples you used an absolute path to refer to //​homework//​ directory.\\+For example, if your home directory contains a directory called //​homework//​ and you want to have that as the working directory, you use //cd homework//. You can notice that you used an absolute path. Some other alternatives would be //cd /​home/​pi/​homework//​ or //cd ~/​homework//​. In the last two examples you used an absolute path to refer to //​homework//​ directory.\\
  
 ===== cat===== ===== cat=====
Line 44: Line 44:
 By using the //htop// command you can see real-time all the processes that run on your board. Once you entered the command you will notice that the prompt does not appear, that is because you cannot enter another command until you are finished with displaying the processes. So, if you want to go back to what you were doing, just hit the //q// key. By using the //htop// command you can see real-time all the processes that run on your board. Once you entered the command you will notice that the prompt does not appear, that is because you cannot enter another command until you are finished with displaying the processes. So, if you want to go back to what you were doing, just hit the //q// key.
  
-{{ :iot:​labs:​htop.png?​300 |}}+{{ :iot2015:​labs:​htop.png?​500 |}}
 For each process displayed, you can see its PID (Process ID), the user who launched the process, how much CPU and memory it is using, the command that started the process and other information. For each process displayed, you can see its PID (Process ID), the user who launched the process, how much CPU and memory it is using, the command that started the process and other information.
  
Line 50: Line 50:
 ===== kill ===== ===== kill =====
  
-We know that you can use //htop// to find a process'​ ID in order to be able to interact with it. //kill// is the command that allows us to interact with another process.+You know that you can use //htop// to find a process'​ ID in order to be able to interact with it. //kill// is the command that allows us to interact with another process.
  
 Two processes can interact by using signals. A signal is a number a process sends to another. Both processes know that each number represents an action. you can refer to a signal either by the number or by its name. Two processes can interact by using signals. A signal is a number a process sends to another. Both processes know that each number represents an action. you can refer to a signal either by the number or by its name.
-{{ :iot:​labs:​kill.png?​300 |}}+{{ :iot2015:​labs:​kill.png?​500 |}}
  
 The format of the //kill// command is the following: //kill -signal pid//, where signal is the number representing the action you want to process to do and pid is the process ID. The format of the //kill// command is the following: //kill -signal pid//, where signal is the number representing the action you want to process to do and pid is the process ID.
Line 76: Line 76:
 ===== Exercises ===== ===== Exercises =====
  
-  - Create a new folder and a file inside it. Create a new folder. Move it inside the first folder and rename it. List the content of the first folder. Delete the first folder and its content using a single command. \\ **Hint** you can use the manual pages to find and understand the commands. Also use apropos to find the needed command (eg. $ apropos "copy files" )+  - Create a new folder ​// Folder1 // and a file inside it //My file //. Create a new folder ​// Folder 2//. Move it inside the first folder and rename it to // Folderception//​. List the content of Folder1. Delete the first folder and its content using a single command. \\ **Hint** you can use the manual pages to find and understand the commands. Also use apropos to find the needed command (eg. $ apropos "move files" )
   - Open a new project in Wyliodrin and run it. Find the process and its PID. Kill the process. \\ **Hint** Some commands may need root permissions to run. Using //sudo// in the beginning of the respective command gives you the needed permissions. ​   - Open a new project in Wyliodrin and run it. Find the process and its PID. Kill the process. \\ **Hint** Some commands may need root permissions to run. Using //sudo// in the beginning of the respective command gives you the needed permissions. ​
  
iot/labs/02.1437134051.txt.gz ยท Last modified: 2015/07/17 14:54 by madalina.tanea
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0