Creating a File - Windows Terminal
00:00 Currently, this directory is empty because you just created it. So let’s create a file in it. Okay. And since we are on a Real Python course, let’s create a Python file. Yeah.
00:12
And call it hello_terminal.py
. Okay. Now this is where a command is slightly different from the Linux versions, but you can use ni
, which stands for new item. And I will mention, just as a side note, that all of these commands I’ve used so far are actually aliases, or nicknames, for different commands. The full command is new-item
, but you can abbreviate that to ni
for new-item
.
00:40
And then it was hello_terminal.py
. Exactly. There we go. Yeah, this will just create a file. And now when you want to show that this pb_terminal\
folder is not empty, how would you go with this? Well, I would usually list the contents of the folder, and I can do that with the ls
command,
01:05 which will show me everything that’s in this directory. At the moment, there’s just one item, and it looks very similar to the previous command because it’s showing me what it created, and now it’s showing me what’s in the folder, and since it’s the same thing, the commands are almost—the outputs are almost—identical. But if I had more files in here, they would be listed underneath this line or before, depending on the alphabetical order.
Become a Member to join the conversation.