How to Copy Files on a MacBook with Ease

You can actually drag and drop folders from Finder into a terminal window to paste the path.

For example:

  1. Open a terminal window
  2. Navigate to the folder you want to copy in Finder
  3. Drag that folder from Finder and drop it into the terminal window. This will paste the full path to that folder.

You can then use that path with cp -r to copy the folder.

Using Shell Builtins

We have several shell builtins that can help:

Tab Completion

You can type part of a path or folder name and hit tab to autocomplete, instead of typing full paths.

pushd and popd

pushd will push a folder onto a stack, allowing you to easily switch back to it later with popd without needing to remember the full path.

For example:

$ pushd /Users/myname/Documents 
~/Documents ~
$ cp -r Notes Project 
$ popd
~

This lets you copy files between folders without needing to type or remember full paths.

cd –

cd - will switch back to your previous directory, similar to popd but without a stack.

So you can:

$ cd /Users/myname/Documents
$ cp -r Notes /tmp
$ cd -
~/Documents

To easily switch back.

Hope this gives you some ideas on how to more easily copy/paste folders in terminal! Let me know if any part needs more clarification.