I have a ~ directory indicator installed now in the wrong place after docker runs

I just put in a Dockerfile for some Python code I need to get into GKE.

 % ls
README.md       app_DEV.yaml        app_PROD.yaml       db.py           main.py         requirements.txt

I went through a couple of cycles of docker build before I got it done.

Then docker suggested a docker scan to look for vulnerabilities I tried it but left off the . after the command, which left me with an extra ~ home directory down in the hierarchy where I don’t want it:

% ls
Dockerfile      README.md       app_DEV.yaml        app_PROD.yaml       db.py           main.py         requirements.txt    ~

What’s the safest way to remove this? Python removing this directory entry? I don’t want to goof and wipe my entire home directory.

Thanks for any suggestions!

Answer

Place the ~ in quotes:

rm -r "~"

This tells bash not to “expand” the tilda into your home directory.

If you want to test first, do:

echo ~
echo "~"

and you’ll see that the first echo gives your home directory, and the second the tilda character. Let me know if you run into trouble!