Copying Files

Learn how to copy files using the CLI.

The cp command

To copy a file, we use the cp command, and specify the source and destination paths.

Let’s try this out by creating a README.md file in the files/code/elm directory. We then copy that file to the other code directories:

mkdir -p files/{movies,music,photos,docs/{diagrams,markdown},code/{go,js,elm}}
mkdir -p files/code/elm 
echo "# Project README" > files/code/elm/README.md
cat files/code/elm/README.md

We can practice the code in the terminal below.

Get hands-on with 1400+ tech skills courses.