Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How Could i copy or cut a file from a directory to another directory?

I mean in command line!

share|improve this question
2  
You might also want to look at their man pages Copy and Move –  atenz Jul 16 '12 at 11:15

3 Answers 3

up vote 6 down vote accepted

Simple: type in terminal

For copy

cp /PATH1/file /PATH2/[newfilename or noting to use the same name]

and for more info about cp use man cp


For cut(move and rename)

mv /PATH1/file /PATH2/[newfilename or noting to use the same name]

and for more info about mv use man mv

share|improve this answer
    
thank you! but i have to use just mv and cp? copy and move didn`t work? –  Milad Sobhkhiz Jul 16 '12 at 11:13
1  
you @MiladSobhkhiz can use copy and move too, depending in what os you are using.... –  geoh Jul 16 '12 at 11:21
1  
He said, he is using Ubuntu –  Anwar Shah Jul 16 '12 at 11:29
1  
The correct commands are mv and cp. You can create alias if you want and make copy respond to cp for example. –  LnxSlck Jul 16 '12 at 11:35

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

share|improve this answer

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$ 
share|improve this answer

Your Answer

 
discard

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.