coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mv * command


From: Susanto Wijaya
Subject: Re: mv * command
Date: Tue, 21 Jun 2011 01:21:39 +0800

Hi Eric,

Thanks a lot for your detail explanation, I really appreciated that since I know you all is very busy people :-)

I understand now how it's works


Cheers,

Susanto

On Tue, Jun 21, 2011 at 12:58 AM, Eric Blake <address@hidden> wrote:
On 06/20/2011 08:21 AM, Susanto Wijaya wrote:
> May I ask question about mv * command?

Are you talking about a literal:

$ mv *

typed on the command line?  To see what this really did, try:

$ echo mv *

and notice how the shell expands every existing file name in the current
directory before ever calling mv.  Therefore, mv sees the last expanded
argument as the name of the directory to move files into (assuming the
last file named happens to be a directory)...

>
>
> The question is when I use mv filename command using normal user login, the
> result is all files and directory will lost except might be 1 folder

which explains why doing this in your home directory moves all other
files into the last-named directory, per the 'mv [OPTION]... SOURCE...
DIRECTORY' synopsis form.

>
> If I use mv * command using root user in root directory "/", the result is
> all files and directory in / root directory will gone.

Well, yeah, insofar as possible (the operation may abort a bit early
depending on whether you moved something critical to the success of the
continued operation of mv).  But this is not a bug in mv, so much as the
power of Unix to let you shoot yourself in the foot if you type a stupid
command as root.

>
> Is all directory and files move to /dev/null ?

No, they are all moved to the last directory specified by your command line.

>
> Now all my files in home directory is lost after run the mv * command

Not lost, but moved.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org






reply via email to

[Prev in Thread] Current Thread [Next in Thread]