How Could i copy or cut a file from a directory to another directory?
I mean in command line!
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communitySimple: type in terminal
cp /PATH1/file [file2 file3 ...] /PATH2/[newfilename or noting to use the same name]
and for more info about cp
use man cp
mv /PATH1/file /PATH2/[newfilename or noting to use the same name]
and for more info about mv
use man mv
mv
and cp
? copy
and move
didn`t work?
Jul 16, 2012 at 11:13
Hi here we go with a practical example:
1. Copy
raja@badfox:~/Folder$ mkdir copy
raja@badfox:~/Folder$ mkdir move
raja@badfox:~/Folder$ touch file1 file2 file3 file4
raja@badfox:~/Folder$ cp file1 copy
raja@badfox:~/Folder$ ls copy
file1
2. Move
raja@badfox:~/Folder$ ls
copy file1 file2 file3 file4 move
raja@badfox:~/Folder$ mv file2 move
raja@badfox:~/Folder$ ls move
file2
raja@badfox:~/Folder$ ls
copy file1 file3 file4 move
3. Rename
raja@badfox:~/Folder$ mv file3 file2
raja@badfox:~/Folder$ ls
copy file1 file2 file4 move
raja@badfox:~/Folder$
Here is my view of it. You want to move file1 from dir1 to file2 in dir2, So here is how:
mv /PATH/TO/FILE1/ /PATH/TO/FILE2/
practical example:
~/Documents$ ls
text.txt
cd ..
cd Desktop
ls
cd ..
mv ~/Documents/text.txt/ ~/Desktop/text.txt
cd Desktop
ls
text.txt
Hope it helps and isn't too complicated :D