Create New Document Templates for Linux

How to add Create New- right click options in Linux, and how to get it back if it goes missing.

1356 views

Edited: 2017-05-17 19:29

  • Download

Download the template files and place them in your /home/Your_User/Templates folder.

One of the great annoyances in some Linux distributions, is that they have no templates for the create new document right-click option by default, not even for basic .txt files. So, you will have to create your own. Personally, I have gotten used to simply creating a empty file, and then giving it the desired extension. It is only a small inconvenience once you get used to it. However, sometimes, for whatever reason, even the create new document option goes missing, making it impossible to create empty files from the desktop.

The solution is simple. All we have to do, is to open up the $home/Templates directory, and then create a few files. I choose to create the following:

  1. Text File.txt
  2. PHP File.php
  3. HTML File.html
  4. CSS File.css
  5. Shell Script File.sh

I really like the simplicity of how this is done. I am not even sure how to do it in Windows. But in Linux, you can even add content to your default templates, which will greatly save you time when working with webdesign tests.

Templates

Below are a few templates to save you some time. You can place these in your $home/Templates folder, after which they should automatically show up in the right-click meny (instantly). Alternatively, you can also download all of them in a .7z file, and extract them directly in the Templates folder.

PHP File.php:

<?php
/*
     **************************
     ****** PHP Template ******
     **************************

   Description:

     This is a PHP Template File.

   Author:
     Jacob Kristensen (beamtic.com)

   Beamtic Tutorials: https://beamtic.com/tag/php-tutorials
   Official Reference: http://php.net/

   Template URL: https://beamtic.com/create-new-document-linux
*/

echo 'Hallo World';

HTML File.html:

<!document html>
<html>
<!--
     ***************************
     ****** HTML Template ******
     ***************************

   Description:

     This is a HTML Template File.

     The file will work with the CSS template, if linked.

     Background colors are used to indicate headers and footers,
     you can modify the templates to make them match your own design ideas.

     The goal of the templates, is to show how to create a basic responsive, and accesible website layout,
     and to provide "Create New-" options for HTML and CSS files in Linux. You can copy and paste the templates,
     and modify them as needed. Feel free to remove these comments as well.

   Author:
     Jacob Kristensen (beamtic.com)

   Beamtic Tutorials:
   Official Reference:

   Template URL:
-->
 <head>
  <title>Page Title (Required)</title>
  <meta name="description" content="This is the (optional) description of the page.">
  <link rel="stylesheet" type="text/css" href="test.css">
 </head>

 <body>
   <div id="basement">
     <header id="site_header">
     <!--
        Side-wide header, brand graphics/color, company logo, and links to social media. Etc.
     -->
     </header>

     <div class="WC"> <!-- Used to control the width for all columns at once. I.e.: Article, nav -->
       <article>
         <header>
         <!--
         Title, summery, author, post date, social share links. Etc.
         -->
           <h1>The title of the article</h1>
           <p>Short summery of article content.</p>
         </header>
           <p>Content of the main article goes here. Optionally a longer description than that in the 
           article summery, if subsections are used?</p>
         <section>
          <h1>Subsection title of the main article</h1>
          <p>Subsection content</p>
         </section>
         <footer>
           <!-- Author, post date, social share links. Etc. -->
         </footer>
       </article>
       <nav id="navigation">
        <section>
          <h1>Navigation</h1>
          <!-- Navigation items should be placed in either ol or ul list elements, for better accessibility. -->
          <ol>
           <li><a href="/tutorials">Tutorials</a></li>
           <li><a href="/videos">Videos</a></li>
           <li><a href="/videos">Links</a></li>
          </ol>
        </section>
       </nav>
     </div>

     <footer id="site_footer">
     <!--
       Side-wide links and info. I.e: About, Copyright, Contact, Privacy Policy, and links to social media
     -->
     </footer>
   </div>
 </body>
</html>

CSS File.css:

/*
     **************************
     ****** CSS Template ******
     **************************

   Description:

     This is a CSS Template File.

     The file works with the HTML template, if linked.

     Background colors are used to indicate headers and footers,
     you can modify the templates to make them match your own design ideas.

     The goal of the templates, is to show how to create a basic responsive, and accesible website layout,
     and to provide "Create New-" options for HTML and CSS files in Linux. You can copy and paste the templates,
     and modify them as needed. Feel free to remove these comments as well.

   Author:
     Jacob Kristensen (beamtic.com)

   Beamtic Tutorials: https://beamtic.com/
   Official reference: https://www.w3.org/TR/CSS/#css

   Template URL: https://beamtic.com/create-new-document-linux

*/
* {margin:0;padding:0;}
ol,ul {list-style-type:none;padding: 0 0.5em;}
p {padding:0.2em 0.5em 1em;}
.WC {width:90%;min-width:300px;max-width:1900px;margin:0 auto;} /* Basic width control for responsive layouts */
.WC:after {content:"";display:table;clear:both;} /* Just a modern clear-fix for the float problem. */
body {}
#site_header {background:silver;min-height:100px;width:100%;}
article {width:80%;float:left;}
article header {background:gray;} /* headers inside article elements */
article header p {text-indent:1em;font-style:italic;}
article header h1 {font-size:2em;padding:0.2em 0.2em 0.1em;} /* h1 inside headers that are placed inside articles */
article footer {background:gray;min-height:50px;}
article section {}
article section h1 {font-size:1.5em;padding:0.2em 0.2em 0.2em;}
nav section h1 {font-size:1.2em;padding:0.2em 0.2em 0.2em;}
#navigation {float:right;width:19%;}
#site_footer {background:silver;min-height:100px;width:100%;}

Shell Script File.sh:

: <<'END'
    ********************************
    ****** Sh Script Template ******
    ********************************

  Author:
    Jacob Kristensen (beamtic.com)



  Template URL: https://beamtic.com/create-new-document-linux

END

echo 'Hallo world'

Note. Bash scripts should be marked as executable via: sudo chmod +x [PATH_TO_SCRIPT]

Tell us what you think: