{"id":1775,"date":"2014-03-12T17:19:57","date_gmt":"2014-03-12T17:19:57","guid":{"rendered":"http:\/\/galhano.com\/blog\/?p=1775"},"modified":"2014-03-12T17:30:08","modified_gmt":"2014-03-12T17:30:08","slug":"edit-files-on-the-linux-command-line","status":"publish","type":"post","link":"http:\/\/galhano.com\/blog\/?p=1775","title":{"rendered":"Edit files on the linux command line"},"content":{"rendered":"<p>To edit files on the command line, you can use an editor such as vi. To open the file, run<br \/>\n[text]vi \/path\/to\/file[\/text]<br \/>\nNow you see the contents of the file (if there is any. Please note that the file is created if it does not exist yet.).<br \/>\nThe most important commands in vi are these:<br \/>\nPress <strong>i<\/strong> to enter the Insert mode. Now you can type in your text.<br \/>\nTo leave the Insert mode press <strong>ESC<\/strong>.<br \/>\nTo delete the character that is currently under the cursor you must press <strong>X<\/strong> (and you must not be in Insert mode because if you are you will insert the character x instead of deleting the character under the cursor). So if you have just opened the file with vi, you can immediately use <strong>x<\/strong> to delete characters. If you are in Insert mode you have to leave it first with <strong>ESC<\/strong>.<br \/>\nIf you have made changes and want to save the file, press <strong>: x<\/strong> (again you must not be in Insert mode. If you are, press ESC to leave it).<br \/>\nIf you haven&#8217;t made any changes, press <strong>:q<\/strong> to leave the file (but you must not be in Insert mode).<br \/>\nIf you have made changes, but want to leave the file without saving the changes, press <strong>:q!<\/strong> (but you must not be in Insert mode).<br \/>\nPlease note that during all these operations you can use your keyboard&#8217;s arrow keys to navigate the cursor through the text.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To edit files on the command line, you can use an editor such as vi. To open the file, run [text]vi \/path\/to\/file[\/text] Now you see the contents of the file (if there is any. Please note that the file is created if it does not exist yet.). The most important commands in vi are these: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"close","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,2],"tags":[],"class_list":["post-1775","post","type-post","status-publish","format-standard","hentry","category-linux","category-truques-dicas","author-admin"],"_links":{"self":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1775"}],"version-history":[{"count":6,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1775\/revisions"}],"predecessor-version":[{"id":1781,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1775\/revisions\/1781"}],"wp:attachment":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1775"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}