On recent-ish Linux systems (with GNU tools as in most desktop distributions), ls
prints names with weird characters using the shell's quoting syntax. If that '.env'$'\r'
is what ls
gives, the name of the file is .env<CR>
, where <CR>
is the carriage-return character. You could get that if you had a shell script with Windows line-endings that ran e.g. whatever > .env
.
The good thing here is that the output of ls
there is directly usable as input to the shell. Well, to Bash, ksh, and zsh at least, not a standard POSIX sh, like Debian/Ubuntu's /bin/sh
, Dash.
So try with just
rm -f '.env'$'\r'
Of course rm -f .env?
should also work to remove anything named .env
plus any one character.
Now, of course it's also possible that the filename is literally that, what with the single quotes and backslashes. But that's more difficult to achieve by accident. Even so, rm -f *.env*
should work to delete anything with .env
in the name.