Terminal User Guide
In Terminal, you can move and copy files locally or remotely using the mv, cp, and scp command-line tools.
How can I copy and replace an application via Terminal in Mac OS? Macos shell terminal. How to run a shell script on a Unix console or Mac terminal? How to open Terminal on Mac. The Terminal app is in the Utilities folder in Applications. To open it, either open your Applications folder, then open Utilities and double-click on Terminal, or press Command - spacebar to launch Spotlight and type 'Terminal,' then double-click the search result. Copy Files Remotely. You can also use the ssh connection to copy files to and from a remote host. The command you use for this is scp (secure copy) and it use the same basic syntax as the cp command $ scp source destination But, since scp can copy from the local computer to a remote host or vice versa, you usually add a bit more information.
Tip: It’s easier to move and copy files using the Finder. See Organize files in folders.
Move a file or folder locally
Mac Terminal Copy App
In the Terminal app on your Mac, use the
mvcommand to move files or folders from one location to another on the same computer. Themvcommand moves the file or folder from its old location and puts it in the new location.For example, to move a file from your Downloads folder to a Work folder in your Documents folder:
% mv ~/Downloads/MyFile.txt ~/Documents/Work/MyFile.txtYou can also change the name of the file as it’s moved:
% mv ~/Downloads/MyFile.txt ~/Documents/Work/NewFileName.txt
Terminal App On Mac

See the mv command man page.
Copy a file or folder locally
In the Terminal app on your Mac, use the
cpcommand to make a copy of a file.For example, to copy a folder named Expenses in your Documents folder to another volume named Data:
% cp -R ~/Documents/Expenses /Volumes/Data/ExpensesThe
-Rflag causescpto copy the folder and its contents. Note that the folder name does not end with a slash, which would change howcpcopies the folder.
Mac Terminal Copy Directory
See the cp command man page.
Copy a file or folder remotely
In the Terminal app on your Mac, use the
scpcommand to copy a file or folder to or from a remote computer.scpuses the same underlying protocols asssh.For example, to copy a compressed file from your home folder to another user’s home folder on a remote server:
% scp -E ~/ImportantPapers.tgz username@remoteserver.com:/Users/username/Desktop/ImportantPapers.tgzYou’re prompted for the user’s password.
The
-Eflag preserves extended attributes, resource forks, and ACL information.The
-rflag, which isn’t used in this example, causesscpto copy a folder and its contents.
See the scp command man page.
