{"id":21665,"date":"2016-06-02T10:23:01","date_gmt":"2016-06-02T10:23:01","guid":{"rendered":"http:\/\/randomnerdtutorials.com\/?p=21665"},"modified":"2019-04-02T10:23:32","modified_gmt":"2019-04-02T10:23:32","slug":"learning-basic-linux-commands-raspberry-pi-cheat-sheet","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/learning-basic-linux-commands-raspberry-pi-cheat-sheet\/","title":{"rendered":"Learning Basic Linux Commands &#8211; Raspberry Pi Cheat Sheet"},"content":{"rendered":"<p>A big part of using a Raspberry Pi is also using the terminal. The terminal is something that a lot of people try to avoid, because they feel like it is a bit hard to use.<\/p>\n<p><!--more--><\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-21681\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=699%2C495&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"699\" height=\"495\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?w=777&amp;quality=100&amp;strip=all&amp;ssl=1 777w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=150%2C106&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=300%2C212&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=768%2C544&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=80%2C57&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=220%2C156&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=141%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 141w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=212%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 212w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=336%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 336w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=586%2C415&amp;quality=100&amp;strip=all&amp;ssl=1 586w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?resize=688%2C487&amp;quality=100&amp;strip=all&amp;ssl=1 688w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/p>\n<p>But it doesn\u2019t need to be that that way, because in reality we can break it down to just a few basic commands that you need to know to do pretty much everything.<\/p>\n<p>After you learn these commands you\u2019ll hopefully feel really comfortable using the terminal. When you access the terminal through an SSH communication, you can install software on your Pi remotely, create files or folders and run any scripts directly from your computer.<\/p>\n<p>You also don\u2019t need to know all these commands by heart, you can always access this post\u00a0as a reference to remind how to do something.<\/p>\n<p>For this tutorial, I&#8217;ll be using a <a href=\"https:\/\/makeradvisor.com\/raspberry-pi-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">Raspberry Pi<\/a>\u00a0board with the Raspbian Lite Operating System installed.<\/p>\n<p><strong>Here&#8217;s the table of contents:<\/strong><\/p>\n<ul>\n<li>Exploring the Linux File System<\/li>\n<li>Editing Files using the Terminal<\/li>\n<li>Managing Software on Your Raspberry Pi<\/li>\n<li>Changing the Raspberry Pi Default Settings<\/li>\n<li>Shutting Down and Rebooting<\/li>\n<\/ul>\n<h2>Exploring the Linux File System<\/h2>\n<div class=\"single-post-content cf\">\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-21667\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=603%2C433&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"1_\" width=\"603\" height=\"433\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?w=603&amp;quality=100&amp;strip=all&amp;ssl=1 603w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=150%2C108&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=300%2C215&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=80%2C57&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=220%2C158&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=139%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 139w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=209%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 209w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=331%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 331w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/1_.png?resize=578%2C415&amp;quality=100&amp;strip=all&amp;ssl=1 578w\" sizes=\"(max-width: 603px) 100vw, 603px\" \/><\/p>\n<p>It\u2019s time to play around with the command line.<\/p>\n<p>For starters, type <em>pwd<\/em>, which means print working directory:<\/p>\n<pre>pi@raspberry:~ $ <strong>pwd<\/strong>\r\n\/home\/pi<\/pre>\n<p>The output is <em>\/home\/pi<\/em>. Forward slashes are\u00a0always used to indicate folders and files within other folders. In this case, the\u00a0current working directory is <em>pi<\/em>, which is inside <em>home<\/em>, which is inside\u00a0the root of the file system. Here, <em>pi\u00a0<\/em>is the username with which you are\u00a0logged in.<\/p>\n<p><strong>Note:<\/strong> The commands in Linux are case-sensitive, which means that PWD, PwD, pWd,\u00a0and any other variations are completely different from <em>pwd<\/em>. The same holds\u00a0true for all other commands and for any code written in the programming languages\u00a0addressed in this course.<\/p>\n<h3>Navigating the file system<\/h3>\n<p>The most frequent commands you will use are <em>ls<\/em> (list) and <em>cd<\/em> (change directory). They are used for listing the contents of a directory and moving from one directory to another.<\/p>\n<p>When you fi\u001frst open the terminal, it will open up in your home\u00a0folder (as you\u2019ve seen with the <em>pwd<\/em> command). You can display\u00a0exactly what kind of \u001ffiles or folders are in working directory with <em>ls<\/em>:<\/p>\n<pre>pi@raspberry:~ $ <strong>ls<\/strong><\/pre>\n<p>Right now your directory is empty, so you won\u2019t see anything when you try to list your files and folders.\u00a0Want to create a new folder? Use<em>mkdir<\/em> followed by the name\u00a0you want to give the folder:<\/p>\n<pre>pi@raspberry:~ $ <strong>mkdir NewFolder<\/strong>\r\npi@raspberry:~ $ <strong>ls<\/strong>\r\nNewFolder<\/pre>\n<p>To navigate, we\u2019ll be\u00a0using the <em>cd<\/em> command, followed by the location you want to move\u00a0to. This can be done like so:<\/p>\n<pre>pi@raspberry:~ $ <strong>cd NewFolder<\/strong>\r\npi@raspberry:~\/NewFolder $<\/pre>\n<p>This moved you to the <em>NewFolder\u00a0<\/em>directory that you just created.<\/p>\n<p>Here\u2019s one trick you can use so you don\u2019t have to remember\u00a0the exact name of the path \u2013 the command line or terminal will\u00a0try to autocomplete the phrase if you press the Tab key while\u00a0something is only partially typed. Try the <em>cd<\/em> command again (use<em> cd ..<\/em> to move up one directory):<\/p>\n<pre>pi@raspberry:~\/NewFolder $ <strong>cd ..<\/strong> \r\npi@raspberry:~ $ <strong>ls<\/strong> \r\nNewFolder<\/pre>\n<p>Now start writing your <em>cd<\/em> command again\u2026<\/p>\n<pre>pi@raspberry:~ $ <strong>cd NewF<\/strong><\/pre>\n<p>\u2026 by pressing Tab when you\u2019ve only written \u2018NewF\u2019 It will autocomplete the file path:<\/p>\n<pre>pi@raspberry:~ $ <strong>cd NewFolder<\/strong><\/pre>\n<p>Finally, there are some quick commands you can use to\u00a0manipulate \u001ffiles. Create a new file with the <em>touch<\/em> command:<\/p>\n<pre>pi@raspberry:~\/NewFolder $ <strong>touch NewFile.txt<\/strong>\r\npi@raspberry:~\/NewFolder $ <strong>ls<\/strong>\r\nNewFile.txt<\/pre>\n<p>Individual fi\u001fles can be copied using the command\u00a0<em>cp<\/em>, followed by the fi\u001fle name and you can also use this to rename \u001ffiles by doing:<\/p>\n<pre>pi@raspberry:~\/NewFolder $ <strong>cp NewFile.txt OtherFile.txt<\/strong>\r\npi@raspberry:~\/NewFolder $ <strong>ls<\/strong>\r\nNewFile.txt OtherFile.txt<\/pre>\n<p>The original \u001ffile can then be deleted by using the <em>rm<\/em> command followed by the file name:<\/p>\n<pre>pi@raspberry:~\/NewFolder $ <strong>rm NewFile.txt<\/strong>\r\npi@raspberry:~\/NewFolder $ <strong>ls<\/strong>\r\nOtherFile.txt<\/pre>\n<p>You can move files using the <em>mv<\/em> command:<\/p>\n<pre>pi@raspberry:~\/NewFolder $ <strong>mv OtherFile.txt \/home\/pi<\/strong>\r\npi@raspberry:~\/NewFolder $ <strong>cd ..<\/strong>\r\npi@raspberry:~\/NewFolder $ <strong>ls<\/strong>\r\nNewFolder OtherFile.txt<\/pre>\n<p>There\u2019s a lot more you can do with the command line, but these\u00a0are the very basics.<\/p>\n<p>As you use Linux more and more, you\u2019ll be\u00a0confronted with tasks that need the command line, and through\u00a0this process you\u2019ll learn just how much can be accomplished when\u00a0you work using the command line to manipulate files.<\/p>\n<h2 class=\"the-title\">Editing Files using the Terminal<\/h2>\n<div class=\"single-post-content cf\">\n<p>Nano\u00a0is\u00a0an easy to use text editor that is installed by default in Raspbian distribution\u00a0and many other Linux distributions.<\/p>\n<h3>Using\u00a0Nano<\/h3>\n<p>You can run nano by just typing in <em>nano<\/em> at the command prompt.<\/p>\n<p>You can use the following commands to edit the <em>OtherFile.txt<\/em> created in the previous Unit:<\/p>\n<pre>pi@raspberry:~ $ <strong>cd\r\n<\/strong>pi@raspberry:~ $ <strong>nano\u00a0OtherFile.txt<\/strong><\/pre>\n<p>Nano will follow the path and open that file if it exists. If it does not exist, it\u2019ll start a new buffer with that file name in that directory.<\/p>\n<p>Let\u2019s take a look at the default nano screen:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-21668\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=646%2C419&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"2_\" width=\"646\" height=\"419\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?w=646&amp;quality=100&amp;strip=all&amp;ssl=1 646w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=150%2C97&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=300%2C195&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=80%2C52&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=220%2C143&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=154%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 154w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=231%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 231w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=367%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 367w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/2_.png?resize=640%2C415&amp;quality=100&amp;strip=all&amp;ssl=1 640w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>At the top row, you\u2019ll see the name of the program version number, the name and extension of the file you\u2019re editing, and whether the file has been modified since it was last saved.<\/p>\n<p><strong>Note:<\/strong> If you have a new file that isn\u2019t saved yet, you\u2019ll see \u201cNew Buffer.\u201d<\/p>\n<p>Next, you\u2019ll see the contents of your file.<\/p>\n<p>Lastly, the final two rows at the bottom are the shortcut lines (as shown below).<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21669\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=646%2C53&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"3_\" width=\"646\" height=\"53\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?w=646&amp;quality=100&amp;strip=all&amp;ssl=1 646w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=150%2C12&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=300%2C25&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=80%2C7&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=220%2C18&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=250%2C21&amp;quality=100&amp;strip=all&amp;ssl=1 250w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=280%2C23&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/3_.png?resize=510%2C42&amp;quality=100&amp;strip=all&amp;ssl=1 510w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<h3>Shortcuts<\/h3>\n<p>Program functions are referred to as \u201cshortcuts\u201d in <em>nano<\/em>, such as saving, quitting, searching, etc. The most common ones are listed at the bottom of the screen (as shown in the preceding Figure), but there are many more that aren\u2019t.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Warning:<\/strong><\/span> nano does not use the Shift key in shortcuts. All shortcuts use lowercase letters and unmodified number keys, so Ctrl+G is NOT Ctrl+Shift+G.<\/p>\n<p>Press\u00a0Ctrl+G to bring up the Help menu\u00a0and scroll down with your arrow keys to see a list of valid shortcuts.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21670\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=1024%2C1001&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"4\" width=\"1024\" height=\"1001\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?w=1024&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=150%2C147&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=300%2C293&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=768%2C751&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=80%2C78&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=220%2C215&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=102%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 102w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=153%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 153w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=243%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 243w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=425%2C415&amp;quality=100&amp;strip=all&amp;ssl=1 425w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=498%2C487&amp;quality=100&amp;strip=all&amp;ssl=1 498w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/4.png?resize=609%2C595&amp;quality=100&amp;strip=all&amp;ssl=1 609w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>When you\u2019re done looking at the list, hit Ctrl+X to exit Help menu.<\/p>\n<p>Now let\u2019s say you\u2019re working on your text file and you want to save it and exit nano. This is executed by pressing\u00a0Ctrl+X.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21671\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=665%2C308&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"5\" width=\"665\" height=\"308\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?w=665&amp;quality=100&amp;strip=all&amp;ssl=1 665w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=150%2C69&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=300%2C139&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=80%2C37&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=220%2C102&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=216%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 216w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=280%2C130&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/5.png?resize=510%2C236&amp;quality=100&amp;strip=all&amp;ssl=1 510w\" sizes=\"(max-width: 665px) 100vw, 665px\" \/><\/p>\n<p>Nano will ask you if you want to save the changes, you can\u00a0type:<\/p>\n<ul>\n<li>Y, then Enter \u2013 to save all your changes<\/li>\n<li>N, then Enter- to cancel any changes<\/li>\n<\/ul>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21672\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=665%2C321&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"6\" width=\"665\" height=\"321\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?w=665&amp;quality=100&amp;strip=all&amp;ssl=1 665w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=150%2C72&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=300%2C145&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=80%2C39&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=220%2C106&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=207%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 207w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=280%2C135&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/6.png?resize=493%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 493w\" sizes=\"(max-width: 665px) 100vw, 665px\" \/><\/p>\n<p>This is a very brief tutorial that shows how to edit a file and save it using the nano program.<\/p>\n<p>The nano is way more powerful and has a lot of shortcuts that you can use to your advantage, but those go beyond what you need to know to complete this course. You can always refer to the official\u00a0<a href=\"http:\/\/www.nano-editor.org\/dist\/v2.5\/nano.html\" target=\"_blank\" rel=\"noopener noreferrer\">documentation<\/a>\u00a0or use the built-in Help menu.<\/p>\n<h2 class=\"the-title\">Managing Software on Your Raspberry Pi<\/h2>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21673\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=623%2C303&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"7\" width=\"623\" height=\"303\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?w=623&amp;quality=100&amp;strip=all&amp;ssl=1 623w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=150%2C73&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=300%2C146&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=80%2C39&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=220%2C107&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=206%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 206w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=280%2C136&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/7.png?resize=489%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 489w\" sizes=\"(max-width: 623px) 100vw, 623px\" \/><\/p>\n<p>When you know your way around the command line, downloading and\u00a0installing new software on a computer or device running the Linux OS is quite\u00a0easy and straightforward.<\/p>\n<p>The software comes in what are called packages \u2014\u00a0software programs that can be downloaded from the Internet and installed\u00a0simply by typing a command in the prompt.<\/p>\n<p>To download and install these packages, you normally use a package manager,\u00a0which downloads and installs not only the software you requested, but\u00a0also all other required software, known as dependencies.<\/p>\n<p>The Raspbian\u00a0distribution\u00a0uses a package manager called <em>apt<\/em>.<\/p>\n<p>To manage your software, you need the authorization of the administrator,\u00a0whom you already know as the superuser. To do so, type <em>sudo<\/em> (superuser do)\u00a0before a command.<\/p>\n<h3>Updating and Upgrading<\/h3>\n<p>First and foremost, you have to update the list of available package versions\u00a0that your package manager is aware of. (The package manager keeps such a\u00a0list in the Raspberry\u2019s\u00a0file system.) Type the following command:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo apt-get update<\/strong><\/pre>\n<p>You need to be connected to the Internet for this command to work.\u00a0Text scrolls by after you type the command, giving information about the\u00a0newest listings.<\/p>\n<p>Next, you should update the software, which you can achieve by commanding\u00a0apt to upgrade. This command upgrades all the packages you\u2019ve installed\u00a0to their most recent versions:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo apt-get upgrade<\/strong><\/pre>\n<p>In terms of wording, the difference between updating and upgrading is\u00a0subtle, but what they do is quite different (even though they\u2019re usually done\u00a0together).<\/p>\n<p><em>sudo apt-get update<\/em> updates the list of available package versions\u00a0but doesn\u2019t install or upgrade any of them, whereas <em>sudo apt-get\u00a0upgrade<\/em>updates the packages themselves, checking the list to do so. For\u00a0that reason, you should always run update before upgrade.<\/p>\n<h3>Installing software<\/h3>\n<p>To install a package for which you already know the name, you have to type\u00a0the following command:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo apt-get install &lt;desired application name&gt;<\/strong><\/pre>\n<h3>Running software<\/h3>\n<p>To run programs directly from the prompt, simply type their names, as\u00a0shown in the following command:<\/p>\n<pre>pi@raspberry:~ $ python<\/pre>\n<p>This opens the python interpreter that we are going to explore in the next Module.<\/p>\n<h3>Removing software<\/h3>\n<p>To remove software from your RPi, you resort once more to the apt\u00a0package manager. Here\u2019s an example:<\/p>\n<pre>pi@raspberry:~ $ sudo apt-get remove\u00a0<strong>&lt;desired application name&gt;<\/strong><\/pre>\n<p>This command, however, leaves behind files that are somehow related to the\u00a0software, such as configuration files and logs. If you don\u2019t intend to use those\u00a0files in any way, you can remove everything by using purge:<\/p>\n<pre>pi@raspberry:~ $ sudo apt-get purge\u00a0<strong>&lt;desired application name&gt;<\/strong><\/pre>\n<p>Do not remove any package that you didn\u2019t install yourself\u00a0unless you\u2019re absolutely certain that you know what it\u2019s for. It may be a\u00a0necessary package that comes with the Linux OS, and removing it may lead to\u00a0a system crash.<\/p>\n<h2 class=\"the-title\">Changing the Raspberry Pi Default Settings<\/h2>\n<div class=\"single-post-content cf\">\n<p>To change the the Raspberry Pi configurations you can use a tool written by\u00a0Alex Bradbury.\u00a0To open the configuration tool, simply run the following from the command line:<\/p>\n<pre>pi@raspberry:~ $ <strong><code>sudo raspi-config<\/code><\/strong><\/pre>\n<p>The <em>sudo <\/em>is required, because you will be changing files that you do not own as the <em>pi <\/em>user.<\/p>\n<p>You should see a blue screen with options in a grey box in the center:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=976%2C287&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"9\" width=\"976\" height=\"287\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?w=976&amp;quality=100&amp;strip=all&amp;ssl=1 976w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=150%2C44&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=300%2C88&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=768%2C226&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=80%2C24&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=220%2C65&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=250%2C74&amp;quality=100&amp;strip=all&amp;ssl=1 250w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=280%2C82&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=510%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 510w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=750%2C221&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/9.png?resize=975%2C287&amp;quality=100&amp;strip=all&amp;ssl=1 975w\" sizes=\"(max-width: 976px) 100vw, 976px\" \/><\/p>\n<p><strong>raspi-config<\/strong> aims to provide the functionality to make the most common configuration changes. keep in mind that some options require a reboot to take effect. If you changed any of those, raspi-config will ask if you wish to reboot now when you select the<strong>&lt;Finish&gt;<\/strong> button.<\/p>\n<p>It has the following options available:<\/p>\n<ol>\n<li>Expand Filesystem<\/li>\n<li>Change User Password<\/li>\n<li>Boot Options<\/li>\n<li>Wait for Network at Boot<\/li>\n<li>Internationalisation Options<\/li>\n<li>Enable Camera<\/li>\n<li>Add to Rastrack<\/li>\n<li>Overclock<\/li>\n<li>Advanced Options<\/li>\n<li>About raspi-config<\/li>\n<\/ol>\n<p>Most configurations are pretty self-explanatory and for this course\u00a0you only need to change one setting (as shown in the next section).<\/p>\n<h3>Expanding your file system<\/h3>\n<p>I recommend expanding your file system.<\/p>\n<p>Choosing option 1 from the raspi-config menu will expand your installation to fill the rest of the microSD card, giving you more space to use for files.<\/p>\n<p><strong>Note:<\/strong> you will need to reboot the Raspberry Pi to make this available. Note there is no confirmation; selecting the option begins the partition expansion immediately (as shown in the Figure below).<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21676\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=506%2C354&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"10\" width=\"506\" height=\"354\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?w=506&amp;quality=100&amp;strip=all&amp;ssl=1 506w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=150%2C105&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=300%2C210&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=80%2C56&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=220%2C154&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=143%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 143w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=214%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 214w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/10.png?resize=340%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 340w\" sizes=\"(max-width: 506px) 100vw, 506px\" \/><\/p>\n<p>Right now you don\u2019t need to change anything else.<\/p>\n<div id=\"wpcw_fe_outer_wrap\">\n<h2 class=\"the-title\">Shutting Down and Rebooting<\/h2>\n<div class=\"single-post-content cf\">\n<p>There are better ways to shut down and reboot your Raspberry Pi\u00a0than simply\u00a0unplugging it. Unplugging your RPi\u00a0is the equivalent\u00a0of shutting down your computer by pressing the power button or even\u00a0removing its power source, which can lead to\u00a0file corruption.<\/p>\n<p>To shut down your Raspberry Pi, simply type this command on the command\u00a0line:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo\u00a0poweroff<\/strong><\/pre>\n<p>You see the following information after you use the shutdown command:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21677\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=627%2C226&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"11\" width=\"627\" height=\"226\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?w=627&amp;quality=100&amp;strip=all&amp;ssl=1 627w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=150%2C54&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=300%2C108&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=80%2C29&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=220%2C79&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=250%2C90&amp;quality=100&amp;strip=all&amp;ssl=1 250w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=280%2C101&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/11.png?resize=510%2C184&amp;quality=100&amp;strip=all&amp;ssl=1 510w\" sizes=\"(max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>To reboot, type this:<\/p>\n<pre>pi@raspberry:~ $ <strong>sudo reboot<\/strong><\/pre>\n<p>This is the result:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21678\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=645%2C334&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"12\" width=\"645\" height=\"334\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?w=645&amp;quality=100&amp;strip=all&amp;ssl=1 645w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=150%2C78&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=300%2C155&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=80%2C41&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=220%2C114&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=193%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 193w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=280%2C145&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/12.png?resize=460%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 460w\" sizes=\"(max-width: 645px) 100vw, 645px\" \/><\/p>\n<p>You need to login again through SSH after rebooting.<\/p>\n<h2>Wrapping Up<\/h2>\n<p>I encourage you to bookmark this blog post, because you don\u2019t have\u00a0to know all these commands by heart.<\/p>\n<p><strong>I hope you like this\u00a0guide. Share it with a friend that will find it useful!<\/strong><\/p>\n<p>You can contact me by leaving a comment. If you like this post probably you might like my next ones (<a href=\"https:\/\/randomnerdtutorials.com\/download\" target=\"_blank\" rel=\"noopener noreferrer\">click here to subscribe my blog<\/a>).<\/p>\n<p>Thanks for reading,<\/p>\n<p>-Rui Santos<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A big part of using a Raspberry Pi is also using the terminal. The terminal is something that a lot of people try to avoid, because they feel like it &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Learning Basic Linux Commands &#8211; Raspberry Pi Cheat Sheet\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/learning-basic-linux-commands-raspberry-pi-cheat-sheet\/#more-21665\" aria-label=\"Read more about Learning Basic Linux Commands &#8211; Raspberry Pi Cheat Sheet\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":21681,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[301,269,264,268,190,192],"tags":[],"class_list":["post-21665","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-0-raspberrypi","category-guide-project","category-project","category-raspberry-pi-project","category-raspberry-pi","category-r-tutorials"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/featured-image.png?fit=777%2C550&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/21665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=21665"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/21665\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/21681"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=21665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=21665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=21665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}