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

The command executed was "mv space *" in a folder with 14 GB of data.

mv *

du -hs 

is the same so where has the 14 GB of data gone? What have I done?

share|improve this question
More information is needed. Which platform? – Jarmund Apr 18 '14 at 9:06
@Jarmund I think it's safe to assume some *nix, considering that both commands mentioned are common commands on Unix-like systems. In this regard, I think it's safe to say that most shells work the same. So we can deduce enough to give a useful answer even though the exact platform is not explicitly stated. – Michael Kjörling Apr 18 '14 at 10:59
Another pitfall to mention. You should NEVER run mv or cp with "" on untrusted data. That is because "" gets expanded, and files with names like "--verbose" get command-line arguments. What to use instead: cp ./* anotherFolder – Vasya Novikov Feb 27 '15 at 12:56
up vote 30 down vote accepted

My guess is that bash expands the wildcard, and thus moves every folder into your last one.

For example:

$ ls
test1  test2  test3  test4

$ mv *

$ ls

$ ls test4
test1  test2  test3

Here, mv * is expanded to mv test1 test2 test3 test4 corresponding to mv [OPTION]... SOURCE... DIRECTORY format. Thus, every folder is moved into the last one.

share|improve this answer
This. By the way, if you want to use * in a mv (or cp) then have a look at their --target-directory switch. It ensures that you don't get bit by things like this. – Michael Kjörling Apr 18 '14 at 10:58
Thank you for the tip @MichaelKjörling! – ssssteffff Apr 18 '14 at 12:40

As described by @ssssteffff, with mv *, the shell is doing wildcard expansion from files in current directory. However the behaviour of mv command depends on how many arguments * expands to. If there are more than two arguments, then the last argument must be a directory:



I created 5 files

$ touch 1 2 3 4 5
$ ls
1  2  3  4  5
$ mv *
mv: target ‘5’ is not a directory
$ ls
1  2  3  4  5

Now if I create a directory which comes as a last parameter to wild-card expansion, then:

$ mkdir 6
$ mv *
$ ls
$ ls 6
1  2  3  4  5

You should double check what that last argument was.

  • If the last argument was a directory, then your data is perhaps safe.
  • If the total number of arguments were 2, and the last argument was a directory, then also your data is perhaps safe.
  • If the total number of arguments were 2, and the last argument was a file, then the second file is gone for sure.

Are you sure you didn't see the error something like this?

 mv: target ‘5’ is not a directory`
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.