{"id":74,"date":"2020-01-29T12:59:35","date_gmt":"2020-01-29T11:59:35","guid":{"rendered":"https:\/\/codedoneright.eu\/?page_id=74"},"modified":"2021-01-02T13:52:57","modified_gmt":"2021-01-02T12:52:57","slug":"basic-commands","status":"publish","type":"page","link":"https:\/\/codedoneright.eu\/?page_id=74","title":{"rendered":"Basic commands"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png\" alt=\"Raspberry Pi logo\" width=\"100\" height=\"125\"\/><figcaption><a href=\"http:\/\/raspberrypi.org\">Raspberry Pi<\/a> logo<\/figcaption><\/figure><\/div>\n\n\n\n<p>This is the list of basic commands of the Command Line Interface (CLI) that you need to familiarize yourself with, in order to comfortably work on your server. <\/p>\n\n\n\n<p>RaspbianOS is a fork of <a href=\"https:\/\/www.debian.org\/\">GNU\/Linux Debian<\/a>, which means that commands are compatible between those systems, excluding Raspberry specific like <em>vcgenmod<\/em>.  If you need more help and examples of those commands then you can search for Debian topics as well, not only Raspbian. Moreover, one of the most popular distributions, Ubuntu, is also a fork of Debian which means that you can also search for help looking through Ubuntu tutorials. Although make sure the solution is applicable in your case, as it might be OS specific.<\/p>\n\n\n\n<p>In general, you should be able to use all tutorials on this site on a normal PC running Debian or Ubuntu. Who knows, maybe after learning a thing or two you will set up a more powerful home server runnung pure Debian?<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">List of basic commands<\/h4>\n\n\n\n<p>To the best of my abilities I will try to <a href=\"https:\/\/codedoneright.eu\/?page_id=205\">guide you<\/a> so that you will not have to research commands on your own, but just in case here is the list so that you know what said commands actually do. Sidenote, they all come with the system so you do not have to install additional packages.<\/p>\n\n\n\n<ul><li>man \u2013 shows manual entry for a given command, your most important command!<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>man apt<\/code><\/pre>\n\n\n\n<ul><li>sudo \u2013 act as <em>root<\/em>, needed for most work<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<ul><li>apt \u2013 used to install, remove or upgrade packages, either from repository or from a local directory, has other uses as well <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt upgrade<\/code><\/pre>\n\n\n\n<ul><li>ls \u2013 lists the contents of a directory<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ls \/var<\/code><\/pre>\n\n\n\n<ul><li>touch \u2013 create an empty file, can be used to alter save time of the file<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>touch ~\/some_file.txt<\/code><\/pre>\n\n\n\n<ul><li>cp \u2013 copy files or folders<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/home\/username\/mypage.html \/var\/www\/mypage.html<\/code><\/pre>\n\n\n\n<ul><li>mv \u2013 move, used for renaming as well<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mv ~\/my_file.txt ~\/my_file_with_new_name.txt<\/code><\/pre>\n\n\n\n<ul><li>wget \u2013 download a file to the current directory<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>wget http:\/\/wordpress.org\/latest.tar.gz<\/code><\/pre>\n\n\n\n<ul><li>chmod \u2013 change read, write and execute permissions of a file or folder<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod -R 775 \/var\/www\/mypage<\/code><\/pre>\n\n\n\n<ul><li>chown \u2013 change owner of a file or folder<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown -R www-data:www-data \/var\/www\/mypage<\/code><\/pre>\n\n\n\n<ul><li>adduser \u2013 add a user, creates home directory as well<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo adduser my_new_user<\/code><\/pre>\n\n\n\n<ul><li>removeuser \u2013 removes user, home directory remains<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo removeuser my_new_user<\/code><\/pre>\n\n\n\n<ul><li>reboot \u2013 reboots the system, requires root or sudo<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo reboot<\/code><\/pre>\n\n\n\n<ul><li>shutdown \u2013 shuts down the system so that it is safe to unplug power, do NOT just unplug the power supply as it may damage the SD card!<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo shutdown now<\/code><\/pre>\n\n\n\n<ul><li>dhclient \u2013 connect to network using DHCP  (not useful on RPi as it automatically connects, keeping it here for myself)<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>dhclient<\/code><\/pre>\n\n\n\n<ul><li>netstat -lntp \u2013 check ports on which active services are listening<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo netstat -lntp<\/code><\/pre>\n\n\n\n<ul><li>ping \u2013 test if a host can be reached, target has to have a ping client installed<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ping google.com<\/code><\/pre>\n\n\n\n<ul><li>Ctrl+C \u2013 keyboard shortcut to stop the current command, some commands will run until you tell them to stop, like <em>ping<\/em> for example, this will abort the command<\/li><\/ul>\n\n\n\n<p>My tutorials will assume you are using NANO text editor. It is installed with your system. Familiarize yourself with the following shortcuts, that are used in the editor. <strong>You will not be prompted to save and close files.<\/strong><\/p>\n\n\n\n<ul><li>Ctrl+x \u2013 Close file<\/li><li>Ctrl+o \u2013 Save file<\/li><li>Ctrl+k \u2013 Cut a line<\/li><li>Ctrl+u \u2013 Paste the cut line<\/li><li>Ctrl+SHIFT+v \u2013 Paste<\/li><\/ul>\n\n\n\n<p>For more information about basic commands visit <a href=\"https:\/\/wiki.debian.org\/coreutils\">Official Debian Wiki<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the list of basic commands of the Command Line Interface (CLI) that you need to familiarize yourself with, in order to comfortably work on your server. RaspbianOS is a fork of GNU\/Linux Debian, which means that commands are&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1026,"menu_order":1,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Basic commands used in linux &#8212; Code Done Right!<\/title>\n<meta name=\"description\" content=\"Before we even start working on our server we need to familiarize ourselves with few basic commands. Take a look just how small the list is!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codedoneright.eu\/?page_id=74\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Basic commands used in linux &#8212; Code Done Right!\" \/>\n<meta name=\"twitter:description\" content=\"Before we even start working on our server we need to familiarize ourselves with few basic commands. Take a look just how small the list is!\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=74\",\"url\":\"https:\/\/codedoneright.eu\/?page_id=74\",\"name\":\"Basic commands used in linux &#8212; Code Done Right!\",\"isPartOf\":{\"@id\":\"https:\/\/codedoneright.eu\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=74#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=74#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png\",\"datePublished\":\"2020-01-29T11:59:35+00:00\",\"dateModified\":\"2021-01-02T12:52:57+00:00\",\"description\":\"Before we even start working on our server we need to familiarize ourselves with few basic commands. Take a look just how small the list is!\",\"breadcrumb\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=74#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codedoneright.eu\/?page_id=74\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=74#primaryimage\",\"url\":\"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png\",\"contentUrl\":\"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=74#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codedoneright.eu\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\",\"item\":\"https:\/\/codedoneright.eu\/?page_id=1026\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Basic commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codedoneright.eu\/#website\",\"url\":\"https:\/\/codedoneright.eu\/\",\"name\":\"Code Done Right!\",\"description\":\"Raspberry Pi server guides\",\"publisher\":{\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codedoneright.eu\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568\",\"name\":\"CodeDoneRight\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png\",\"contentUrl\":\"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png\",\"width\":120,\"height\":120,\"caption\":\"CodeDoneRight\"},\"logo\":{\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/codedoneright.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Basic commands used in linux &#8212; Code Done Right!","description":"Before we even start working on our server we need to familiarize ourselves with few basic commands. Take a look just how small the list is!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codedoneright.eu\/?page_id=74","twitter_card":"summary_large_image","twitter_title":"Basic commands used in linux &#8212; Code Done Right!","twitter_description":"Before we even start working on our server we need to familiarize ourselves with few basic commands. Take a look just how small the list is!","twitter_image":"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/codedoneright.eu\/?page_id=74","url":"https:\/\/codedoneright.eu\/?page_id=74","name":"Basic commands used in linux &#8212; Code Done Right!","isPartOf":{"@id":"https:\/\/codedoneright.eu\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codedoneright.eu\/?page_id=74#primaryimage"},"image":{"@id":"https:\/\/codedoneright.eu\/?page_id=74#primaryimage"},"thumbnailUrl":"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png","datePublished":"2020-01-29T11:59:35+00:00","dateModified":"2021-01-02T12:52:57+00:00","description":"Before we even start working on our server we need to familiarize ourselves with few basic commands. Take a look just how small the list is!","breadcrumb":{"@id":"https:\/\/codedoneright.eu\/?page_id=74#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codedoneright.eu\/?page_id=74"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codedoneright.eu\/?page_id=74#primaryimage","url":"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png","contentUrl":"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/03\/RPi-Logo-Reg-SCREEN-199x250.png"},{"@type":"BreadcrumbList","@id":"https:\/\/codedoneright.eu\/?page_id=74#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codedoneright.eu\/"},{"@type":"ListItem","position":2,"name":"Linux","item":"https:\/\/codedoneright.eu\/?page_id=1026"},{"@type":"ListItem","position":3,"name":"Basic commands"}]},{"@type":"WebSite","@id":"https:\/\/codedoneright.eu\/#website","url":"https:\/\/codedoneright.eu\/","name":"Code Done Right!","description":"Raspberry Pi server guides","publisher":{"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codedoneright.eu\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568","name":"CodeDoneRight","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/","url":"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png","contentUrl":"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png","width":120,"height":120,"caption":"CodeDoneRight"},"logo":{"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/codedoneright.eu"]}]}},"_links":{"self":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/74"}],"collection":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":26,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/74\/revisions"}],"predecessor-version":[{"id":1388,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/74\/revisions\/1388"}],"up":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/1026"}],"wp:attachment":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}