Take the 2-minute tour ×

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
add comment

3 Answers

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
add comment
  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
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
add comment

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
add comment

Your Answer


