LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 03-12-2010, 05:57 PM   #1
pgb205
Member
 
Registered: Nov 2007
Posts: 129

Rep: Reputation: 15
Does mv retain permissions


if I mv from one location on harddrive to another.
I don't see anything in manpage.

thanks
 
Old 03-12-2010, 06:05 PM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
mv tries to preserve permissions
 
Old 03-12-2010, 06:25 PM   #3
worm5252
Member
 
Registered: Oct 2004
Location: Atlanta
Distribution: CentOS, RHEL, HP-UX, OS X
Posts: 567

Rep: Reputation: 57
In my experience it always has. Thats not to say something else wont update those permissions later.
 
Old 03-12-2010, 09:20 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,649
Blog Entries: 4

Rep: Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934
Another good tool to consider for this purpose is: rsync.

This tool specifically does support handling of permissions, modification dates and so on. Plus, "efficient synchronization." It might be more suitable to your needs.
 
Old 03-12-2010, 11:56 PM   #5
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
mv destroys the file on the original space and recreates the same in another.

Basically, it cannot be done by a subordinate user unless the original file permission is set to allow "group" or "others" to execute the command. Try doing it against some 'root'-owned-files while logged as another user, learn from that. This could happen with other files (by non-root users) with exclusive permissions.

One thing, 'mv' stamps permissions on the the newly recreated file based on the 'umask' set by the system for the user executing the same.

Hope this helps.
 
Old 08-09-2015, 11:34 AM   #6
phillinux
LQ Newbie
 
Registered: Mar 2009
Posts: 14

Rep: Reputation: 0
mv does not always destroy

If the source and destination are on the same block device, the "mv" command will simply rename the source. For this reason mv will seem to work very quickly. I also agree that rsync is a great tool. I think the -a flag preserves permissions and ownership and -r will strip them.
 
  


Reply



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
How to retain .bashrc file? tulsi Linux - Newbie 3 09-08-2009 05:31 PM
Retain variables in C kalimat Programming 10 05-27-2009 01:36 AM
retain file permission lightpace Linux - Newbie 1 12-06-2007 12:47 AM
Retain old status raylhm LQ Suggestions & Feedback 9 11-15-2006 12:28 PM
KDE won't retain settings murray_linux Slackware 7 09-19-2004 01:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:03 PM.

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
Open Source Consulting | Domain Registration