You are not logged in.
Pages: 1
I accidentally copied a file using * as the destination, like this:
cp /path/to/file *
There was no error so it must have done something but I can't figure out what.
Can anyone tell me what that command does, thanks.
Last edited by r6 (2010-08-31 07:15:29)
Offline
* is expanded to all the files in your current directory except for ones beginning with a dot.
cp with multiple (n) files listed will copy the first n-1 files to the nth file which should be a directory.
In the future use the -i option to avoid mistakes like this.
Last edited by fsckd (2010-08-31 05:19:43)
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
OK, I see that now. It copied everything into the last file (directory) in the list. Interesting, thanks.
Offline
Hehe getting used to the terminal in the beginning can be fun, you are bound to make some mistakes - I still do at times
In the mean time adding these to your .bashrc could be helpful safer:
alias mv="mv -i"
alias cp="cp -i"
alias rm="rm -i"
Offline
Pages: 1