Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 several files' names starting with "._". I'd like to remove the point and underscore in a script. Howto do this?

Thank you very much in advance.

share|improve this question
Great question, but scripting q's really belong on stack overflow. – Amanda Jan 28 '12 at 1:11
@Amanda you mean :) – medigeek Jan 28 '12 at 23:33
@medigeek, aah. right. – Amanda Jan 29 '12 at 1:56

This is a dry-run (simulates the command, doesn't execute it):

rename -n 's/^\._//' ._*

If you like the output, execute it:

rename -v 's/^\._//' ._*
share|improve this answer

using rename:

rename -v 's/\._//' ._*


$ touch ._aaa
$ rename -v 's/\._//' ._*
._aaa renamed as aaa
share|improve this answer

Your question can be interpreted in two ways, "renaming" and "get the filename with ._ removed". For rename, see the other questions. For the second possibility, use variable expansion:

# the below will output: ._file becomes file
echo "$name becomes $stripped_name"
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.