I am trying to learn how to copy a from one folder to other using command prompt using 'cp' command,file is getting copied from "home" folder to "documents" folder but i am unable to copy from "documents" folder to "home" folder.Can someone explain why?

closed as unclear what you're asking by Sylvain Pineau, muru, Rinzwind, steeldriver, Byte Commander Jul 24 '15 at 15:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What do you mean with home folder? Your home folder, eg /home/identicon or /home – A.B. Jul 24 '15 at 13:07
  • Is there any error output? – Arch user Jul 24 '15 at 13:07
  • 2
    Don't make /home a garbage.. It's the designated place for individual users home directories.. – heemayl Jul 24 '15 at 13:35
  • 2
    You need to edit your question and post the exact commands you are typing, with exact capitalization: otherwise we can only guess what the issue is. – steeldriver Jul 24 '15 at 13:38
  • 1
    Please provide the actual commands or this will be riddled with comments and the answers will be partially guesses – Rinzwind Jul 24 '15 at 14:54

That depends on what your command actually looks like.

The following would work:

cp /home/$USER/Documents/file /home/$USER

Or as @kos suggested:

cp ~/Documents/file ~/
  • This will copy the whole ~/Documents/ folder to ~/; also maybe use the shorthanded cp ~/Documents/file ~/, this way the command will also work right away once copy-pasted – kos Jul 24 '15 at 13:11
  • Notebook-PC:~/Documents$ cp b.txt /Home is the command – identicon Jul 24 '15 at 13:18
  • /home is not writabel by a normal user. My guess is you want to copy it to your own homefolder, which is /home/yourusername. The command is then cp b.txt ~/ (see above). If you do want to copy it in just plain /home, you will have to run sudo cp b.txt /home. – aairey Jul 24 '15 at 13:25
  • @identicon Linux systems are case sensitive, so you want sudo cp b.txt /home – kos Jul 24 '15 at 13:31
  • @aairey Please use $USER (it will change the command into the user used so tends to work for all of us). Or of course "~" – Rinzwind Jul 24 '15 at 14:47

First go to the location from where the file is to copied using the cd command.Then:

cp "foldername" -R ~/"foldername"
  • This will copy recursively all the directories / files in foldername in ~/foldername – kos Jul 24 '15 at 13:39
  • Ok i am sorry I mistook the question for the abovesaid. Yes it will. – Rahul Nair Jul 24 '15 at 13:45

You can't copy documents into the /home folder without sudo rights. To do that, use this command

sudo cp /home/$USER/Documents/file_name /home

or to save the permissions (thx @kos)

sudo cp --preserve=mode,ownership /home/$USER/Documents/file_name /home

If you meant your home folder, than use

cp /home/$USER/Documents/file_name ~


cp /home/$USER/Documents/file_name /home/$USER/
  • not working with sudo also – identicon Jul 24 '15 at 13:16
  • And if one wants to preserve permissions / ownership: sudo cp --preserve=mode,ownership /home/identicon/Documents/file_name /home – kos Jul 24 '15 at 13:17

To copy from your documents folder try:

cp filenameHere /home/$USER

For example, assuming I am located at the Documents folder:


And I want to copy the file: foo.txt to my home folder:

cp foo.txt /home/$USER

If you are not currently on the Documents foler, you must cd to it first:

cd /home/$USER/Documents

Then you can do ls to list your files, remember, the terminal and linux commands are case sensitive:


After the files are listed, use the cp command to copy to the location you want.

  • it is creating a file named home in documents folder itself – identicon Jul 24 '15 at 13:19
  • To do that do: 1 >> home.txt where 1 is the content of the file, this is a fast way, so you can create any file, with any title if no file with the same name is already on the current location. – GTRONICK Jul 24 '15 at 13:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.