hi. sorry if the title is "weird", but it's just me trying to hint of my feelings of frustration. just when i think i was getting a handle on the Command Line, i go and do something stupid which (potentionally) does serious damage to my system. this time (again) it has to do w/ the "move" command, [ mv ] for all of the previous success i've had lately w/ just "going for it" and trusting the instinct i've earned from my experience, and following my desire to "master" the command line (vs. using Konqueror, for example), i failed at moving some files and i'd like to know precisely what i did wrong so i might learn precisely how to never do it again. have a look at the terminal history: Code: [root@localhost ~]# mv -v /home/USERNAME/01_Downloads/Software/Browser/SwiftFox/swiftfox /usr/local/* `/home/USERNAME/01_Downloads/Software/Browser/SwiftFox/swiftfox' -> `/usr/local/src/swiftfox' `/usr/local/bin' -> `/usr/local/src/bin' `/usr/local/etc' -> `/usr/local/src/etc' `/usr/local/games' -> `/usr/local/src/games' `/usr/local/include' -> `/usr/local/src/include' `/usr/local/kompozer' -> `/usr/local/src/kompozer' `/usr/local/lib' -> `/usr/local/src/lib' `/usr/local/libexec' -> `/usr/local/src/libexec' `/usr/local/man' -> `/usr/local/src/man' `/usr/local/RealPlayer' -> `/usr/local/src/RealPlayer' `/usr/local/sbin' -> `/usr/local/src/sbin' `/usr/local/seamonkey' -> `/usr/local/src/seamonkey' `/usr/local/seamonkey-1.1b' -> `/usr/local/src/seamonkey-1.1b' `/usr/local/seamonkey-sysver-bak' -> `/usr/local/src/seamonkey-sysver-bak' `/usr/local/share' -> `/usr/local/src/share' [root@localhost ~]# cd /usr/local [root@localhost local]# ls -h src [root@localhost local]# ls -l total 8 drwxr-xr-x 17 root root 4096 Jan 1 01:01 src i realize i should be able to interpret all of this on my own, but it's nice to get reassurance too. (specifically-- why the "src" folder? is it looking at the "S" from swfitfox as a wildcard?) i'm guessing this is a result of the asterisk i used at the end of the "destination", where i used "/usr/local/*". is this what caused the files from /usr/local/ itself to be copied into the src dir? forgive my ignorance, but why exactly did this happen? is there any kind of "Undo" for the command line? or-- an equivalent i could do where i could return the files to their original locations based, for example, on date and time (or some other way of getting the system to "move it back") to the way it was before i executed this command? any options at all for an "undo" type of action? so, i'm looking for 2 answers here: 1.) why did it happen, and 2.) is there something i can do in the future if / when this happens? thanks!
You're 100% right here. mv looks at the last argument as it's destination (see 'man mv')' The asterisks is expanded by the shell before the move command is executed. In you example, I would say you can just omit the last asterisk. If you want to avoid shell variable expansion, you can enclose the wildcard string with single of double quotes. See 'man bash' or 'man sh' to learn about the difference between single an double quotes.