Skip to content

Instantly share code, notes, and snippets.

@joshcarp
Created October 13, 2021 01:39
Show Gist options
  • Save joshcarp/4bab2bd5ef232d8ab48d8cbc88c0f5c2 to your computer and use it in GitHub Desktop.
Save joshcarp/4bab2bd5ef232d8ab48d8cbc88c0f5c2 to your computer and use it in GitHub Desktop.
Differences between cp on macos and linux

macos: cp -r dir/ will copy everything INSIDE output linux will copy the whole folder (output)

macos

mkdir dir1
touch dir1/blah
mkdir dir2
cp -r dir1/ dir2
ls dir2/

outputs:

blah

linux

docker run -i -t --rm=true debian /bin/bash
mkdir dir1
touch dir1/blah
mkdir dir2
cp -r dir1/ dir2
ls dir2/

outputs:

dir1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment