LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to copy (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-copy-875188/)

nbm 04-15-2011 10:23 AM

how to copy
 
Is it possible to copy files from directory of one user to directory of another user in linux????if so how do i do it??.i am new to linux....please help me out. thank u in advance.

repo 04-15-2011 10:39 AM

Welcome to LQ

You can do this as root.
Once copied, just chown the files to the user.
Code:

man chown
for more information
Or you can create a group containing all the users which are allowed to share files with each other.
http://www.cyberciti.biz/faq/linux-s...red-directory/

Kind regards

MTK358 04-15-2011 11:53 AM

If the destination user has permission to read the source file, then you don't need to be root and you don't need chown. Just log in as the destination user and use the cp command as usual to copy the files you want.

jmc1987 04-15-2011 12:06 PM

cp is your friend here.

$ man cp

easy to learn just read up on it.

catkin 04-15-2011 12:13 PM

You might want to preserve the timestamps of the files (especially the last modified times); cp has an option for that.

nbm 04-16-2011 10:03 AM

reply
 
thanks alot...........
that was very useful.

NirvanaII 04-16-2011 11:04 AM

And the actual solution to your question:

Code:

cp -v /home/username/* /home/otheruser
Is one way of doing it. This will copy files only however, and not work recursively to copy sub-directories: to do that add the 'R' option (recursive) to the copy command (cp -Rv). The 'v' means verbose, in other words the actions of copy are reported back to you, rather than you seeing just nothing, and left wondering what's happening.

If the manual is too much of a nerd-literate assault to the brain, try searching a relevant 'howto' in a search engine ('howto cp'), or ask back here. Welcome and good luck!

MTK358 04-16-2011 11:13 AM

Quote:

Originally Posted by NirvanaII (Post 4326383)
And the actual solution to your question:

Code:

cp -v /home/username/* /home/otheruser

I don't think that the OP necessarily wants to copy all of the files.


All times are GMT -5. The time now is 04:16 AM.