move and copy

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

Expert Comment

ID: 38848542

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

Expert Comment

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.
LVL 68

Expert Comment

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.
LVL 40

Accepted Solution

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

Author Closing Comment

ID: 38860548

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

910 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

22 Experts available now in Live!

Get 1:1 Help Now