Solved

move and copy

Posted on 2013-02-03
5
194 Views
Last Modified: 2013-02-06
what is the difference between mv command and cp command in linux
0
Comment
Question by:walkerdba
5 Comments
 
LVL 30

Expert Comment

by:IanTh
ID: 38848542
see

http://superuser.com/questions/101676/is-there-some-difference-between-mv-and-cp-rm-the-old-file-on-unix

mv just update a pointer in the filesystem whereas cp does that and copy so mv is faster
0
 
LVL 9

Expert Comment

by:user_n
ID: 38848566
The one comand moves the file, delete it, and copy to new location. Cp -copyes the file and the source of the file states on  it's plays.
http://www.math.iitb.ac.in/resources/manuals/Unix_Unleashed/Vol_1/ch05.htm
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 38848576
mv across a filesystem boundary means copying (possibly under a new name)  then deleting the source file, cp is always just a copy (possibly under a new name) without any deletion.

mv inside a filesystem just updates the directory inode(s) with the new file location (and possibly a new name) and doesn't displace any data.

mv inside a directory is always just a rename operation.
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 38848811
cp will always copy file to another

mv could mean:

move file from one place to another (same dir or different dir or filesystem)

rename file
0
 

Author Closing Comment

by:walkerdba
ID: 38860548
yes
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now