Copying file from folder 1 to folder 2 in terminal

I am trying to move a text file from folder 1 to folder 2 via terminal. I'm doing this for a school project to show what actually happens when you copy paste.

I'm doing

cp/home/rits/desktop/folder1
cp/home/rits/desktop/folder2

and I get

rits@W:~$ cp/home/rits/desktop/folder1
bash: cp/home/rits/desktop/folder1: No such file or directory
tits@W:~$

If you guys can help me out or have any other commands to show how to do basic things like formatting a USB, deleting a file, making a new folder, copying and pasting, moving files via terminal please comment.

2

3 Answers

Spot the difference:

cp /home/rits/Desktop/folder1/name_of_textfile /home/rits/Desktop/folder2/
  • a space after cp
  • desktop will be with a D, not a d
  • after that are 2 arguments: filename and destination
  • if you want to copy directories you need -R as an option after cp.
2

You're using cp the incorrect way, and possibly your desktop folder is called Desktop (but in fact I am on a national language version, so I cannot be sure).

Let's assume that you have these 2 folders:

  1. /home/rits/Desktop/folder1
  2. /home/rits/Desktop/folder2

Also assume that folder1 contains the file: text.txt. Now if you'd like to copy text.txt from folder1 to folder2, you'd go:

cp /home/rits/Desktop/folder1/text.txt /home/rits/Desktop/folder2 

To learn more about commands, either read the manual page of that command by typing man command_name or you can search the internet, and find a vast amount of beginner information like:

2

If you are using MAC book, you are suppose to use following command

cp -R "File/Path/abc.txt" "Destination/Folder/Path"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like