{"id":9272,"date":"2015-03-27T19:30:23","date_gmt":"2015-03-27T19:30:23","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=9272"},"modified":"2015-03-27T19:30:23","modified_gmt":"2015-03-27T19:30:23","slug":"chmod-setting-a-file-read-only-in-linux","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/chmod-setting-a-file-read-only-in-linux\/","title":{"rendered":"chmod:  Setting a file read-only in Linux"},"content":{"rendered":"<h1>The tutor uses Linux and Windows both, so he tries to cover them equally.<\/h1>\n<p>&nbsp;<br \/>\nIn <a href=\"?p=9247\">yesterday&#8217;s post<\/a> I explained a way to set a file read-only in Windows.  Today, I do so for a Linux system.<\/p>\n<p>Linux has many flavours; I use Ubuntu.  I&#8217;m told that some more elite Linux users find Ubuntu &#8220;too easy to use &#8211; <em>anyone<\/em> can use it.&#8221;  (I&#8217;m sure the Ubuntu developers are only too happy to hear such criticism.)<\/p>\n<p>Although Ubuntu has a very user-friendly desktop, it also has the terminal.  The highbrow might be more comfortable there.  It&#8217;s the context I&#8217;m using today, because so far as I know, the terminal is common to all Linux users.<\/p>\n<p>Let&#8217;s imagine you&#8217;ve just finished a program called <span style=\"font-family:monospace\">prog0.txt<\/span>, which you&#8217;ve saved in your <span style=\"font-family:monospace\">scripts<\/span> directory.  You&#8217;ve tested it and you&#8217;re very pleased.  Naturally, you want to safeguard it from impetuous changes.<\/p>\n<p>Here&#8217;s how you can set it read-only:<\/p>\n<ol>\n<li>For simplicity&#8217;s sake, close the file first.<\/li>\n<li>In the terminal, navigate yourself into the <span style=\"font-family:monospace\">scripts<\/span> directory.<\/li>\n<li>Type the command <span style=\"font-family:monospace\">chmod 444 prog0.txt<\/span><\/li>\n<\/ol>\n<p>On Linux, the text editor I use is <strong>gedit<\/strong>.  When I open a read-only file in <strong>gedit<\/strong>, no indication appears that the file is read only.  However, when I try to make a change to the file, a read-only message appears across the top.  If I try to save any changes, I am forced to save them under a different file name.<\/p>\n<p>Besides this simple use, the <span style=\"font-family:monospace\">chmod<\/span> command has other capabilities.  I&#8217;ll be covering some of them in future posts:)<\/p>\n<p><em>Source:<\/em><\/p>\n<p>McGrath, Mike. <u>Linux in easy steps.<\/u>  Southam:  Computer Step, 2008.<\/p>\n<p>Jack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The tutor uses Linux and Windows both, so he tries to cover them equally. &nbsp; In yesterday&#8217;s post I explained a way to set a file read-only in Windows. Today, I do so for a Linux system. Linux has many &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/chmod-setting-a-file-read-only-in-linux\/\"> <span class=\"screen-reader-text\">chmod:  Setting a file read-only in Linux<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[633,181,637],"tags":[639,641,638,640,634],"class_list":["post-9272","post","type-post","status-publish","format-standard","hentry","category-academic-habits","category-lifestyle","category-linux","tag-chmod","tag-gedit","tag-how-to-set-a-file-read-only-linux","tag-linux-terminal","tag-read-only-files"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/9272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=9272"}],"version-history":[{"count":23,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/9272\/revisions"}],"predecessor-version":[{"id":9295,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/9272\/revisions\/9295"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=9272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=9272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=9272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}