why 'cannot overwrite existing file'?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







6















I try to write to a file "date > file" but Linux says 'cannot overwrite existing file'. I tried chmod 755 but still cannot write to the file. What should I do? Thank you.










share|improve this question





























    6















    I try to write to a file "date > file" but Linux says 'cannot overwrite existing file'. I tried chmod 755 but still cannot write to the file. What should I do? Thank you.










    share|improve this question

























      6












      6








      6


      1






      I try to write to a file "date > file" but Linux says 'cannot overwrite existing file'. I tried chmod 755 but still cannot write to the file. What should I do? Thank you.










      share|improve this question














      I try to write to a file "date > file" but Linux says 'cannot overwrite existing file'. I tried chmod 755 but still cannot write to the file. What should I do? Thank you.







      linux filesystems






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 '11 at 2:28









      MartinMartin

      16417




      16417






















          3 Answers
          3






          active

          oldest

          votes


















          16














          If you are running bash, the noclobber option has been set. Use >| if you want to temporarily override this.






          share|improve this answer
























          • How to redirect both stderr and stdout and temporarily override noclobber at the same time? I tried &>| without luck.

            – Tu Bui
            Aug 24 '18 at 9:35



















          2














          It is possible that the file was set as immutable with chattr. It's rarely used, but it's a realistic possibility. In that case:



          chattr -i [filename]


          ... should be able to remove that attribute.






          share|improve this answer



















          • 1





            Writing to an "immutable" file would result in "Operation not permitted.".

            – grawity
            Mar 8 '11 at 12:44



















          0















          1. Go to your home folder

          2. Press Ctrl + H to show hidden files

          3. Check whether any of the folders are locked

          4. Right click on the folder then click "properties". In that click "permissions".

          5. Under owner, change folder access to "create and delete files."

          6. Click "Apply Permissions to Enclosed files"


          If you cannot see any locked folders then select all folders and do the above






          share|improve this answer





















          • 2





            Somehow, I don't expect this to work in every case ;-) Hint: some people don't use the same DE as you do, or even any GUI at all.

            – Psirus
            Jan 31 '12 at 14:39












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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%2fsuperuser.com%2fquestions%2f254644%2fwhy-cannot-overwrite-existing-file%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          16














          If you are running bash, the noclobber option has been set. Use >| if you want to temporarily override this.






          share|improve this answer
























          • How to redirect both stderr and stdout and temporarily override noclobber at the same time? I tried &>| without luck.

            – Tu Bui
            Aug 24 '18 at 9:35
















          16














          If you are running bash, the noclobber option has been set. Use >| if you want to temporarily override this.






          share|improve this answer
























          • How to redirect both stderr and stdout and temporarily override noclobber at the same time? I tried &>| without luck.

            – Tu Bui
            Aug 24 '18 at 9:35














          16












          16








          16







          If you are running bash, the noclobber option has been set. Use >| if you want to temporarily override this.






          share|improve this answer













          If you are running bash, the noclobber option has been set. Use >| if you want to temporarily override this.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 '11 at 2:40









          Ignacio Vazquez-AbramsIgnacio Vazquez-Abrams

          96.8k6155211




          96.8k6155211













          • How to redirect both stderr and stdout and temporarily override noclobber at the same time? I tried &>| without luck.

            – Tu Bui
            Aug 24 '18 at 9:35



















          • How to redirect both stderr and stdout and temporarily override noclobber at the same time? I tried &>| without luck.

            – Tu Bui
            Aug 24 '18 at 9:35

















          How to redirect both stderr and stdout and temporarily override noclobber at the same time? I tried &>| without luck.

          – Tu Bui
          Aug 24 '18 at 9:35





          How to redirect both stderr and stdout and temporarily override noclobber at the same time? I tried &>| without luck.

          – Tu Bui
          Aug 24 '18 at 9:35













          2














          It is possible that the file was set as immutable with chattr. It's rarely used, but it's a realistic possibility. In that case:



          chattr -i [filename]


          ... should be able to remove that attribute.






          share|improve this answer



















          • 1





            Writing to an "immutable" file would result in "Operation not permitted.".

            – grawity
            Mar 8 '11 at 12:44
















          2














          It is possible that the file was set as immutable with chattr. It's rarely used, but it's a realistic possibility. In that case:



          chattr -i [filename]


          ... should be able to remove that attribute.






          share|improve this answer



















          • 1





            Writing to an "immutable" file would result in "Operation not permitted.".

            – grawity
            Mar 8 '11 at 12:44














          2












          2








          2







          It is possible that the file was set as immutable with chattr. It's rarely used, but it's a realistic possibility. In that case:



          chattr -i [filename]


          ... should be able to remove that attribute.






          share|improve this answer













          It is possible that the file was set as immutable with chattr. It's rarely used, but it's a realistic possibility. In that case:



          chattr -i [filename]


          ... should be able to remove that attribute.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 '11 at 2:51









          0xC0000022L0xC0000022L

          3,43363867




          3,43363867








          • 1





            Writing to an "immutable" file would result in "Operation not permitted.".

            – grawity
            Mar 8 '11 at 12:44














          • 1





            Writing to an "immutable" file would result in "Operation not permitted.".

            – grawity
            Mar 8 '11 at 12:44








          1




          1





          Writing to an "immutable" file would result in "Operation not permitted.".

          – grawity
          Mar 8 '11 at 12:44





          Writing to an "immutable" file would result in "Operation not permitted.".

          – grawity
          Mar 8 '11 at 12:44











          0















          1. Go to your home folder

          2. Press Ctrl + H to show hidden files

          3. Check whether any of the folders are locked

          4. Right click on the folder then click "properties". In that click "permissions".

          5. Under owner, change folder access to "create and delete files."

          6. Click "Apply Permissions to Enclosed files"


          If you cannot see any locked folders then select all folders and do the above






          share|improve this answer





















          • 2





            Somehow, I don't expect this to work in every case ;-) Hint: some people don't use the same DE as you do, or even any GUI at all.

            – Psirus
            Jan 31 '12 at 14:39
















          0















          1. Go to your home folder

          2. Press Ctrl + H to show hidden files

          3. Check whether any of the folders are locked

          4. Right click on the folder then click "properties". In that click "permissions".

          5. Under owner, change folder access to "create and delete files."

          6. Click "Apply Permissions to Enclosed files"


          If you cannot see any locked folders then select all folders and do the above






          share|improve this answer





















          • 2





            Somehow, I don't expect this to work in every case ;-) Hint: some people don't use the same DE as you do, or even any GUI at all.

            – Psirus
            Jan 31 '12 at 14:39














          0












          0








          0








          1. Go to your home folder

          2. Press Ctrl + H to show hidden files

          3. Check whether any of the folders are locked

          4. Right click on the folder then click "properties". In that click "permissions".

          5. Under owner, change folder access to "create and delete files."

          6. Click "Apply Permissions to Enclosed files"


          If you cannot see any locked folders then select all folders and do the above






          share|improve this answer
















          1. Go to your home folder

          2. Press Ctrl + H to show hidden files

          3. Check whether any of the folders are locked

          4. Right click on the folder then click "properties". In that click "permissions".

          5. Under owner, change folder access to "create and delete files."

          6. Click "Apply Permissions to Enclosed files"


          If you cannot see any locked folders then select all folders and do the above







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 12 '12 at 4:09









          soandos

          20.3k2892131




          20.3k2892131










          answered Jan 31 '12 at 13:59









          AnushaSameerAnushaSameer

          91




          91








          • 2





            Somehow, I don't expect this to work in every case ;-) Hint: some people don't use the same DE as you do, or even any GUI at all.

            – Psirus
            Jan 31 '12 at 14:39














          • 2





            Somehow, I don't expect this to work in every case ;-) Hint: some people don't use the same DE as you do, or even any GUI at all.

            – Psirus
            Jan 31 '12 at 14:39








          2




          2





          Somehow, I don't expect this to work in every case ;-) Hint: some people don't use the same DE as you do, or even any GUI at all.

          – Psirus
          Jan 31 '12 at 14:39





          Somehow, I don't expect this to work in every case ;-) Hint: some people don't use the same DE as you do, or even any GUI at all.

          – Psirus
          Jan 31 '12 at 14:39


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f254644%2fwhy-cannot-overwrite-existing-file%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

          Paul Cézanne

          UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

          Angular material date-picker (MatDatepicker) auto completes the date on focus out