MacOS vs Linux — the cp command will trip you up!

BSD and Linux mascots
Screen showing test failures
# Creates "source_directory" in the current working directory
$ mkdir source_directory
# Creates 2 new empty files within "source_directory"
$ touch source_directory/{file1,file2}
# Creates "destination_directory" in the current working directory
$ mkdir destination_directory
# Intended to copy the contents of "source_directory" to "destination_directory", hence the trailing slashes
$ cp -R source_directory/ destination_directory/
# Lists the contents of "destination_directory"
$ ls destination_directory

GNU (Linux):

$ ls destination_directory
source_directory

BSD (MacOS):

$ ls destination_directory
file1 file2

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ackshaey Singh

Ackshaey Singh

Ads Engineering @Twitter, part time entrepreneur — built Firecode.io, options and algorithmic trading enthusiast