mv
, cp
, and scp
command-line tools.mv
command to move files or folders from one location to another on the same computer. The mv
command moves the file or folder from its old location and puts it in the new location.% mv ~/Downloads/MyFile.txt ~/Documents/Work/MyFile.txt
% mv ~/Downloads/MyFile.txt ~/Documents/Work/NewFileName.txt
cp
command to make a copy of a file.% cp -R ~/Documents/Expenses /Volumes/Data/Expenses
-R
flag causes cp
to copy the folder and its contents. Note that the folder name does not end with a slash, which would change how cp
copies the folder.scp
command to copy a file or folder to or from a remote computer.scp
uses the same underlying protocols as ssh
.% scp -E ~/ImportantPapers.tgz [email protected]:/Users/username/Desktop/ImportantPapers.tgz
-E
flag preserves extended attributes, resource forks, and ACL information.-r
flag, which isn’t used in this example, causes scp
to copy a folder and its contents.