{"id":5515,"date":"2020-10-11T22:57:46","date_gmt":"2020-10-11T20:57:46","guid":{"rendered":"https:\/\/blue.pri.ee\/ttu\/?p=5515"},"modified":"2020-10-11T23:27:51","modified_gmt":"2020-10-11T21:27:51","slug":"week-7-linux-task","status":"publish","type":"post","link":"https:\/\/blue.pri.ee\/ttu\/labs\/week-7-linux-task\/","title":{"rendered":"Week 7 Linux task"},"content":{"rendered":"<p><strong>Download VIM configuration file<\/strong><br \/>\n1. Go to your home directory<\/p>\n<pre class=\"toolbar:2 nums:false lang:c highlight:0 decode:true\">cd ~<\/pre>\n<p>2. download the file<\/p>\n<pre class=\"toolbar:2 nums:false lang:c highlight:0 decode:true\">wget blue.pri.ee\/.vimrc<\/pre>\n<p><strong>Decide on where to put your program(s) for this lab.<\/strong><br \/>\ne.g. ~\/P\/IAX0583\/ or something similar. Make sure that folder exist, if necessary create a new folder.<br \/>\nUse <span class=\"lang:c highlight:0 decode:true crayon-inline \">cd<\/span>\u00a0 to navigate, <span class=\"lang:c highlight:0 decode:true crayon-inline \">mkdir<\/span>\u00a0 to create a directory<\/p>\n<p><strong>Download the archived test program<\/strong><\/p>\n<pre class=\"toolbar:2 nums:false lang:c highlight:0 decode:true\">wget blue.pri.ee\/week7.zip<\/pre>\n<p><strong>You need to unzip the file<\/strong><br \/>\nUse the program called <span class=\"lang:c highlight:0 decode:true crayon-inline\">unzip<\/span><\/p>\n<p><strong>You may need to manually make it executable<\/strong><br \/>\nYou use <span class=\"lang:c highlight:0 decode:true crayon-inline \">chmod<\/span>\u00a0 for this<\/p>\n<p><strong>Note:<\/strong> From this point on you can try to run the program provided. I recommend you try this out now! The program will stop when an unmet requirement is encountered.<\/p>\n<p><strong>Copy over an additional data file with the secret<\/strong><\/p>\n<p>Go to the M: folder (~\/M\/). Find your lecturer&#8217;s directory and go to it. In there you will find a hidden directory &#8211; go to it (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>Next up you need to create a file with your matricula<\/strong><\/p>\n<p>For this, go back to the folder with your lab files. For this one, I&#8217;ll provide two possible options.<\/p>\n<p><strong>Option 1:<\/strong> Open up your favourable 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.<\/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 actually would do. They would use the echo command and redirect the output streamto 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>Write another program that will print out &#8220;Hello world!&#8221;<\/strong><\/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 &#8220;-o hello&#8221; to specify the name of the program as &#8220;hello&#8221;<\/p>\n<p>Now run the test program that you downloaded from us. If everything was successful, you get a new file with instructions.<br \/>\nFollow the instructions or if necessary, fix the mistakes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download VIM configuration file 1. Go to your home directory cd ~ 2. download the file wget blue.pri.ee\/.vimrc Decide on where to put your program(s) for this lab. e.g. ~\/P\/IAX0583\/ or something similar. Make sure that folder exist, if necessary create a new folder. Use cd\u00a0 to navigate, mkdir\u00a0 to create a directory Download the &hellip; <a href=\"https:\/\/blue.pri.ee\/ttu\/labs\/week-7-linux-task\/\" class=\"more-link\">Loe edasi <span class=\"screen-reader-text\">Week 7 Linux task<\/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-5515","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\/5515","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=5515"}],"version-history":[{"count":0,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/5515\/revisions"}],"wp:attachment":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/media?parent=5515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/categories?post=5515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/tags?post=5515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}