Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Unix for Mac OS X Users unlocks the powerful capabilities of Unix that underlie Mac OS X, teaching how to use command-line syntax to perform common tasks such as file management, data entry, and text manipulation. The course teaches Unix from the ground up, starting with the basics of the command line and graduating to powerful, advanced tools like grep, sed, and xargs. The course shows how to enter commands in Terminal to create, move, copy, and delete files and folders; change file ownership and permissions; view and stop command and application processes; find and edit data within files; and use command-line shortcuts to speed up workflow. Exercise files accompany the course.
In the last movie we learned how to work with file permissions and to use chmod to change the permissions that we wanted for user, group, and other, and to do that we used what we called alpha notation. That's because we're using the alphabet, u, g, and o for user, group, and other and r, w, and x for read, write, and execute. That's everything you need to know to change file permissions. That's it. You could get by do everything with that. However, I want you to also learn about octal notation, because it's extremely popular. It's the way that I change file permissions and I think a lot of other Unix users do and you're bound to run into it.
So I want you to at least have some exposure to it. So remember here we have u, g, and o, r, w, and x and we use that to come up with those nine digits rwx, rw-, r--, right? Now imagine that for r, w, and x that we establish a conversion. Each one of those letters is instead going to be represented by a number, 4, 2, and 1. r=4, w=2, x=1. So in place of the yes's and no's for each one of those, let's drop in those numbers.
So for the user, the user can read, write, and execute, so they get 4, 2, and 1. The group can read and write, so they get 4, 2 and 0, and for other, they can only read, so they get 4 and 0 and 0. Take all those numbers and add them up. You get 7, 6 and 4. And those three digits are the octal notation representation of rwxrw-r--. So we're not adding permissions or taking away permissions; we're defining all nine of those just using these three numbers.
We're saying each one of these numbers will represent the state of read, write, and execute for each one of those. Let me show you some examples. So for example, let's say we want to say that a file ought to have all the permissions. Well, read, write, and execute, all added together, 4, 2 and 1 those add up to 7. That's the highest number we can have. So 777 means give all the permissions wide open, so everybody can do everything. When we're just looking at, we had 764. That means that the user can read, write, and execute. For the group they have a 6.
That's made up of 4 and 2. That's the only way we can come up with that number is with 4 and 2, therefore they have read and write privileges, not execute. And then for other, they have only read privileges. That's the 4. A very common one that you will see is 755. That means that I as the user have read, write, and execute. Everyone else just has read and execute privileges. They don't have write privileges. And then of course, if they didn't have any of them, it will be 000. That would essentially take away all privileges from everybody.
More commonly what you would see is something like 700, which would mean I get all privileges, but everyone else gets none. 7 represents read, write, and execute. So that's it. That is all that is there to it. It's just a really compact concise way to spell out exactly what you want to have happen with those permissions. Like I said, you can still do it the other way, but this is a really powerful way once you get the hang of it. What I like you to do now is just pause the movie with this alpha to octal conversion up, r, w, and x, just to remind you, and try a few of these.
Just try setting the permissions on a test file. Go ahead and just try 777, see what it does. Try 755, see what it does. Remember that the numbers will always have to be combinations between 0 and 7. They can't be any higher than that. So, you can just play around and see what it does, see if you can get the hang of it. Maybe even if you start out using alpha notation, just every now and then just try the octal one and see, and if you're going to do all of them wide open anyway, just use 777. It's certainly a lot faster, instead of typing out user, group, and other equals read, write, and execute, right? It's a lot more characters to type.
Once you feel like you have to hang of it, we'll move on to talking about how we can switch to a different user identity.
Find answers to the most frequently asked questions about Unix for Mac OS X Users.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
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.