Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-02-2002, 05:15 AM   #1
Registered: Feb 2002
Location: Basque Country
Distribution: Fedora 14, Ubuntu 14.04
Posts: 428
Blog Entries: 1

Rep: Reputation: 36
How to copy one file in all users directories

Hi, I'm trying to do a script that copies some files in users directories as superuser,
for example, I want everyone to have the same .emacs file, but I cannot copy it one by one cause they're 100, I would like to do a script that copyes it to everyone at once.
How could I do that?
Old 09-02-2002, 08:32 AM   #2
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2

Rep: Reputation: 34
for usr in /home/*
cp /root/file $user/

( You can also grep and cut the passwd file to get a user list, trim it and do something like for usr in `cat /tmp/lst`; do cp /root/file ~$usr/; done; and many more fancy things )


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
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 01:23 PM
Copy files from different directories fiomba Linux - Software 3 02-11-2005 04:01 AM
Copy one file to multiple directories cmfarley19 Linux - General 9 11-10-2004 01:57 PM
How do I copy home directories back? G-wizz Linux - Newbie 5 06-11-2004 07:20 AM
copy directories and subdirectories Red Squirrel Linux - Newbie 2 03-06-2004 10:18 PM

All times are GMT -5. The time now is 09:54 AM.

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