How do I move files using mv and change ownership at the same time?
I had an issue where my top and bottom menu panels were not loading correctly on my ubuntu XFC desktop. So, I created a new user to get the panel back to normal.
Now I'm in the process of moving all my folders from user1 to the new user2's home directory. So, this is what I've been doing.. Can someone tell me the more efficient way to go about doing this? I'm moving one folder at a time from the terminal with the following command. Code:
sudo mv -f /home/user1/linux /home/user2/linux Code:
sudo chown -hR user2 /home/user2/linux/ Code:
user@brits:~/linux$ ll I'm sure I could probably use one command to move all my files and folders from user1 to user2 home directory so appreciate any help. Also, any tip on deleting user1 and all the .cache folders ,etc associated with user1 would be helpful. I was thinking it *should* delete all the folders if I go into this menu.. System> Users and groups and delete the user1 account. I was concerned that if I delete this user1 that it might mess up the group associations I listed above?? Thanks Edit, I figured out how to change the group on all my files as well using the chgrp command. Still looking for tips to be more efficient in the future. |
For the mv command, try this:
Code:
sudo mv /home/user1/* -tu /home/user2/ -u move only when the SOURCE file is newer than the destination file or when the destination file is missing That should move the entire contents of /home/user1 to /home/user2. For the chown command, try this: Code:
sudo chown -R user2:group /home/user2/ |
Cool. Thanks for these tips bigrigdriver.. I'm going to try the mv arguments you provided when I get home this morning and see how that works out. Nice sig file.
|
All times are GMT -5. The time now is 12:37 AM. |