{"id":6472,"date":"2021-11-18T18:31:01","date_gmt":"2021-11-18T16:31:01","guid":{"rendered":"https:\/\/blue.pri.ee\/ttu\/?p=6472"},"modified":"2025-11-21T11:05:09","modified_gmt":"2025-11-21T09:05:09","slug":"12-lab-linux","status":"publish","type":"post","link":"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/","title":{"rendered":"PR1EN12: Linux and CLI"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Lab_materials\" >Lab materials<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Help_on_commands\" >Help on commands<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#tldr_simplified_community-driven_man_pages\" >tldr (simplified community-driven man pages)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#man_pages\" >man pages<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Lab_tasks\" >Lab tasks<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Task_1_W12-1_working_on_the_command_line\" >Task 1 [W12-1]: working on the command line<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Pick_your_method\" >Pick your method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Solving_the_task\" >Solving the task<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Task_2_W12-2_W12-3_Filtering_logs_and_web_home\" >Task 2 [W12-2, W12-3]: Filtering logs and web home<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Input_data\" >Input data<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Filtering_data\" >Filtering data<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Submitting_the_task_base_and_extra\" >Submitting the task (base and extra)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Base_task_requirements\" >Base task requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Extra_task_requirements\" >Extra task requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Using_the_web_drive\" >Using the web drive<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/#Additional_content\" >Additional content<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Lab_materials\"><\/span>Lab materials<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>Slides: <a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/slaidid-en\/12_linux_cli.pdf\"><strong>Linux CLI<\/strong><\/a><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Help_on_commands\"><\/span>Help on commands<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you need help with some of the commands, there are three main ways to get information on the commands. Third and the slowest would be using the internet, so we&#8217;ll skip this one. The other two sources of information are available quickly from your command line<\/p>\n<h4><span class=\"ez-toc-section\" id=\"tldr_simplified_community-driven_man_pages\"><\/span>tldr (simplified community-driven man pages)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>This is a quick &#8220;handbook&#8221; composed by daily Linux users. It&#8217;s main purpose is to quickly and simply describe the most common ways to use each of the programs, as well as some less common, but important ones. The downside to this utility is that it often lacks detailed information and explanations, however it will get you the information you need or at least a starting point most of the time<\/p>\n<p>The tool does not come as default, but we have installed it on the lab computers.<\/p>\n<p>To use in the command line type <span class=\"lang:default highlight:0 decode:true crayon-inline \">tldr command<\/span><\/p>\n<p>Alternatively, you can use the web version from <strong><a href=\"https:\/\/tldr.sh\">https:\/\/tldr.sh<\/a><\/strong><\/p>\n<p>I.e.. to learn how to copy files, write <span class=\"lang:default highlight:0 decode:true crayon-inline\">tldr cp<\/span><\/p>\n<h4><span class=\"ez-toc-section\" id=\"man_pages\"><\/span>man pages<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>man stands for manual and comes native with Linux. It includes manuals for commands, libraries, system calls etc. It includes manuals on how to use most programs. To use a manual, just type <span class=\"lang:default highlight:0 decode:true crayon-inline \">man command<\/span>\u00a0.<\/p>\n<p>E.g. to check out how to copy files, you can run\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">man cp<\/span>.<\/p>\n<p>To close the manual, hit the letter\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">q<\/span> . To search within a manual, hit \u00a0<span class=\"lang:default highlight:0 decode:true crayon-inline\">\/<\/span> , followed by what you are searching from. All other hotkeys and additional help can be read by hitting the key\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">h<\/span> .<\/p>\n<p>The advantage of\u00a0<span class=\"lang:default highlight:0 decode:true crayon-inline\">man<\/span>\u00a0 compared to\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">tldr<\/span>\u00a0 is that its very detailed and has a variety of different types of information. This can also be a downside for new users, as they are very throughout and might discourage or even terrify new users.\u00a0 However, once you get used to reading information in this way, it becomes irreplaceable.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Lab_tasks\"><\/span>Lab tasks<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>There are two lab tasks this week. Both of them end up with a web form that you must fill! You do not need to present us your solutions after completion. Solutions are presented by filling out web based forms.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Task_1_W12-1_working_on_the_command_line\"><\/span>Task 1 [W12-1]: working on the command line<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>The following task will introduce you to the command line and some basics working on it.<\/p>\n<p>The task will end with a web form that must be filled. The submission of the web form confirms the completion of the task.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Pick_your_method\"><\/span>Pick your method<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>Before you can start solving you will need access to Linux and a terminal window. Some options that would work for this task:<\/p>\n<ol>\n<li>Solve the task in the lab computer<\/li>\n<li>Solve the task by using a remote desktop connection to the lab<br \/>\nGuide: <strong><a href=\"https:\/\/blue.pri.ee\/ttu\/resources\/software-setup-for-programming\/remote-access-using-rdp\/\">Remote access using RDP<\/a><\/strong><\/li>\n<li>Solve the task by connecting to the lab computers through an SSH tunnel<br \/>\nGuide: <strong><a href=\"https:\/\/blue.pri.ee\/ttu\/resources\/ssh-connection-guide\/\">SSH connection guide<\/a><\/strong><\/li>\n<\/ol>\n<p>Note: Don&#8217;t use your own Linux for this task as there are some parts of it that can only be done with the university mount points.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Solving_the_task\"><\/span>Solving the task<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>The task is written as a step-by-step workflow that you should follow. <strong>All actions should be done using the command line.<\/strong> In the end, you will need to submit your command history.\u00a0<strong>Prepare yourself enough time to solve the task 1 from start to finish<\/strong>, as you will need to submit your command history in the end of the task.<\/p>\n<p><strong>Step 1: Pick your working directory<\/strong><\/p>\n<p>In this step, you need to choose the location for the files that you will create during this lab. Most likely it should be somewhere on your P drive &#8211; i.e. <span class=\"lang:default highlight:0 decode:true crayon-inline\">~\/P\/iax0583\/lab11<\/span> .<\/p>\n<p>The following commands will help you navigate:<\/p>\n<ul>\n<li>Use\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">pwd<\/span>\u00a0 to check your current working directory<\/li>\n<li>Use <span class=\"lang:c highlight:0 decode:true crayon-inline\">cd<\/span>\u00a0 to navigate from and to directories<\/li>\n<li>Use\u00a0 <span class=\"lang:c highlight:0 decode:true crayon-inline\">mkdir<\/span>\u00a0 to create a directory<\/li>\n<li>Use\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">ls<\/span>\u00a0 to check the contents of the directory. Use additional arguments for more details.<\/li>\n<li>Use <span class=\"lang:c highlight:0 decode:true crayon-inline \">mv<\/span>\u00a0 to rename directories and files\u00a0 (if you happened to make a mistake)<\/li>\n<li>Use <span class=\"lang:c highlight:0 decode:true crayon-inline\">tldr command<\/span>\u00a0 and <span class=\"lang:c highlight:0 decode:true crayon-inline \">man command<\/span>\u00a0 to get help on the commands.<\/li>\n<\/ul>\n<p>Change the directory to the one you intend to solve your lab task<\/p>\n<p><strong>Step 2: Download the test program<\/strong><\/p>\n<p>The program <span class=\"lang:c highlight:0 decode:true crayon-inline \">wget<\/span>\u00a0 is most often used to download files off the internet. Use this to download a tester program by running the following command<\/p>\n<pre class=\"toolbar:2 nums:false lang:c highlight:0 decode:true\">wget blue.pri.ee\/lt_en.zip<\/pre>\n<p><strong>Step 3: Unpack the tester and execute it<\/strong><\/p>\n<p>You&#8217;ve just downloaded a zip archive. Use the program called <span class=\"lang:c highlight:0 decode:true crayon-inline\">unzip<\/span> to unpack it. First learn how to use it. Then pay close attention to the output that this program will give you in order to understand what was unpacked and where! Double-checking everything with <span class=\"lang:default highlight:0 decode:true crayon-inline \">ls<\/span>\u00a0 doesn&#8217;t hurt either. You need to understand <strong>what<\/strong> was unpacked and <strong>where<\/strong>!<\/p>\n<p><strong>You may need to manually make the test program executable<\/strong><\/p>\n<p>Once you have everything unpacked and found the testing program, you may need to add execute permission to it. Note, that it may also already be set by default.\u00a0If you need to add the execute permission, use <span class=\"lang:c highlight:0 decode:true crayon-inline\">chmod<\/span>\u00a0 to change file access permissions (including adding execution privilege)<\/p>\n<p><strong>Execute the testing program<\/strong><\/p>\n<p>From this point on you can try to run the program provided. <strong>Try it now! Execute the tester!<\/strong><\/p>\n<p>The program will stop when an unmet requirement is encountered. You should retry the testing program\u00a0 after every step from this point beyond.<\/p>\n<p>You should see the following output:<\/p>\n<pre class=\"toolbar:2 nums:false lang:c highlight:0 decode:true\">Hello user risto.heinsar\r\nYou seem to be from: risto-wk-tux\r\n\r\nStarting testing procedure!\r\n\r\nAttempting to check for VIM configuration!\r\nError! VIM configuration not found!\r\nExiting!<\/pre>\n<p>Execute the tester after each step in this task.<\/p>\n<p><strong>Step 4: Download VIM configuration file<\/strong><\/p>\n<p><strong>NB! You should skip this step if you already have one!<\/strong><\/p>\n<p>Vim is one of the more commonly used command line based text editors. It&#8217;s a lot more configurable and capable compared to basic text editors such as nano.<\/p>\n<p>Lets download a configuration file that will make it a little bit nicer. I.e. introduce syntax highlighting, automatic tabs etc. The file needs to be stored in your home folder &#8211; that&#8217;s were Vim will be looking for it.<\/p>\n<p>1. Go to your home directory. To do this, use the command <span class=\"lang:c highlight:0 decode:true crayon-inline \">cd<\/span> .\u00a0 Shorthand for your home directory is <span class=\"lang:c highlight:0 decode:true crayon-inline\">~<\/span><\/p>\n<p>2. Download the configuration file. Use <span class=\"lang:c highlight:0 decode:true crayon-inline \">wget<\/span>\u00a0 to download the following file: <span class=\"toolbar:2 nums:false lang:c highlight:0 decode:true crayon-inline\">blue.pri.ee\/.vimrc<\/span><\/p>\n<p>Use the tester to verify completion of this step!<\/p>\n<p><strong>Step 5: Copy over an additional data file with the secret<\/strong><\/p>\n<p>Go to the M folder in your home directory (~\/M\/). Find your lecturer&#8217;s public directory and go to it. In there you will find a hidden directory (it starts with a dot).<\/p>\n<p>Inside you will find a .dat file. Copy that file over to the same folder as the test program. For this you will need to use the <span class=\"lang:c highlight:0 decode:true crayon-inline \">cp<\/span>\u00a0 command. Specify the file you want to copy and the path you want to copy it to.<\/p>\n<p>To test if this worked, run the program and see if it finds the secret!<\/p>\n<p><strong>Step 6: Next up, you need to create a file with your matricula<\/strong><\/p>\n<p>The file you need to create is named <span class=\"lang:default highlight:0 decode:true crayon-inline \">matricula<\/span>\u00a0. It needs to be saved into the same folder as the rest of the files so far. To create it, I&#8217;ll provide two possible options.<\/p>\n<p><strong>Option 1:<\/strong> Open up your preferred command line text editor, write a file called &#8220;matricula&#8221;<\/p>\n<p style=\"padding-left: 40px;\"><strong>Vim guide:<\/strong><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Start by writing <span class=\"lang:c highlight:0 decode:true crayon-inline \">vim matricula<\/span>\u00a0 to create a file called matricula and open it in Vim.<\/li>\n<li>Press &#8217;i&#8217; to enter writing mode.<\/li>\n<li>Now write your matricula number into the file.<\/li>\n<li>Press &#8216;esc&#8217; to exit write mode.<\/li>\n<li>write <span class=\"lang:c highlight:0 decode:true crayon-inline \">:wq<\/span>\u00a0 in normal mode to write the file and exit<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Option 2:<\/strong> This is what most people who use terminal regularly would likely do. They would use the <span class=\"lang:default highlight:0 decode:true crayon-inline\">echo<\/span>\u00a0 command, that just prints the passed text back on the screen and then redirect that output to a file, e.g. <span class=\"lang:c highlight:0 decode:true crayon-inline\">echo &#8220;text&#8221; &gt; file<\/span><\/p>\n<p><strong>Step 7: Write a program that prints &#8220;Hello world!&#8221;<\/strong><\/p>\n<p>NB! Before continuing, remind yourself what is a file extension. What extension is used by C source code and what is used by programs!<\/p>\n<p>Again use a command line text editor. We recommend Vim, as it supports C code, but you can use any other editor as well.<\/p>\n<p>Once done, compile the program. Use <span class=\"lang:default highlight:0 decode:true crayon-inline\">-o hello<\/span>\u00a0 to specify the output (name of the program) as &#8220;hello&#8221;.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>NB! Do not write the name of your source code file after -o. This will overwrite your source code!<\/strong><\/span><\/p>\n<p>Now run the test program that you downloaded from us. If everything was successful, it will create a new file with instructions.<br \/>\nFollow those instructions to complete the task.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Task_2_W12-2_W12-3_Filtering_logs_and_web_home\"><\/span>Task 2 [W12-2, W12-3]: Filtering logs and web home<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>In this task we will look at a tool that is widely used for digging through large amounts of data. We will also take a look at piping the standard output stream of one program into the standard input stream of another program. Lastly, we&#8217;ll do a quick introduction to your web home.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Input_data\"><\/span>Input data<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>I&#8217;ve generated a file with someone random data that would simulate a log file from a robot. These kind of log files are typically extremely long. Usually we only look into them when something goes wrong and even then we are usually interested in only a fraction of what it contains.<\/p>\n<p>Log file is at my web home: <strong><a href=\"http:\/\/www.tud.ttu.ee\/web\/Risto.Heinsar\/sensors.txt\">http:\/\/www.tud.ttu.ee\/web\/Risto.Heinsar\/sensors.txt<\/a><\/strong><\/p>\n<h5><span class=\"ez-toc-section\" id=\"Filtering_data\"><\/span>Filtering data<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>To filter long text files we use a tool called <span class=\"lang:default highlight:0 decode:true crayon-inline \">grep<\/span> . Grep is a pattern matching tool that will try to match entered the pattern and print all the lines containing it. Other lines will be skipped.<\/p>\n<p>The patterns can be simple such as a single letter words or part of a string, e.g.\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">SENSOR<\/span> , <span class=\"lang:default highlight:0 decode:true crayon-inline\">ERROR<\/span> , <span class=\"lang:default highlight:0 decode:true crayon-inline\">firefox<\/span> etc. In this case we would run the program as\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">grep pattern<\/span>\u00a0.<\/p>\n<p>The patterns can also be more complex, containing regular expressions. To enable the use of regular expressions, we add a an argument <span class=\"lang:default highlight:0 decode:true crayon-inline \">-E<\/span>\u00a0 when executing. E.g.\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">grep -E sensor[1-3]:<\/span>\u00a0 will display us all the lines containing either\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">sensor1:<\/span> , <span class=\"lang:default highlight:0 decode:true crayon-inline \">sensor2:<\/span>\u00a0 or <span class=\"lang:default highlight:0 decode:true crayon-inline\">sensor3:<\/span> . Notice that the colon was also included in the pattern.<\/p>\n<p>You can test your regular expressions here: <strong><a href=\"https:\/\/regex101.com\">https:\/\/regex101.com<\/a><\/strong><\/p>\n<p>Hint 1: You can grep the output of grep again &#8211; you don&#8217;t need to do everything with one execution if that is too difficult. Though you should definitely try!<\/p>\n<p>Hint 2: the output of grep can be written to a file using output stream redirection.<\/p>\n<p>Hint 3: You can also do regular expressions that include logical operations (e.g. one or the other).<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Submitting_the_task_base_and_extra\"><\/span>Submitting the task (base and extra)<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<ol>\n<li>Decide whether you wish to solve the base or extra task and solve it.<\/li>\n<li>Copy the resulting output file to your web home and figure out the public address of it<\/li>\n<li>Fill the following web form: <strong><a href=\"https:\/\/forms.office.com\/r\/kb72jTqeXu\">https:\/\/forms.office.com\/r\/kb72jTqeXu<\/a><\/strong><\/li>\n<\/ol>\n<p>NB! If you have technical issues with the web home, let us know after filling out the form. Show us the location of your file and the addresses you tried.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Base_task_requirements\"><\/span>Base task requirements<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>Your task is to find all the lines in the file given by me which have the severity level of ERROR and which are related to the sensor number derived from your matricula number using the formula <span class=\"lang:default highlight:0 decode:true crayon-inline \">matricula % 10<\/span>\u00a0.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>Student code 123456IACB -&gt; matricula 123456.<br \/>\n123456 % 6 is 6<\/p>\n<p>So the output has to be about SENSOR6. Some examples:<\/p>\n<pre class=\"toolbar:2 lang:default highlight:0 decode:true\">Mar 14 03:53:34 ERROR: SENSOR6: No response within hard limit!\r\nMar 14 03:54:19 ERROR: SENSOR6: No response within hard limit!<\/pre>\n<p>The task can be solved either in one go or in parts &#8211; it&#8217;s up to you.<\/p>\n<p>Write this output to a text file using stream redirection. The name of the created file should be your student_code.txt. E.g. if your student code is 123456IACB, then your file name should be called 123456iacb.txt.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Extra_task_requirements\"><\/span>Extra task requirements<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>Your task is to find all lines containing the severity level ERROR. The lines you are looking for should contain the sensors <span class=\"lang:default highlight:0 decode:true crayon-inline \">matricula % 10<\/span>\u00a0 and motor number <span class=\"lang:default highlight:0 decode:true crayon-inline \">matricula % 4<\/span>\u00a0.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>Student code 123456IACB, matricula 123456<br \/>\n123456 % 10 -&gt; 6<br \/>\n123456 % 4 -&gt; 0<\/p>\n<p>This means we are looking for SENSOR6 and MOTOR0. Some examples of the lines:<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">Mar 14 03:51:46 ERROR: MOTOR0: Temperature critical! (104 C, LIMIT: 90 C)\r\nMar 14 03:53:34 ERROR: SENSOR6: No response within hard limit!\r\nMar 14 03:54:19 ERROR: SENSOR6: No response within hard limit!\r\nMar 14 04:04:09 ERROR: MOTOR0: No response within hard limit!<\/pre>\n<p>The task can be solved either in one go or in parts &#8211; it&#8217;s up to you.<\/p>\n<p>Write this output to a text file using stream redirection. The name of the created file should be your student_code.txt. E.g. if your student code is 123456IACB, then your file name should be called 123456iacb.txt.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Using_the_web_drive\"><\/span>Using the web drive<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>All students have their own web drive where they can hold and publish simple web pages and files. It&#8217;s the W drive. Copy the output of your filtered data to that drive.<\/p>\n<p>More information on the web drive (Estonian only): <strong><a href=\"https:\/\/taltech.atlassian.net\/wiki\/spaces\/ITI\/pages\/38994529\/li+pilase+veebikataloog+Online+student+directory\">https:\/\/taltech.atlassian.net\/wiki\/spaces\/ITI\/pages\/38994529\/li+pilase+veebikataloog+Online+student+directory<\/a><\/strong><\/p>\n<p>Copy the resulting file to your web drive. You can use <span class=\"lang:default highlight:0 decode:true crayon-inline \">cp<\/span>\u00a0 to copy files.<\/p>\n<p>Now the file should be accessible under one of the following links:<\/p>\n<ul>\n<li>http:\/\/www.tud.ttu.ee\/web\/uni-id\/student_code.txt<\/li>\n<li>http:\/\/www.tud.ttu.ee\/web\/Firstname.Lastname\/student_code.txt<\/li>\n<\/ul>\n<p>Now fill out the form!<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Additional_content\"><\/span>Additional content<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>Linux manual pages online<br \/>\n<strong><a href=\"https:\/\/www.man7.org\/linux\/man-pages\/index.html\">https:\/\/www.man7.org\/linux\/man-pages\/index.html<\/a><\/strong><\/li>\n<li>tldr pages<br \/>\n<strong><a href=\"https:\/\/tldr.sh\">https:\/\/tldr.sh<\/a><\/strong><\/li>\n<li>A taste of Linux (introduction to Linux CLI)<br \/>\n<strong><a href=\"https:\/\/www.youtube.com\/watch?v=AG4A5C_k4Xo\">https:\/\/www.youtube.com\/watch?v=AG4A5C_k4Xo<\/a><\/strong><\/li>\n<li>Linux directory structure<br \/>\n<strong><a href=\"https:\/\/www.geeksforgeeks.org\/linux-directory-structure\/\">https:\/\/www.geeksforgeeks.org\/linux-directory-structure\/<\/a><\/strong><\/li>\n<li>Practical grep examples<br \/>\n<strong><a href=\"https:\/\/www.thegeekstuff.com\/2009\/03\/15-practical-unix-grep-command-examples\/\">https:\/\/www.thegeekstuff.com\/2009\/03\/15-practical-unix-grep-command-examples\/<\/a><\/strong><\/li>\n<li>Introduction to Linux training<br \/>\n<strong><a href=\"https:\/\/training.linuxfoundation.org\/training\/introduction-to-linux\/\">https:\/\/training.linuxfoundation.org\/training\/introduction-to-linux\/<\/a><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Lab materials Slides: Linux CLI Help on commands If you need help with some of the commands, there are three main ways to get information on the commands. Third and the slowest would be using the internet, so we&#8217;ll skip this one. The other two sources of information are available quickly from your command line &hellip; <a href=\"https:\/\/blue.pri.ee\/ttu\/labs\/12-lab-linux\/\" class=\"more-link\">Loe edasi <span class=\"screen-reader-text\">PR1EN12: Linux and CLI<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75,77],"tags":[],"class_list":["post-6472","post","type-post","status-publish","format-standard","hentry","category-labs","category-pr1_en"],"_links":{"self":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/6472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/comments?post=6472"}],"version-history":[{"count":9,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/6472\/revisions"}],"predecessor-version":[{"id":10914,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/6472\/revisions\/10914"}],"wp:attachment":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/media?parent=6472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/categories?post=6472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/tags?post=6472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}