0

I tried using rm -rf .* command to remove a hidden file and I am met with this error.

rm: refusing to remove '.' or '..' directory: skipping '.'
rm: refusing to remove '.' or '..' directory: skipping '..'
5
  • 1
    You may find this helpful: how to glob every hidden file except current and parent directory Commented Jan 18, 2024 at 13:55
  • 2
    What is your question? Commented Jan 18, 2024 at 14:19
  • If you add the result of running ls -A in the directory holding the file you want to delete, what is the name of the file? Running your rm -rf .* will have deleted ALL files and directories starting with a dot (.). If that was in your home directory you'll have now lost all your configuration files. Time to restore from your backup - if you had one Commented Jan 18, 2024 at 14:27
  • Why not just use the filename? Commented Jan 18, 2024 at 14:44
  • 1
    rm -rf .* does not remove "a hidden file" but all of them in your current working directory. And hidden directories, if any, recursively. Are you sure you want this? It's a pretty dangerous command that I don't recommend to ever execute. Remove only the exact files and directories you want to. Also maybe consider using an interactive file manager, such as mc in terminals, or a graphical one. Commented Jan 18, 2024 at 20:02

1 Answer 1

0

The terminal throws an error because rm cannot delete the single dot and the double dots symbols.

These two symbols exist on each relative path, and represent the current working directory (.) and the parent directory (..).

The double dot, is mostly used to change your current working directory to the parent directory, when using the relative path.

For example, if your current working directory is /home/user, by typing cd .., you will change your current working directory to /home.

2
  • 1
    I'd suggest it's not the "previous" directory but the parent directory. (Previous could be taken to mean previous in time, i.e. the last directory someone was in before the current one.) Commented Oct 9 at 21:06
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Oct 9 at 21:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.