CE Home
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Notices


Advertisements
Reply
 
LinkBack (1) Thread Tools Display Modes

  1 links from elsewhere to this Post. Click to view. #1 (permalink)
Old 10th October 2008, 12:55 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Red face Difference between cp and mv commands in UNIX

CEans,

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?
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)
Old 10th October 2008, 01:56 PM
CEan - Value Adder
 
kidakaka's Avatar
 
Join Date: 18th October 2006
Location: Mumbai, Hyderabad
I'm a Crazy Computer Science Engineer
Posts: 472
Send a message via AIM to kidakaka Send a message via MSN to kidakaka Send a message via Yahoo to kidakaka Send a message via Skype™ to kidakaka
Default Re: Difference between cp and mv commands in UNIX

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.
kidakaka is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 10th October 2008, 02:17 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Default Re: Difference between cp and mv commands in UNIX

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.
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 10th October 2008, 07:10 PM
CEan - Value Adder
 
kidakaka's Avatar
 
Join Date: 18th October 2006
Location: Mumbai, Hyderabad
I'm a Crazy Computer Science Engineer
Posts: 472
Send a message via AIM to kidakaka Send a message via MSN to kidakaka Send a message via Yahoo to kidakaka Send a message via Skype™ to kidakaka
Default Re: Difference between cp and mv commands in UNIX

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
kidakaka is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)
Old 10th October 2008, 07:13 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Default Re: Difference between cp and mv commands in UNIX

I see! Thanks a ton for your response.
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)
Old 13th October 2008, 05:30 PM
CE - Regular Member
 
Join Date: 25th September 2008
I'm a Crazy CSE Engineer
Posts: 65
Default Re: Difference between cp and mv commands in UNIX

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
Sriram
sriramchandrk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)
Old 13th October 2008, 06:28 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Default Re: Difference between cp and mv commands in UNIX

That will be great. I only want to know if there's much to mv and cp than 'cut' and 'paste'.
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.crazyengineers.com/forum/computer-science-engineering/6188-difference-between-cp-mv-commands-unix.html
Posted By For Type Date
Difference between cp and mv commands in UNIX - CrazyEngineers Forum This thread Refback 10th October 2008 02:01 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
MSDOS commands geek101 Computer Science & IT Engineering 1 7th October 2008 08:19 AM
Difference b/w plasma and LCD samarjeetsaigal General Help 4 13th September 2008 06:17 PM
Difference between NTFS & FAT32,FAT? sree kumar Computer Science & IT Engineering 1 30th August 2008 07:43 PM
Difference between transister and op-amp manivannan.mv Electrical & Electronics Engineering 7 8th August 2008 02:38 PM
Windows shortcuts and commands friendster7 Computer Science & IT Engineering 6 5th March 2008 09:37 PM


All times are GMT +5.5. The time now is 01:01 PM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.

Advertisements