{"id":1174,"date":"2023-11-22T00:00:00","date_gmt":"2023-11-22T05:00:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=1174"},"modified":"2023-11-29T17:16:56","modified_gmt":"2023-11-29T22:16:56","slug":"creating-empty-files-from-linux-command-line","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/creating-empty-files-from-linux-command-line\/","title":{"rendered":"Creating empty files from Linux command line"},"content":{"rendered":"\n<p>There are many ways to create an empty text file from command line. This post shows 3 ways.<\/p>\n\n\n\n<p><strong>To create empty file from Linux command line, you can use one of the following methods:<\/strong><br><strong>1. touch filename<\/strong><br><strong>2. vi filename and close file<\/strong><br><strong>3. echo &gt; filename<\/strong><\/p>\n\n\n\n<p>touch is a tool that comes packaged with Linux. It is often used to check if you have permissions to a certain file or directory. It can also be used to create a file. Suppose you want to create a file called events.txt:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>touch events.txt<\/code><\/pre>\n\n\n\n<p>That\u2019s it. If you have permissions to create a file in that location, an empty events.txt is created.<\/p>\n\n\n\n<p>vi editor can also be used to create events.txt as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ vi newfile<\/code><\/pre>\n\n\n\n<p>If you have permissions to create a file in that location, an empty events.txt is created.Then press&nbsp;<strong>Esc key<\/strong>&nbsp;followed by&nbsp;<strong>:wq<\/strong>. and an empty file would be created.<\/p>\n\n\n\n<p>echo can be used to create events.txt as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ echo > newfile.txt<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>There are many ways to create an empty text file from command line. This post shows 3 ways. To create empty file from Linux command line, you can use one of the following methods:1. touch filename2. vi filename and close file3. echo &gt; filename touch is a tool that comes packaged with Linux. It is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1190,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101,34],"tags":[383,393,392],"class_list":["post-1174","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bash","category-linux","tag-command-line-tips","tag-file-manipulation","tag-linux-command-line"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=1174"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1174\/revisions"}],"predecessor-version":[{"id":1175,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1174\/revisions\/1175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media\/1190"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=1174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=1174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=1174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}