Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

up vote 4 down vote accepted

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

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
    
Writing to an "immutable" file would result in "Operation not permitted.". –  grawity Mar 8 '11 at 12:44
  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  
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.