1
00:00:05,440 --> 00:00:08,640
Alright, you now know what files and 
directories are, and can navigate 

2
00:00:08,640 --> 00:00:12,868
around your directory structure using your 
operating system's file manager program. 

3
00:00:13,040 --> 00:00:18,448
In this video, we'll learn how to do that from 
a Windows command prompt, or a Linux terminal. 

4
00:00:19,520 --> 00:00:24,833
The Mac OS and Linux operating systems are both 
based on an earlier operating system called Unix. 

5
00:00:24,833 --> 00:00:29,583
Because they're both based on Unix, they 
both behave very similar to each other. 

6
00:00:29,680 --> 00:00:34,240
Most of the commands that you can use in a Mac 
terminal will also work in a Linux terminal. 

7
00:00:34,240 --> 00:00:37,280
And vice-versa.
From now on, I'm just going to 

8
00:00:37,280 --> 00:00:42,320
refer to a terminal, or terminal session.
I won't qualify it with Mac or Linux, 

9
00:00:42,320 --> 00:00:50,080
because they both take the same commands.
Ok, let's start a command prompt, or terminal. 

10
00:00:50,080 --> 00:00:57,840
On Windows, type cmd into the search 
bar, and click Command Prompt. 

11
00:01:00,080 --> 00:01:04,160
On a Mac, use the launchpad, 
and start typing terminal. 

12
00:01:04,160 --> 00:01:08,320
You'll probably only need to type the first 3 
characters, depending on what other programs 

13
00:01:08,320 --> 00:01:12,480
you've installed on your Mac.
Click Terminal when it appears. 

14
00:01:12,480 --> 00:01:17,360
On Linux, Ctrl-Alt-T should start a terminal.
If you're using a distro that doesn't have 

15
00:01:17,360 --> 00:01:22,060
that shortcut, launch Terminal just 
like you'd start any other program. 

16
00:01:23,120 --> 00:01:26,800
You should now have a command 
prompt, or terminal, open. 

17
00:01:26,800 --> 00:01:31,760
By default, you should be in your home 
directory. In my case, on Windows, 

18
00:01:31,760 --> 00:01:36,800
that's C:\Users\timbuchalka
Obviously, your home folder 

19
00:01:36,800 --> 00:01:41,299
will be called something different.
I've also stored my files on Drive Y.

20
00:01:41,299 --> 00:01:46,778
So the first thing I'm going to do, is switch to drive Y.
You'll probably want to stay on Drive C, 

21
00:01:46,778 --> 00:01:49,840
unless you've also put your 
projects on a different drive. 

22
00:01:49,840 --> 00:01:54,480
To change to a different drive, type 
the drive letter, followed by a colon. 

23
00:01:54,480 --> 00:01:57,770
I'll type Y: to change to my Y drive. 

24
00:01:58,640 --> 00:02:03,233
As I said, you probably won't need to do 
that. And if you're running a terminal, 

25
00:02:03,233 --> 00:02:08,240
you definitely won't want to do that – Unix 
based operating systems don't use drive letters. 

26
00:02:08,240 --> 00:02:11,895
A command you might find 
useful, in a command prompt, is: 

27
00:02:15,760 --> 00:02:19,040
That clears the screen, so 
things don't get too cluttered. 

28
00:02:19,120 --> 00:02:26,320
In a terminal, the equivalent command is clear.
Ok, let's have a go at finding our project files. 

29
00:02:26,320 --> 00:02:30,505
The Windows command to get a list of the 
files in the current directory is dir. 

30
00:02:30,560 --> 00:02:37,069
That's short for directory.
So if you're on Windows, as I am, type 

31
00:02:37,069 --> 00:02:42,000
and press ENTER.
In a terminal, the command is ls

32
00:02:43,360 --> 00:02:46,940
and press ENTER.
Don't try to do that in a command prompt – 

33
00:02:46,940 --> 00:02:52,711
it won't work. I've changed things on my computer, 
so that I can demonstrate these terminal commands, 

34
00:02:52,711 --> 00:02:57,280
but they won't work on your Windows computer.
So to be clear, you use dir if you're running 

35
00:02:57,280 --> 00:03:01,360
a Windows command prompt, and 
ls in a Mac or Linux terminal. 

