Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Copying Files - macOS Terminal

00:00 Let’s move on a little bit. So we were, or we still are, in the pb_terminal/ folder, where you created the file hello_terminal.py.

00:09 With ls, you can list the contents of the current directory. And now I want you to copy this file, the hello_terminal.py file, into a subdirectory named hello/. How would you go with this?

00:24 Okay, so I would go about this by first making the subdirectory. I’m going to say makedir hello, you said? That’s the name of the directory, yeah.

00:34 Okay, so I make this directory. Then I can check, is it here? You can see now when I list the contents of pb_terminal/, I have both the file and also folder, and it colors the folders differently than files, so there’s, there’s a bit of this color-coding going on as well.

00:49 And now I am going to copy hello_terminal.py into hello/. And then I don’t even need to give it a name. If I don’t specify a name, then it’s just going to use the same name. Okay, cool.

01:04 So, cp stands for copy? Yes. Okay. So, when you’re now moving into the hello/ directory, then there should be the same file again. And it also has the same content.

01:19 Perfect. So it’s basically like using copy and paste on the Finder. Yeah. And the other one’s still here too. So here I still have—oops, just because I did it, when I press Tab here, because there’s both a hello/ folder and hello_terminal, it gives me the option to choose.

01:39 I can tab through it and then select the one I want and press Enter.

01:44 Okay. Just, but we want it to be inside of here, right? Inside of the hello/ folder.

Become a Member to join the conversation.