Lock file naming patternWhat does the tilde (~) mean at the end of a filename?bulk rename (or correctly...

Binary Numbers Magic Trick

Is there really no use for MD5 anymore?

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

How does a program know if stdout is connected to a terminal or a pipe?

Why does nature favour the Laplacian?

Does a large simulator bay have standard public address announcements?

Map of water taps to fill bottles

Solving a heat equation problem

How come there are so many candidates for the 2020 Democratic party presidential nomination?

Alignment of various blocks in tikz

How exactly does Hawking radiation decrease the mass of black holes?

Which big number is bigger?

How can I place the product on a social media post better?

Critique of timeline aesthetic

Do I have an "anti-research" personality?

Phrase for the opposite of "foolproof"

Aliens crash on Earth and go into stasis to wait for technology to fix their ship

Retrieve SObject

A ​Note ​on ​N!

As an international instructor, should I openly talk about my accent?

What's the name of these pliers?

Size of electromagnet needed to replicate Earth's magnetic field

Why must Chinese maps be obfuscated?

Contradiction proof for inequality of P and NP?



Lock file naming pattern


What does the tilde (~) mean at the end of a filename?bulk rename (or correctly display) files with special charactersUnix file naming conventionWhat is the file-naming convention for regular text files?Lock Parted Magic?Disallowing blank space in file system namingLibreOffice introducing random page breaksWhy are certain naming conventions so inconsistent in Linux?How to stop opening a file in LibreOffice from changing folder's Date ModifiedKernighan and Pike challenge: how to put a slash in a filename?Why flock doesn't clean the lock file?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















Whenever I open a LibreOffice document, LibreOffice creates a lock file along the original file. This file has a naming schema like the following:



.~lock.MyDocument.odt# 


Is this a LibreOffice specific naming pattern? Is it common on Linux?
Why do LibreOffice use exactly that pattern? Why did they choose those specific extra characters?










share|improve this question




















  • 1





    It is not a Linux thing (Linux is just a kernel). It may be a Unix, Gnu thing.

    – ctrl-alt-delor
    2 hours ago


















1















Whenever I open a LibreOffice document, LibreOffice creates a lock file along the original file. This file has a naming schema like the following:



.~lock.MyDocument.odt# 


Is this a LibreOffice specific naming pattern? Is it common on Linux?
Why do LibreOffice use exactly that pattern? Why did they choose those specific extra characters?










share|improve this question




















  • 1





    It is not a Linux thing (Linux is just a kernel). It may be a Unix, Gnu thing.

    – ctrl-alt-delor
    2 hours ago














1












1








1








Whenever I open a LibreOffice document, LibreOffice creates a lock file along the original file. This file has a naming schema like the following:



.~lock.MyDocument.odt# 


Is this a LibreOffice specific naming pattern? Is it common on Linux?
Why do LibreOffice use exactly that pattern? Why did they choose those specific extra characters?










share|improve this question
















Whenever I open a LibreOffice document, LibreOffice creates a lock file along the original file. This file has a naming schema like the following:



.~lock.MyDocument.odt# 


Is this a LibreOffice specific naming pattern? Is it common on Linux?
Why do LibreOffice use exactly that pattern? Why did they choose those specific extra characters?







filenames libreoffice lock






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago









Rui F Ribeiro

42.4k1485146




42.4k1485146










asked 2 hours ago









SilicomancerSilicomancer

1163




1163








  • 1





    It is not a Linux thing (Linux is just a kernel). It may be a Unix, Gnu thing.

    – ctrl-alt-delor
    2 hours ago














  • 1





    It is not a Linux thing (Linux is just a kernel). It may be a Unix, Gnu thing.

    – ctrl-alt-delor
    2 hours ago








1




1





It is not a Linux thing (Linux is just a kernel). It may be a Unix, Gnu thing.

– ctrl-alt-delor
2 hours ago





It is not a Linux thing (Linux is just a kernel). It may be a Unix, Gnu thing.

– ctrl-alt-delor
2 hours ago










2 Answers
2






active

oldest

votes


















1














If a program uses a lock file for anything, it is up to the program to choose the name of that lock file.



The name chosen by LibreOffice seems to be a hidden name constructed in such a way that it's unlikely to collide with a pre-existing filename, while still being specific to whatever document you are currently editing.






share|improve this answer
























  • So while the "." obviously hides the file the "~" and the "#" are arbitrary?

    – Silicomancer
    2 hours ago






  • 1





    @Silicomancer Yes, they are prepended and appended to the name of your file and it creates a filename that is unlikely to exist.

    – Kusalananda
    2 hours ago






  • 1





    @Silicomancer They are arbitrary, but not random, meaning LibreOffice will always name lock files in this way (as will OpenOffice I believe).

    – Kusalananda
    2 hours ago



















1














The leading dot hides the file from some directory listings. This comes from historical behavior of the ls command, which lead many programs to use leading dots to denote files that aren't meant to be visible in directory listings, which in turn lead to many file managers hiding such files by default.



The tilde is an unusual character in file names, so there's not much risk of colliding the file name chosen by the user. Why a tilde? Tildes are especially unusual at the beginning of file names, because a leading ~ means “home directory” in shells and many other programs. So prepending a tilde is unlikely to cause a collision. A possible additional factor because when it's at the end of a file name, it's a traditional way to name backups, so adding a tilde to a file's name has a flavor of “some file that is related to this other file, but is not the one the user usually wants” (but it couldn't be at the end because that's already taken). The tilde may additionally have been inspired by the lock files used by Microsoft Office, which start with ~$.



The hash at the end ensures that the file doesn't have an extension that other programs would recognize. If the file was called .~lock.MyDocument.odt, file managers would offer to open it in LibreOffice. Why a hash rather than some other character? Hash has a small tradition of being used in lock file names, for example Emacs uses .# followed by the name of the file that's being edited.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f515839%2flock-file-naming-pattern%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    If a program uses a lock file for anything, it is up to the program to choose the name of that lock file.



    The name chosen by LibreOffice seems to be a hidden name constructed in such a way that it's unlikely to collide with a pre-existing filename, while still being specific to whatever document you are currently editing.






    share|improve this answer
























    • So while the "." obviously hides the file the "~" and the "#" are arbitrary?

      – Silicomancer
      2 hours ago






    • 1





      @Silicomancer Yes, they are prepended and appended to the name of your file and it creates a filename that is unlikely to exist.

      – Kusalananda
      2 hours ago






    • 1





      @Silicomancer They are arbitrary, but not random, meaning LibreOffice will always name lock files in this way (as will OpenOffice I believe).

      – Kusalananda
      2 hours ago
















    1














    If a program uses a lock file for anything, it is up to the program to choose the name of that lock file.



    The name chosen by LibreOffice seems to be a hidden name constructed in such a way that it's unlikely to collide with a pre-existing filename, while still being specific to whatever document you are currently editing.






    share|improve this answer
























    • So while the "." obviously hides the file the "~" and the "#" are arbitrary?

      – Silicomancer
      2 hours ago






    • 1





      @Silicomancer Yes, they are prepended and appended to the name of your file and it creates a filename that is unlikely to exist.

      – Kusalananda
      2 hours ago






    • 1





      @Silicomancer They are arbitrary, but not random, meaning LibreOffice will always name lock files in this way (as will OpenOffice I believe).

      – Kusalananda
      2 hours ago














    1












    1








    1







    If a program uses a lock file for anything, it is up to the program to choose the name of that lock file.



    The name chosen by LibreOffice seems to be a hidden name constructed in such a way that it's unlikely to collide with a pre-existing filename, while still being specific to whatever document you are currently editing.






    share|improve this answer













    If a program uses a lock file for anything, it is up to the program to choose the name of that lock file.



    The name chosen by LibreOffice seems to be a hidden name constructed in such a way that it's unlikely to collide with a pre-existing filename, while still being specific to whatever document you are currently editing.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 2 hours ago









    KusalanandaKusalananda

    144k18268448




    144k18268448













    • So while the "." obviously hides the file the "~" and the "#" are arbitrary?

      – Silicomancer
      2 hours ago






    • 1





      @Silicomancer Yes, they are prepended and appended to the name of your file and it creates a filename that is unlikely to exist.

      – Kusalananda
      2 hours ago






    • 1





      @Silicomancer They are arbitrary, but not random, meaning LibreOffice will always name lock files in this way (as will OpenOffice I believe).

      – Kusalananda
      2 hours ago



















    • So while the "." obviously hides the file the "~" and the "#" are arbitrary?

      – Silicomancer
      2 hours ago






    • 1





      @Silicomancer Yes, they are prepended and appended to the name of your file and it creates a filename that is unlikely to exist.

      – Kusalananda
      2 hours ago






    • 1





      @Silicomancer They are arbitrary, but not random, meaning LibreOffice will always name lock files in this way (as will OpenOffice I believe).

      – Kusalananda
      2 hours ago

















    So while the "." obviously hides the file the "~" and the "#" are arbitrary?

    – Silicomancer
    2 hours ago





    So while the "." obviously hides the file the "~" and the "#" are arbitrary?

    – Silicomancer
    2 hours ago




    1




    1





    @Silicomancer Yes, they are prepended and appended to the name of your file and it creates a filename that is unlikely to exist.

    – Kusalananda
    2 hours ago





    @Silicomancer Yes, they are prepended and appended to the name of your file and it creates a filename that is unlikely to exist.

    – Kusalananda
    2 hours ago




    1




    1





    @Silicomancer They are arbitrary, but not random, meaning LibreOffice will always name lock files in this way (as will OpenOffice I believe).

    – Kusalananda
    2 hours ago





    @Silicomancer They are arbitrary, but not random, meaning LibreOffice will always name lock files in this way (as will OpenOffice I believe).

    – Kusalananda
    2 hours ago













    1














    The leading dot hides the file from some directory listings. This comes from historical behavior of the ls command, which lead many programs to use leading dots to denote files that aren't meant to be visible in directory listings, which in turn lead to many file managers hiding such files by default.



    The tilde is an unusual character in file names, so there's not much risk of colliding the file name chosen by the user. Why a tilde? Tildes are especially unusual at the beginning of file names, because a leading ~ means “home directory” in shells and many other programs. So prepending a tilde is unlikely to cause a collision. A possible additional factor because when it's at the end of a file name, it's a traditional way to name backups, so adding a tilde to a file's name has a flavor of “some file that is related to this other file, but is not the one the user usually wants” (but it couldn't be at the end because that's already taken). The tilde may additionally have been inspired by the lock files used by Microsoft Office, which start with ~$.



    The hash at the end ensures that the file doesn't have an extension that other programs would recognize. If the file was called .~lock.MyDocument.odt, file managers would offer to open it in LibreOffice. Why a hash rather than some other character? Hash has a small tradition of being used in lock file names, for example Emacs uses .# followed by the name of the file that's being edited.






    share|improve this answer




























      1














      The leading dot hides the file from some directory listings. This comes from historical behavior of the ls command, which lead many programs to use leading dots to denote files that aren't meant to be visible in directory listings, which in turn lead to many file managers hiding such files by default.



      The tilde is an unusual character in file names, so there's not much risk of colliding the file name chosen by the user. Why a tilde? Tildes are especially unusual at the beginning of file names, because a leading ~ means “home directory” in shells and many other programs. So prepending a tilde is unlikely to cause a collision. A possible additional factor because when it's at the end of a file name, it's a traditional way to name backups, so adding a tilde to a file's name has a flavor of “some file that is related to this other file, but is not the one the user usually wants” (but it couldn't be at the end because that's already taken). The tilde may additionally have been inspired by the lock files used by Microsoft Office, which start with ~$.



      The hash at the end ensures that the file doesn't have an extension that other programs would recognize. If the file was called .~lock.MyDocument.odt, file managers would offer to open it in LibreOffice. Why a hash rather than some other character? Hash has a small tradition of being used in lock file names, for example Emacs uses .# followed by the name of the file that's being edited.






      share|improve this answer


























        1












        1








        1







        The leading dot hides the file from some directory listings. This comes from historical behavior of the ls command, which lead many programs to use leading dots to denote files that aren't meant to be visible in directory listings, which in turn lead to many file managers hiding such files by default.



        The tilde is an unusual character in file names, so there's not much risk of colliding the file name chosen by the user. Why a tilde? Tildes are especially unusual at the beginning of file names, because a leading ~ means “home directory” in shells and many other programs. So prepending a tilde is unlikely to cause a collision. A possible additional factor because when it's at the end of a file name, it's a traditional way to name backups, so adding a tilde to a file's name has a flavor of “some file that is related to this other file, but is not the one the user usually wants” (but it couldn't be at the end because that's already taken). The tilde may additionally have been inspired by the lock files used by Microsoft Office, which start with ~$.



        The hash at the end ensures that the file doesn't have an extension that other programs would recognize. If the file was called .~lock.MyDocument.odt, file managers would offer to open it in LibreOffice. Why a hash rather than some other character? Hash has a small tradition of being used in lock file names, for example Emacs uses .# followed by the name of the file that's being edited.






        share|improve this answer













        The leading dot hides the file from some directory listings. This comes from historical behavior of the ls command, which lead many programs to use leading dots to denote files that aren't meant to be visible in directory listings, which in turn lead to many file managers hiding such files by default.



        The tilde is an unusual character in file names, so there's not much risk of colliding the file name chosen by the user. Why a tilde? Tildes are especially unusual at the beginning of file names, because a leading ~ means “home directory” in shells and many other programs. So prepending a tilde is unlikely to cause a collision. A possible additional factor because when it's at the end of a file name, it's a traditional way to name backups, so adding a tilde to a file's name has a flavor of “some file that is related to this other file, but is not the one the user usually wants” (but it couldn't be at the end because that's already taken). The tilde may additionally have been inspired by the lock files used by Microsoft Office, which start with ~$.



        The hash at the end ensures that the file doesn't have an extension that other programs would recognize. If the file was called .~lock.MyDocument.odt, file managers would offer to open it in LibreOffice. Why a hash rather than some other character? Hash has a small tradition of being used in lock file names, for example Emacs uses .# followed by the name of the file that's being edited.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 1 hour ago









        GillesGilles

        550k13111201634




        550k13111201634






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f515839%2flock-file-naming-pattern%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

            (145452) 2005 RN43 Классификация | Примечания | Ссылки |...

            Щит и меч (фильм) Содержание Названия серий | Сюжет |...

            Энтрерриос (город) Содержание История | Географическое...