CP and MV Commands in Unix/Linux

 
Commands:
 CP and MV
 
 
Unix/Linux Command CP
 
CP is the command used in Unix and Linux to copy your files or directories.
 
(http://www.rapidtables.com/code/linux/cp.htm)
 
Examples of the CP command:
 
cp -u *.txt newdir
Copies any file with the extension “.txt” to the directory “newdir” if the files do not
already exist, or are newer than the files currently in the directory. The option “-u”
means “update,” so this is why it will only copy the files this way.
cp file1.txt newdir
Copies the file “file1.txt” from the currently selected directory to the “newdir”
directory
 
Unix/Linux Command MV
 
MV is the command used in Unix and Linux to move or rename files or
directories.
 
(http://www.rapidtables.com/code/linux/mv.htm)
 
Examples of the MV command:
 
mv file1.txt newdir
Moves the file “file1.txt” to the directory “newdir”
mv myfile subdir/myfile2
Moves the file “myfile” to the sub-directory named “myfile2”
mv bak bak2
Rename the directory “bak” to “bak2”
Slide Note
Embed
Share

CP and MV commands in Unix/Linux are essential for copying and moving files or directories. CP is used to copy files with various options for different scenarios, while MV is used to move or rename files. Learn examples and practical usage of these commands to efficiently manage your files on the terminal.

  • Unix/Linux
  • Commands
  • File Management
  • Copying
  • Moving

Uploaded on Jul 20, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Commands: CP and MV

  2. Unix/Linux Command CP CP is the command used in Unix and Linux to copy your files or directories. (http://www.rapidtables.com/code/linux/cp.htm)

  3. Examples of the CP command: cp -u *.txt newdir Copies any file with the extension .txt to the directory newdir if the files do not already exist, or are newer than the files currently in the directory. The option -u means update, so this is why it will only copy the files this way. cp file1.txt newdir Copies the file file1.txt from the currently selected directory to the newdir directory

  4. Unix/Linux Command MV MV is the command used in Unix and Linux to move or rename files or directories. (http://www.rapidtables.com/code/linux/mv.htm)

  5. Examples of the MV command: mv file1.txt newdir Moves the file file1.txt to the directory newdir mv myfile subdir/myfile2 Moves the file myfile to the sub-directory named myfile2 mv bak bak2 Rename the directory bak to bak2

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#