why 'cannot overwrite existing file'?

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


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.


Turn off noclobber in current shell session:

set +o noclobber

Turn on noclobber in current shelll session:

set -o noclobber

See all bash settings:

set -o

References:
https://www.victordodon.com/to-clobber-or-to-noclobber/ https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html