36
00:03:01,360 --> 00:03:04,968
Ok, you should now have a directory 
listing of your home folder. 

37
00:03:04,968 --> 00:03:10,240
The default terminal directory listing is quite 
basic. It displays the names in columns, 

38
00:03:10,240 --> 00:03:15,360
and doesn't indicate if they're a file or a directory.
For that reason, I normally use a slightly 

39
00:03:15,360 --> 00:03:19,011
different command when I'm 
working in a terminal. Enter 

40
00:03:21,840 --> 00:03:27,205
There's a space after ls, then a 
dash (or minus) before the al switch. 

41
00:03:27,520 --> 00:03:31,600
Press ENTER, and you'll get a listing 
that looks more like the Windows version. 

42
00:03:31,600 --> 00:03:36,851
Your listing won't look exactly the same 
as mine – I'm still running Windows, after all. 

43
00:03:36,851 --> 00:03:40,800
But you should be able to tell which 
names are files, and which are directories, 

44
00:03:40,800 --> 00:03:45,928
by looking for the letter d in the far left column.
If the first character on the line is a dash, 

45
00:03:45,928 --> 00:03:51,542
the name represents a file. If that first 
character is the letter d, then it's a directory. 

46
00:03:51,542 --> 00:03:55,713
Once again, don't use that 
command on Windows, it won't work. 

47
00:03:55,840 --> 00:03:59,738
Ok, your projects should be in 
a directory called IdeaProjects. 

48
00:03:59,840 --> 00:04:04,291
That's where IntelliJ creates them, unless 
you tell it to put them somewhere else. 

49
00:04:04,400 --> 00:04:08,185
And if you've told it to put them somewhere 
else, then you'll know where that is. 

50
00:04:08,320 --> 00:04:11,188
So change into the directory 
where you put your projects. 

51
00:04:11,440 --> 00:04:15,167
The command to do that is cd, 
short for Change Directory. 

52
00:04:15,280 --> 00:04:18,079
You then tell it which directory to change into. 

53
00:04:18,079 --> 00:04:22,320
The terminal command is the same, cd.
I put my projects in that 

54
00:04:22,320 --> 00:04:27,000
current-python-masterclass-remaster folder, 
so that's the folder I'll change into: 

55
00:04:33,520 --> 00:04:41,244
Ok, get a directory listing of this folder. 
That's dir on Windows, and ls -al in a terminal 

56
00:04:44,000 --> 00:04:48,193
You should see the project directories 
for all the projects we've created so far. 

57
00:04:48,320 --> 00:04:51,276
Change into the Functions_Intro directory: 

58
00:04:56,160 --> 00:05:00,640
You'll have to use whatever name you called the 
project, if you called it something different. 

59
00:05:00,640 --> 00:05:04,160
Alright, why have I done this?
It's given you a bit more practice 

60
00:05:04,160 --> 00:05:09,360
in listing directory contents and changing the 
current directory, but I must have another reason! 

61
00:05:09,360 --> 00:05:13,676
I do, I want to use the files in this 
directory to talk about file paths. 

62
00:05:13,840 --> 00:05:17,313
Let's list the files in this 
Functions_Intro directory: 

63
00:05:19,600 --> 00:05:21,646
or, in a terminal: 

64
00:05:24,960 --> 00:05:30,240
My current directory is Functions_Intro. That 
means I only need to specify the filename, 

65
00:05:30,240 --> 00:05:35,120
to be able to use any of these files.
For example, I can execute the Python code in 

66
00:05:35,120 --> 00:05:39,120
the banner.py file, by passing the name to Python:

67
00:05:43,138 --> 00:05:46,400
Our Python code executes, so that works.

68
00:05:46,400 --> 00:05:50,080
If you don't provide a path to a file, 
the operating system looks for it in the 

69
00:05:50,080 --> 00:05:55,941
current directory. My current directory 
is Functions_Intro, so the file is found. 

70
00:05:56,000 --> 00:05:59,360
But what if you want to access a 
file that's in a different directory? 

71
00:05:59,360 --> 00:06:05,840
We'll see how to do that, and learn how to 
work out a file's path, in the next video.

