Skip to main content

Unit 2 路 Basic Commands 路 Lesson 15 of 34

Copy that!

cp

In Linux, we use the cp (copy) command to copy files from one place to another.

You'd use it like: cp file_path destination

This creates a copy of the file, the original still stays right where it was. You can also give the copy a new name in the same step: cp file.txt file_backup.txt

馃挕 Pro tip: Copying a directory needs the -r flag, like cp -r folder_name destination, or it'll throw an error.

Live Linux terminal

This lesson comes with a real Ubuntu machine that runs in your browser, so you type every command yourself. Create a free account to do this part.

Do this lesson for real

With a free account you get the terminal, the challenges and the checks that go with every lesson in Intro to Linux, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.