Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 note a strange behavior of mv/cp on Linux. The directories A and A/. should be equivalent but as arguments for the source they seem to behave differently. Is that a bug? Of course you could ask why should I use A/. instead of A as source but sometimes one wants "." as source and the same strange things happen... Maybe someone knows an answer.

Let's start with

$ mkdir A A/A1 B

and now

variant 1)

$ cp -r A B
$ ls B

All right.

variant 2)

$ cp -r A/. B
$ ls B

Why "A1" and not "A"?

variant 3)

$ mv A B
$ ls B

All right.

variant 4)

$ mv -i A/. B
mv: overwrite `B/.'? y
mv: cannot move `A/.' to `B/.': Device or resource busy


share|improve this question
@SachinDivekar You have mkdir -p aliased. – Daniel Beck Dec 6 '11 at 12:15
@DanielBeck sorry my bad. forgot -p – Sachin Divekar Dec 6 '11 at 12:26
on the other note, no need to mkdir A A/A1 B you can just do mkdir -p A/A1 B it will create A and A/A1 automatically. – Sachin Divekar Dec 6 '11 at 12:26

"A" and "A/." are both directory entries that point to the same thing, but they are themselves different things. "A" is an entry in the current directory, and "A/." is an entry named "." in the A directory. Think of it as operating on a box from the outside, vs. operating on the box from the inside.


cp -r A B

Copies A into B.

cp -r A/. B

Goes into the directory A and copies the contents of the current directory (i.e. ./A1) into B.

mv A B

Moves the directory entry named "A" from the current directory into B.

mv -i A/. B

Tries to move the directory entry "." out of A into B. However, there's already an entry named "." in B. In general, you can't move "." (that's like trying to move the box from the inside).

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.