LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2011, 11:23 AM   #1
nbm
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Rep: Reputation: 0
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.
 
Old 04-15-2011, 11:39 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
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
 
1 members found this post helpful.
Old 04-15-2011, 12:53 PM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
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.
 
1 members found this post helpful.
Old 04-15-2011, 01:06 PM   #4
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7
Posts: 872

Rep: Reputation: 112Reputation: 112
cp is your friend here.

$ man cp

easy to learn just read up on it.
 
1 members found this post helpful.
Old 04-15-2011, 01:13 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
You might want to preserve the timestamps of the files (especially the last modified times); cp has an option for that.
 
1 members found this post helpful.
Old 04-16-2011, 11:03 AM   #6
nbm
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Original Poster
Rep: Reputation: 0
reply

thanks alot...........
that was very useful.
 
Old 04-16-2011, 12:04 PM   #7
NirvanaII
Member
 
Registered: Jun 2005
Posts: 139

Rep: Reputation: 18
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!
 
1 members found this post helpful.
Old 04-16-2011, 12:13 PM   #8
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
Quote:
Originally Posted by NirvanaII View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dow copy copy-protected cds with dd commant gh_D_ir Linux - Software 4 04-01-2011 05:41 PM
CLI copy is greater than GUI copy ?? 0_o killahsmurf Slackware 14 01-04-2006 12:53 PM
boot error after using Copy Commander to copy debian system onto larger new drive Interceptor Linux - Hardware 7 05-04-2003 01:40 PM


All times are GMT -5. The time now is 11:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration