When creating a new text file, should I add a .txt extension to its name?












24















When I create a new document aimed at containing only plain text, I am not obliged by Ubuntu to add a .txt extension to its name. It works indeed very well: gedit opens it without problem, understanding very well that it is only text.



The only two pro arguments I have found from now on for adding an extension are 1/ interoperability with Windows systems and 2/ avoiding confusion with folders having the same name. Nevertheless those two arguments do not convince me at all. As a consequence, should I keep the reflex of adding an extension to files or not?










share|improve this question





























    24















    When I create a new document aimed at containing only plain text, I am not obliged by Ubuntu to add a .txt extension to its name. It works indeed very well: gedit opens it without problem, understanding very well that it is only text.



    The only two pro arguments I have found from now on for adding an extension are 1/ interoperability with Windows systems and 2/ avoiding confusion with folders having the same name. Nevertheless those two arguments do not convince me at all. As a consequence, should I keep the reflex of adding an extension to files or not?










    share|improve this question



























      24












      24








      24


      3






      When I create a new document aimed at containing only plain text, I am not obliged by Ubuntu to add a .txt extension to its name. It works indeed very well: gedit opens it without problem, understanding very well that it is only text.



      The only two pro arguments I have found from now on for adding an extension are 1/ interoperability with Windows systems and 2/ avoiding confusion with folders having the same name. Nevertheless those two arguments do not convince me at all. As a consequence, should I keep the reflex of adding an extension to files or not?










      share|improve this question
















      When I create a new document aimed at containing only plain text, I am not obliged by Ubuntu to add a .txt extension to its name. It works indeed very well: gedit opens it without problem, understanding very well that it is only text.



      The only two pro arguments I have found from now on for adding an extension are 1/ interoperability with Windows systems and 2/ avoiding confusion with folders having the same name. Nevertheless those two arguments do not convince me at all. As a consequence, should I keep the reflex of adding an extension to files or not?







      gedit file-format text file-extension






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 28 '10 at 17:21









      8128

      24.9k21101137




      24.9k21101137










      asked Nov 14 '10 at 16:17









      AgmenorAgmenor

      7,493145596




      7,493145596






















          6 Answers
          6






          active

          oldest

          votes


















          14














          It's completely your own decision - don't let anyone chose for you.



          If it's a 'reflex' then there's no harm in keeping your current habbits. On the other hand it does look cleaner without file extensions...



          In my opinion the main case for using the extension is if you're emailing files to Windows users - whilst they could still open it in Notepad (with File->Open With) they will probably confused if you leave it off.






          share|improve this answer































            5














            It doesn't matter in Linux based systems whether you use a .txt extension or not. In fact, there is no special 'file extension' as on Windows - it is just part of the name. MIME types are used to determine the type of the file.



            If, however, you wish to share a file with people who are still using Windows, they will have to manually choose to open the text files with notepad unless you use a .txt extension.



            There are other compatibility considerations. By default, Notepad will not show new lines correctly because it uses a different line ending to Linux and other Unix like systems. The text editor will show text files in the Windows format correctly but you may need to press backspace twice in order to remove a new line.



            Using a text editor called Geany you can convert between line ending types through the Document -> Set Line Endings menu. This may also be possible in the default text editor (Gedit) but I don't know how to do it.



            Personally, I would not use the .txt extension or Windows line endings for daily use but I would convert the files when I needed to share them with Windows users.






            share|improve this answer


























            • The other way of dealing with the line ending problem on Ubuntu is the tofrodos package. It includes two commands that will do the line ending conversion "fromdos" and "todos".

              – Jonathan Sternberg
              Nov 15 '10 at 7:22



















            4














            In many cases filename extensions are not required on Ubuntu, but often it's still a good idea to use them. Not only for Windows/Mac compatibility, but also for your own convenience. Imagine if you would remove all file extensions (.html, .jpg, .doc, .ttf, .txt, .py, .conf, etc.); you would have to check the file type all the time, instead of knowing it when reading the file name (of course filenames like README are also obvious).






            share|improve this answer































              4














              If you want to learn more about how Linux identifies filetypes and why extensions are useless for that purpose, take a look at the file command man page



              man file


              It's a kind of magic :)






              share|improve this answer

































                2














                If you use linux dosent matter.Extensions are meaningless add it if you like..But if you want to view that file in windows, extension is must else you cant view the file. while keeping a well-known extension makes for better interoperability, it may also help certain (not very well written) apps behave better.For example, a mail client might choose a more appropriate MIME type for an attachment.So decide yourself.






                share|improve this answer

































                  1














                  The extension is optional but depending on your expectations you may wish to use one anyway. For example, Image viewer will fail miserably to open an image with the wrong extension. The thumbnailer will also fail in this example. You can prove this by renaming a JPEG to .GIF or .PNG for example. If you have a file and you aren't sure what it is you can find out with the command file filename where filename is the file in question. Here's some example commands and output:



                  file unity-panel_001.bmp 
                  unity-panel_001.bmp: PC bitmap, Windows 3.x format, 1280 x 21 x 24
                  me@zippy-64bit:~/Pictures$ file web-off.png
                  web-off.png: PNG image data, 850 x 552, 8-bit/color RGBA, non-interlaced
                  me@zippy-64bit:~/Pictures$ file XfinityBillShowingLateFee.jpg
                  XfinityBillShowingLateFee.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 2480x3437, frames 3





                  share|improve this answer

























                    Your Answer








                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "89"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: true,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: 10,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f13224%2fwhen-creating-a-new-text-file-should-i-add-a-txt-extension-to-its-name%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    6 Answers
                    6






                    active

                    oldest

                    votes








                    6 Answers
                    6






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    14














                    It's completely your own decision - don't let anyone chose for you.



                    If it's a 'reflex' then there's no harm in keeping your current habbits. On the other hand it does look cleaner without file extensions...



                    In my opinion the main case for using the extension is if you're emailing files to Windows users - whilst they could still open it in Notepad (with File->Open With) they will probably confused if you leave it off.






                    share|improve this answer




























                      14














                      It's completely your own decision - don't let anyone chose for you.



                      If it's a 'reflex' then there's no harm in keeping your current habbits. On the other hand it does look cleaner without file extensions...



                      In my opinion the main case for using the extension is if you're emailing files to Windows users - whilst they could still open it in Notepad (with File->Open With) they will probably confused if you leave it off.






                      share|improve this answer


























                        14












                        14








                        14







                        It's completely your own decision - don't let anyone chose for you.



                        If it's a 'reflex' then there's no harm in keeping your current habbits. On the other hand it does look cleaner without file extensions...



                        In my opinion the main case for using the extension is if you're emailing files to Windows users - whilst they could still open it in Notepad (with File->Open With) they will probably confused if you leave it off.






                        share|improve this answer













                        It's completely your own decision - don't let anyone chose for you.



                        If it's a 'reflex' then there's no harm in keeping your current habbits. On the other hand it does look cleaner without file extensions...



                        In my opinion the main case for using the extension is if you're emailing files to Windows users - whilst they could still open it in Notepad (with File->Open With) they will probably confused if you leave it off.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Nov 14 '10 at 16:31









                        81288128

                        24.9k21101137




                        24.9k21101137

























                            5














                            It doesn't matter in Linux based systems whether you use a .txt extension or not. In fact, there is no special 'file extension' as on Windows - it is just part of the name. MIME types are used to determine the type of the file.



                            If, however, you wish to share a file with people who are still using Windows, they will have to manually choose to open the text files with notepad unless you use a .txt extension.



                            There are other compatibility considerations. By default, Notepad will not show new lines correctly because it uses a different line ending to Linux and other Unix like systems. The text editor will show text files in the Windows format correctly but you may need to press backspace twice in order to remove a new line.



                            Using a text editor called Geany you can convert between line ending types through the Document -> Set Line Endings menu. This may also be possible in the default text editor (Gedit) but I don't know how to do it.



                            Personally, I would not use the .txt extension or Windows line endings for daily use but I would convert the files when I needed to share them with Windows users.






                            share|improve this answer


























                            • The other way of dealing with the line ending problem on Ubuntu is the tofrodos package. It includes two commands that will do the line ending conversion "fromdos" and "todos".

                              – Jonathan Sternberg
                              Nov 15 '10 at 7:22
















                            5














                            It doesn't matter in Linux based systems whether you use a .txt extension or not. In fact, there is no special 'file extension' as on Windows - it is just part of the name. MIME types are used to determine the type of the file.



                            If, however, you wish to share a file with people who are still using Windows, they will have to manually choose to open the text files with notepad unless you use a .txt extension.



                            There are other compatibility considerations. By default, Notepad will not show new lines correctly because it uses a different line ending to Linux and other Unix like systems. The text editor will show text files in the Windows format correctly but you may need to press backspace twice in order to remove a new line.



                            Using a text editor called Geany you can convert between line ending types through the Document -> Set Line Endings menu. This may also be possible in the default text editor (Gedit) but I don't know how to do it.



                            Personally, I would not use the .txt extension or Windows line endings for daily use but I would convert the files when I needed to share them with Windows users.






                            share|improve this answer


























                            • The other way of dealing with the line ending problem on Ubuntu is the tofrodos package. It includes two commands that will do the line ending conversion "fromdos" and "todos".

                              – Jonathan Sternberg
                              Nov 15 '10 at 7:22














                            5












                            5








                            5







                            It doesn't matter in Linux based systems whether you use a .txt extension or not. In fact, there is no special 'file extension' as on Windows - it is just part of the name. MIME types are used to determine the type of the file.



                            If, however, you wish to share a file with people who are still using Windows, they will have to manually choose to open the text files with notepad unless you use a .txt extension.



                            There are other compatibility considerations. By default, Notepad will not show new lines correctly because it uses a different line ending to Linux and other Unix like systems. The text editor will show text files in the Windows format correctly but you may need to press backspace twice in order to remove a new line.



                            Using a text editor called Geany you can convert between line ending types through the Document -> Set Line Endings menu. This may also be possible in the default text editor (Gedit) but I don't know how to do it.



                            Personally, I would not use the .txt extension or Windows line endings for daily use but I would convert the files when I needed to share them with Windows users.






                            share|improve this answer















                            It doesn't matter in Linux based systems whether you use a .txt extension or not. In fact, there is no special 'file extension' as on Windows - it is just part of the name. MIME types are used to determine the type of the file.



                            If, however, you wish to share a file with people who are still using Windows, they will have to manually choose to open the text files with notepad unless you use a .txt extension.



                            There are other compatibility considerations. By default, Notepad will not show new lines correctly because it uses a different line ending to Linux and other Unix like systems. The text editor will show text files in the Windows format correctly but you may need to press backspace twice in order to remove a new line.



                            Using a text editor called Geany you can convert between line ending types through the Document -> Set Line Endings menu. This may also be possible in the default text editor (Gedit) but I don't know how to do it.



                            Personally, I would not use the .txt extension or Windows line endings for daily use but I would convert the files when I needed to share them with Windows users.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Apr 13 '17 at 12:23









                            Community

                            1




                            1










                            answered Nov 14 '10 at 17:18









                            dv3500eadv3500ea

                            29k1290144




                            29k1290144













                            • The other way of dealing with the line ending problem on Ubuntu is the tofrodos package. It includes two commands that will do the line ending conversion "fromdos" and "todos".

                              – Jonathan Sternberg
                              Nov 15 '10 at 7:22



















                            • The other way of dealing with the line ending problem on Ubuntu is the tofrodos package. It includes two commands that will do the line ending conversion "fromdos" and "todos".

                              – Jonathan Sternberg
                              Nov 15 '10 at 7:22

















                            The other way of dealing with the line ending problem on Ubuntu is the tofrodos package. It includes two commands that will do the line ending conversion "fromdos" and "todos".

                            – Jonathan Sternberg
                            Nov 15 '10 at 7:22





                            The other way of dealing with the line ending problem on Ubuntu is the tofrodos package. It includes two commands that will do the line ending conversion "fromdos" and "todos".

                            – Jonathan Sternberg
                            Nov 15 '10 at 7:22











                            4














                            In many cases filename extensions are not required on Ubuntu, but often it's still a good idea to use them. Not only for Windows/Mac compatibility, but also for your own convenience. Imagine if you would remove all file extensions (.html, .jpg, .doc, .ttf, .txt, .py, .conf, etc.); you would have to check the file type all the time, instead of knowing it when reading the file name (of course filenames like README are also obvious).






                            share|improve this answer




























                              4














                              In many cases filename extensions are not required on Ubuntu, but often it's still a good idea to use them. Not only for Windows/Mac compatibility, but also for your own convenience. Imagine if you would remove all file extensions (.html, .jpg, .doc, .ttf, .txt, .py, .conf, etc.); you would have to check the file type all the time, instead of knowing it when reading the file name (of course filenames like README are also obvious).






                              share|improve this answer


























                                4












                                4








                                4







                                In many cases filename extensions are not required on Ubuntu, but often it's still a good idea to use them. Not only for Windows/Mac compatibility, but also for your own convenience. Imagine if you would remove all file extensions (.html, .jpg, .doc, .ttf, .txt, .py, .conf, etc.); you would have to check the file type all the time, instead of knowing it when reading the file name (of course filenames like README are also obvious).






                                share|improve this answer













                                In many cases filename extensions are not required on Ubuntu, but often it's still a good idea to use them. Not only for Windows/Mac compatibility, but also for your own convenience. Imagine if you would remove all file extensions (.html, .jpg, .doc, .ttf, .txt, .py, .conf, etc.); you would have to check the file type all the time, instead of knowing it when reading the file name (of course filenames like README are also obvious).







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Nov 14 '10 at 17:22









                                JanCJanC

                                16.8k13447




                                16.8k13447























                                    4














                                    If you want to learn more about how Linux identifies filetypes and why extensions are useless for that purpose, take a look at the file command man page



                                    man file


                                    It's a kind of magic :)






                                    share|improve this answer






























                                      4














                                      If you want to learn more about how Linux identifies filetypes and why extensions are useless for that purpose, take a look at the file command man page



                                      man file


                                      It's a kind of magic :)






                                      share|improve this answer




























                                        4












                                        4








                                        4







                                        If you want to learn more about how Linux identifies filetypes and why extensions are useless for that purpose, take a look at the file command man page



                                        man file


                                        It's a kind of magic :)






                                        share|improve this answer















                                        If you want to learn more about how Linux identifies filetypes and why extensions are useless for that purpose, take a look at the file command man page



                                        man file


                                        It's a kind of magic :)







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Dec 28 '10 at 20:31









                                        Jorge Castro

                                        36.9k106422617




                                        36.9k106422617










                                        answered Nov 14 '10 at 17:14









                                        zuzustzuzust

                                        563310




                                        563310























                                            2














                                            If you use linux dosent matter.Extensions are meaningless add it if you like..But if you want to view that file in windows, extension is must else you cant view the file. while keeping a well-known extension makes for better interoperability, it may also help certain (not very well written) apps behave better.For example, a mail client might choose a more appropriate MIME type for an attachment.So decide yourself.






                                            share|improve this answer






























                                              2














                                              If you use linux dosent matter.Extensions are meaningless add it if you like..But if you want to view that file in windows, extension is must else you cant view the file. while keeping a well-known extension makes for better interoperability, it may also help certain (not very well written) apps behave better.For example, a mail client might choose a more appropriate MIME type for an attachment.So decide yourself.






                                              share|improve this answer




























                                                2












                                                2








                                                2







                                                If you use linux dosent matter.Extensions are meaningless add it if you like..But if you want to view that file in windows, extension is must else you cant view the file. while keeping a well-known extension makes for better interoperability, it may also help certain (not very well written) apps behave better.For example, a mail client might choose a more appropriate MIME type for an attachment.So decide yourself.






                                                share|improve this answer















                                                If you use linux dosent matter.Extensions are meaningless add it if you like..But if you want to view that file in windows, extension is must else you cant view the file. while keeping a well-known extension makes for better interoperability, it may also help certain (not very well written) apps behave better.For example, a mail client might choose a more appropriate MIME type for an attachment.So decide yourself.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Nov 14 '10 at 16:33

























                                                answered Nov 14 '10 at 16:28









                                                karthick87karthick87

                                                49.7k53167218




                                                49.7k53167218























                                                    1














                                                    The extension is optional but depending on your expectations you may wish to use one anyway. For example, Image viewer will fail miserably to open an image with the wrong extension. The thumbnailer will also fail in this example. You can prove this by renaming a JPEG to .GIF or .PNG for example. If you have a file and you aren't sure what it is you can find out with the command file filename where filename is the file in question. Here's some example commands and output:



                                                    file unity-panel_001.bmp 
                                                    unity-panel_001.bmp: PC bitmap, Windows 3.x format, 1280 x 21 x 24
                                                    me@zippy-64bit:~/Pictures$ file web-off.png
                                                    web-off.png: PNG image data, 850 x 552, 8-bit/color RGBA, non-interlaced
                                                    me@zippy-64bit:~/Pictures$ file XfinityBillShowingLateFee.jpg
                                                    XfinityBillShowingLateFee.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 2480x3437, frames 3





                                                    share|improve this answer






























                                                      1














                                                      The extension is optional but depending on your expectations you may wish to use one anyway. For example, Image viewer will fail miserably to open an image with the wrong extension. The thumbnailer will also fail in this example. You can prove this by renaming a JPEG to .GIF or .PNG for example. If you have a file and you aren't sure what it is you can find out with the command file filename where filename is the file in question. Here's some example commands and output:



                                                      file unity-panel_001.bmp 
                                                      unity-panel_001.bmp: PC bitmap, Windows 3.x format, 1280 x 21 x 24
                                                      me@zippy-64bit:~/Pictures$ file web-off.png
                                                      web-off.png: PNG image data, 850 x 552, 8-bit/color RGBA, non-interlaced
                                                      me@zippy-64bit:~/Pictures$ file XfinityBillShowingLateFee.jpg
                                                      XfinityBillShowingLateFee.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 2480x3437, frames 3





                                                      share|improve this answer




























                                                        1












                                                        1








                                                        1







                                                        The extension is optional but depending on your expectations you may wish to use one anyway. For example, Image viewer will fail miserably to open an image with the wrong extension. The thumbnailer will also fail in this example. You can prove this by renaming a JPEG to .GIF or .PNG for example. If you have a file and you aren't sure what it is you can find out with the command file filename where filename is the file in question. Here's some example commands and output:



                                                        file unity-panel_001.bmp 
                                                        unity-panel_001.bmp: PC bitmap, Windows 3.x format, 1280 x 21 x 24
                                                        me@zippy-64bit:~/Pictures$ file web-off.png
                                                        web-off.png: PNG image data, 850 x 552, 8-bit/color RGBA, non-interlaced
                                                        me@zippy-64bit:~/Pictures$ file XfinityBillShowingLateFee.jpg
                                                        XfinityBillShowingLateFee.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 2480x3437, frames 3





                                                        share|improve this answer















                                                        The extension is optional but depending on your expectations you may wish to use one anyway. For example, Image viewer will fail miserably to open an image with the wrong extension. The thumbnailer will also fail in this example. You can prove this by renaming a JPEG to .GIF or .PNG for example. If you have a file and you aren't sure what it is you can find out with the command file filename where filename is the file in question. Here's some example commands and output:



                                                        file unity-panel_001.bmp 
                                                        unity-panel_001.bmp: PC bitmap, Windows 3.x format, 1280 x 21 x 24
                                                        me@zippy-64bit:~/Pictures$ file web-off.png
                                                        web-off.png: PNG image data, 850 x 552, 8-bit/color RGBA, non-interlaced
                                                        me@zippy-64bit:~/Pictures$ file XfinityBillShowingLateFee.jpg
                                                        XfinityBillShowingLateFee.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 2480x3437, frames 3






                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited Jan 25 at 19:06

























                                                        answered Dec 21 '15 at 23:04









                                                        Elder GeekElder Geek

                                                        27.4k954127




                                                        27.4k954127






























                                                            draft saved

                                                            draft discarded




















































                                                            Thanks for contributing an answer to Ask Ubuntu!


                                                            • Please be sure to answer the question. Provide details and share your research!

                                                            But avoid



                                                            • Asking for help, clarification, or responding to other answers.

                                                            • Making statements based on opinion; back them up with references or personal experience.


                                                            To learn more, see our tips on writing great answers.




                                                            draft saved


                                                            draft discarded














                                                            StackExchange.ready(
                                                            function () {
                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f13224%2fwhen-creating-a-new-text-file-should-i-add-a-txt-extension-to-its-name%23new-answer', 'question_page');
                                                            }
                                                            );

                                                            Post as a guest















                                                            Required, but never shown





















































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown

































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown







                                                            Popular posts from this blog

                                                            How to send String Array data to Server using php in android

                                                            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                                                            Is anime1.com a legal site for watching anime?