CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@Kaustubh Katdare • 10 Oct, 2008

I've a simple query related to UNIX. What is the difference between cp and mv commands in UNIX?

Are these commands similar to copy and 'cut' command operations that we do in Windows? Are there any other differences?
@Prasad Ajinkya • 10 Oct, 2008 Biggie,

The cp command will copy one file to the another destination without deleting the original. The mv command will move the file to the other destination (copy the file to the destination and then delete the original). Same concept behind the difference of "Copy and Paste" v/s "Cut and Paste".

It gets more complex, when you consider these commands with the folders instead of files.
@Kaustubh Katdare • 10 Oct, 2008 Yep, I'm aware of that difference. I want to know if there's more to cp & mv commands, while working with files?

Thanks for the response.
@Prasad Ajinkya • 10 Oct, 2008 Yes, try man pages for detailed dope. But you start seeing the nuances when you do commands like
cp -r /home/kidakaka/mycrap/* /newfolder/newfolder/newfolder/newfolder
mv -r /home/kidakaka /home/prasad

Or in a different way ... eg. using mv as a renaming tool
@Kaustubh Katdare • 10 Oct, 2008 I see! Thanks a ton for your response.
@sriramchandrk • 13 Oct, 2008 Hi,

You need to know about unix file system.

We should know the data structure in it i.e., superblock, inodes, databolocks.

mv and cp are just operations on them!

Its long time since i read it, i have totally forgot, i can just give a link to the text book!

Design of Unix Operating System - Maurice J. Bach

Will read today and let you know the right answer.

Thanks & Regards
@Kaustubh Katdare • 13 Oct, 2008 That will be great. I only want to know if there's much to mv and cp than 'cut' and 'paste'.

Related Posts

@Vasu M · Aug 18, 2015

Hai friends, I am new to this page, I have completed my Engineering in Electronics and Communication, I want to start a company related to my field in small scale,...

@Ankita Katdare · Aug 2, 2011

The Graduate Record Examinations (GRE) test is to measures verbal reasoning, quantitative reasoning, and critical thinking and analytical writing skills. Tests gauge undergraduate achievement in 8 specific fields of study...

@aarthivg · Apr 14, 2012

does oscillator require feedback.If so what type of feedback? positive of negative?

@Kaustubh Katdare · Mar 15, 2008

Let's see what our CEans have to say about this. Many colleges and corporates have a dress-code policy. Some of the colleges have their own uniform and some of the...

@safwan · Nov 10, 2009

well, I have project for my grade 12 board exam in subject Informatics Practices. I have to make a inventory system and have to produce reports . For this I...