Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this chapter we're going to take a look at the Unix file system and how we can work with files and directories. I want to start that off by talking about the concept of the working directory. This is an important concept. It's the directory where we are right now. So when we issue commands, it's important to know which working directory we are in, because that's where those commands are going to happen. That's where they are going to take place. So if we say look for a file, it's going to look for a file in that directory, unless we tell it something. So it's important to know where we are. The best analogy is the graphical user interface of the Finder. Right here I am inside kevin.
That's my user directory and you can see that I have all my different folders here. If I double-click on Public, I go inside the Public folder. I've changed my working directory from being in kevin to being in Public. I can go back and I've changed my working directory now back to kevin. It's the directory that we are seeing and we are working. It's very similar. Notice though that that only happens in the Finder when this sidebar is there. If I click this button over here and make the sidebar disappear, now I get a different behavior.
I double-click on Public and I get a whole new window. That's not a good analogy, because that's not the way it works. We're not getting a new window at all. So this is the one that works for the analogy where we have moving around and this window is just shifting and changing into different directories as we go up and down. Now we can jump to different places. We can jump to our desktop. We can jump to our Applications folder. We don't have to move around in sort of a linear way. This will take me back to my user directory, but that's the analogy to think of. This is the working directory in the same way that we have a working directory here.
So what working directory are we in here? pwd, that's the present working directory and there is my present working directory. It returns the path to me that describes what we're seeing in the window over here. If I actually hold down the Ctrl key while I click on kevin, you can see that it tells me, ah, Macintosh Hard Drive> Users and then Kevin. That's where I'm located. So in the root of the hard drive user is kevin, in the same way that this tells me the root of the hard drive.
That's the first slash, /Users/Kevin. That's the path. If you use the Windows at all, it's the backslash on Windows, but on Mac and on Unix it's always the forward slash, That's what you use for a path separator in both Mac and Unix, is the forward slash. So in the next couple of movies we're going to learn more about seeing the different directories and how to move around between them, but keep in mind that you can always use this pwd to find out your present working directory and that you are always in a single directory when you're in Unix. So wherever you are at this moment that's the place that you are residing, much in the same way as if you had a window open like this and all of your commands were being typed relative to that window.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.