From the course: Unix Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Copying files and directories

Copying files and directories - Unix Tutorial

From the course: Unix Essential Training

Start my 1-month free trial

Copying files and directories

- [Instructor] Let's learn how to copy files and directories in Unix. Just like we did with move, we're going to be doing that from the command line. In the last movie, we moved a lot of our files into the my_project directory. If I type ls -l, we'll see what those are. You can see I've got several files that are in here as well as a couple of directories. Let's start by trying to copy this file right here, file_second.txt. The way we're going to do that is with the cp command, short for copy. Just like we had mv for move, we have cp for copy. We'll use a space and then we'll take any path to the target that we want to copy. The file we want is in the current working directory, so we can just type its name, file_second.txt. But we could easily provide a path to a file that was somewhere else, either an absolute path or a relative path. And then we want to put the target. Where do we want to copy this file to? Again…

Contents