Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I have these tricky directories that I can't figure out how to delete. If I run

ls -ld *

I get…

drwxrwxr-x 7 user1 taskfmri 2048 Jan 22 15:26 857263
drwxrwx--- 4 user2 taskfmri 2048 Jan 23 16:32 857263?

There are ~50 of these directories with '?' in the ls. Unfortunately, the '?' isn't literally a ?, but is instead some special character that the terminal can't display

What is the best way to remove all of these directories with unknown special characters, without deleting the almost-identically named good directories?

share|improve this question

If all your directories have names made of digits and then a special char (neither digit nor letter), you could use

find -maxdepth 1 -type d -regex "./[0-9]*[^0-9a-zA-Z]" -exec rm -r {} \;

share|improve this answer

Can't you just do this?

rm -r 857263?
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.