In the past when I only used Linux, I always kept backups of my hard drive. The easiest and safest way at that time was to copy everything to another hard drive. There were programs that could be used, but I thought it was important that I do the copying myself. If a program makes a mistake, you can blame the author of the program, but it doesn’t get your files back if you really need them. If you copy folders and files yourself, you know it is being done correctly, and who is to blame if it is not.
Words called commands are used in the Terminal on your Mac. You can find Terminal in Launchpad, by clicking on Utilities. Terminal is very powerful even though it looks like an empty box, or a wimpy text editor. Administrators of both large and small systems use Terminal to maintain, upgrade, and troubleshoot systems they maintain. Don’t be fooled by the looks of Terminal, it is a very powerful tool.
Below are two command strings showing two ways of copying folders and files from the hard drive on your Mac to a usb stick or usb hard drive you have plugged in using Terminal. Terminal is faster than using a program. I have used the second command “rsync” with Linux, but Apple recommends you do not use rsync to copy folder and files on your Mac. More on rsync and Apples warning below.
Commands you may give your Mac by typing in Terminal are done immediately and not processed by a graphical program checking itself to see which boxes you may have checked, and then issuing the (hopefully) proper command.
Most people will never have any real need to use a Terminal. It is worth using Terminal a few times, so you can start to understand how graphical programs you use work. Everything done in a program can be done by typing commands and instructions in Terminal. It would not be quick or fun, but computing was done this way before desktops and Gui’s.
Using these commands in my Mac Terminal, I moved a few files from Movies folder to a usb stick. If you want to try too, use copies of files which are also saved somewhere else. That way if a mistake is made, the power goes out, or something else happens your files are safe.
The first folder and file copy I did on my Mac, I used a command named “rsync” to copy the contents of the folder “Movies” on my Mac hard drive to a plugged in USB stick named usb1. Apple recommends you not use the command “rsync”. Use instead Apples suggested command “rcp”.
Apple says “rcp” is safer than using rsync. If you use the command “rcp” which Apple recommends there can be folders and files on your usb stick or usb hard drive before you copy more folders and files to it. The folders and files there will not be harmed or changed in any way. With rsync where you are copying too needs to be empty. If it is not, rsync erases what is there.
Read everything below before you try this yourself. This helps saves any confusion from happening while you are trying to copy folders and files while using Terminal.
Copy using RCP:
Plug in your usb stick or usb drive before opening the Terminal. Using the Terminal of your Mac, before typing anything else in Terminal, type exactly as you see, changing the name ‘usb1’ to whatever your usb stick or usb drive is named. You may also wish to change the folder “dir1” to something else, or not. There is one space between rcp and -. One space between pr and Movies. One space between the two / / in the middle.
Here is the command for rcp: rcp -46pr Movies/ /Volumes/usb1/dir1
What this Terminal Command does is copy everything inside the folder ‘Movies’ to the usb stick or usb hard drive named usb1, copying all files and folders to a folder named “dir1”. The letters -46pr tell rcp to copy everything and keep everything in the order it is in the folder Movies. It would not be good to find your copy was completed with its folders and files all mixed up.
If the files are small, the command will be completed quickly. If they are large files, it may take some seconds. Do not be in a rush, rcp will tell when it is done.
The command “rcp” which Apple suggests should be used instead of “rsync” is preferred and safer to use. According to Apple – using “rsync” is using it at your own risk as it may cause problems. I am not sure why this is so, as “rsync” is a common Linux way of backing up folders and files, or the full contents of a hard drive.
The rsync command and string is below. I used rsync on my Mac without issue, but you should not. I strongly suggest you follow Apples suggestion and only use rcp, just in case rsync does cause a problem on your Mac.
Using rsync – at your own risk on a Mac:
Important rsync note: If your usb stick or usb drive is not empty before using “rsync”, the string “–delete” erases everything on your usb stick or usb drive before the copy is started. If you want what is on your usb stick, or usb drive, you need to save the files somewhere else before you try this. Where you are copying the files to needs to be empty, or it will be erased before copying starts.
Plug in your usb stick or usb drive before opening the Terminal. Using the Terminal of your Mac, before typing anything in Terminal, to try the rsync command, type in the following command, changing the name ‘usb1’ to whatever your usb stick or usb drive is named.
rsync -av –delete Movies/ Movies/ /Volumes/usb1/
If you find using terminal to copy files fun, and you want to learn more, there is wealth of information on the web. Ensure you go to trusted websites for your information. Reading old posts may be simple, but there is no way to know if what was typed is correct. Too often some typed command is not right in these old posts, and they will not work correctly. There are of course people who knowingly posted information that could hurt your Mac. They thought it was funny at the time.
Learning the basics of using Terminal is fun and rewarding. Anyone can point and click. Knowing what and why you are pointing and clicking is real knowledge. Knowledge is fun, and sometimes pays well too. At the very least you will be able to say, “Been there, done that. Got the copy.”