How to remove hidden files in Linux

Originally published at:

I am a new Linux sysadmin and Ubuntu Linux user. How can I remove hidden files in Linux? How do I delete hidden files in Linux starting with . (dot) character?

An interesting footnote is that some files may have problematic names like files starting with a β€˜-’ (minus symbol) and one can use β€˜β€“β€™ as take everything from here as argument like this (from the manpages)

   To remove a file whose name starts with a '-', for example '-foo', use one of these commands:

          rm -- -foo

          rm ./-foo

It’s more common than one expect in daily sysadmin live to deal with these :slight_smile:

1 Like