Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How should I remove a folder which starts with a colon (e.g. :q in linux)

share|improve this question

migrated from Aug 31 '12 at 15:41

This question came from our site for professional and enthusiast programmers.

Can someone care to say why this is being downvoted. Just fed up of these annoying rules. – Joshua Aug 31 '12 at 13:06
Because it is a very common question, answered in many many tutorials. – Basile Starynkevitch Sep 1 '12 at 6:11
@BasileStarynkevitch - I do understand that it would have been answered in many many tutorials, but help varies at different levels and this is quite basic. Also do understand not everyone has many years of experience and may not be in a position to get to an answer quickly, hence I asked for help in this forum. – Joshua Sep 5 '12 at 11:28
up vote 4 down vote accepted

Just do

  rm -rf "./:q"

it is a FAQ.

If you have a space in your directory, use rm -rf "./ :q" for example.

You could add -v flag to rm to make it show all removed things. You could also add the -i flag to be interactively asked at each step.

I strongly suggest reading the output of man rm, i.e. the man page of rm(1)

And reading the advanced bash scripting howto will be helpful.

share|improve this answer
I tried it, doesn't seem to work – Joshua Sep 5 '12 at 10:19
What did not work? What is the behavior and outputs? Are you sure rm is not an alias or a function (try with /bin/rm instead). – Basile Starynkevitch Sep 5 '12 at 10:35
works now, it had a space before the colon which I wasn't able to see when I did a ls command – Joshua Sep 5 '12 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .