How do I delete the file of user avatar?

I think it still works like this.

From the URL of the file you want to delete, get the filename.

cd /var/discourse/shared/uploads
find . -name =FILENAME= | xargs exec rm

And then you’d do whatever to purge it from your CDN.