{"id":19755,"date":"2016-08-10T07:53:57","date_gmt":"2016-08-10T12:53:57","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=19755"},"modified":"2022-12-29T11:14:06","modified_gmt":"2022-12-29T17:14:06","slug":"how-to-create-and-edit-files-on-a-linux-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/","title":{"rendered":"How to create and edit files on a Linux VPS"},"content":{"rendered":"
<\/div>

\"create<\/p>\n

Creating or editing files is one of the most common tasks that system admins perform every day. In this tutorial we are going to show you how to create and edit files on a Linux VPS<\/a>.
\n<\/p>\n

Before we start, connect to your server via SSH<\/a> and make sure that you are familiar with your environment. For that purpose, you can use the basic shell commands<\/a> which were explained in one of our earlier blog posts. For example, you can create a new directory using the mkdir<\/code> command and navigate to that directory. Once you are navigated to the newly created directory, create your first file using the touch<\/code> command.<\/p>\n

touch new_file<\/pre>\n

The command above will create an empty file named new_file and you can use that file for testing purposes. To edit the file and add some content to it you can use a text editor. There are many text editors which you can use, but nano<\/code> is very suitable for beginners. Our recommendation is to use nano<\/code> as an text editor to modify your files until you become more familiar with the others. In case you do not have nano<\/code> installed on your system, you can use the command below to install the program:<\/p>\n

On a CentOS VPS<\/a>:<\/p>\n

sudo yum install nano<\/pre>\n

On an Ubuntu VPS<\/a>:<\/p>\n

sudo apt-get install nano<\/pre>\n

Now, to open and edit the file you have previously created you can use the following command:<\/p>\n

nano new_file<\/pre>\n

Enter some random text:<\/p>\n

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Illud dico, ea, quae dicat, praeclare inter se cohaerere. Nam aliquando posse recte fieri dicunt nulla expectata nec quaesita voluptate.<\/pre>\n

To save and close the file you should press CTRL + X<\/code> and then Y<\/code>. In case you do not like to save the changes you should press N<\/code> after CTRL + X<\/code>.<\/p>\n

Now that you have a test file with content on your server, lets see the content. There are many methods to see the content of a file, but by far the easiest method is to use the cat<\/code> command.<\/p>\n

cat new_file<\/pre>\n

Using the cat<\/code> command you can do many other things. For example, using the cat<\/code> command you can concatenate multiple files together or append text to an already existing file. For more information you can read the Linux man page for cat<\/code>.<\/p>\n

If you like to remove the file you created and used for testing purposes, you can use the rm<\/code> command. The basic syntax is:<\/p>\n

rm new_file<\/pre>\n

Once you execute the command you will be prompted to confirm that you like to remove the file. You can confirm by pressing Y<\/code>. If you changed your mind, press N<\/code>.<\/p>\n

Of course, you don\u2019t have to do any of this if you use one of our Linux VPS hosting services<\/a>, in which case you can simply ask our expert Linux admins to help you with any aspect of using your server. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

Creating or editing files is one of the most common tasks that system admins perform every day. In this tutorial … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":19756,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,13],"tags":[1336],"yoast_head":"\nHow to create and edit files on a Linux VPS - RoseHosting<\/title>\n<meta name=\"description\" content=\"How to create and edit files on a Linux VPS - RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create and edit files on a Linux VPS - RoseHosting\" \/>\n<meta property=\"og:description\" content=\"How to create and edit files on a Linux VPS - RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-10T12:53:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-29T17:14:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to create and edit files on a Linux VPS\",\"datePublished\":\"2016-08-10T12:53:57+00:00\",\"dateModified\":\"2022-12-29T17:14:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/\"},\"wordCount\":474,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png\",\"keywords\":[\"files\"],\"articleSection\":[\"Tips and Tricks\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/\",\"name\":\"How to create and edit files on a Linux VPS - RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png\",\"datePublished\":\"2016-08-10T12:53:57+00:00\",\"dateModified\":\"2022-12-29T17:14:06+00:00\",\"description\":\"How to create and edit files on a Linux VPS - RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png\",\"width\":1200,\"height\":600,\"caption\":\"create and edit files in linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create and edit files on a Linux VPS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create and edit files on a Linux VPS - RoseHosting","description":"How to create and edit files on a Linux VPS - RoseHosting","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:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/","og_locale":"en_US","og_type":"article","og_title":"How to create and edit files on a Linux VPS - RoseHosting","og_description":"How to create and edit files on a Linux VPS - RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2016-08-10T12:53:57+00:00","article_modified_time":"2022-12-29T17:14:06+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png","type":"image\/png"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to create and edit files on a Linux VPS","datePublished":"2016-08-10T12:53:57+00:00","dateModified":"2022-12-29T17:14:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/"},"wordCount":474,"commentCount":2,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png","keywords":["files"],"articleSection":["Tips and Tricks","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/","name":"How to create and edit files on a Linux VPS - RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png","datePublished":"2016-08-10T12:53:57+00:00","dateModified":"2022-12-29T17:14:06+00:00","description":"How to create and edit files on a Linux VPS - RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/07\/create-and-edit-files-in-linux.png","width":1200,"height":600,"caption":"create and edit files in linux"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-and-edit-files-on-a-linux-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create and edit files on a Linux VPS"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/19755"}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=19755"}],"version-history":[{"count":3,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/19755\/revisions"}],"predecessor-version":[{"id":42643,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/19755\/revisions\/42643"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/19756"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=19755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=19755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=19755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}