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.
I want us to see how we can go back creating directories that we could put our files into. Directories are essentially folders, but in Unix you are always going to call them directories. So start getting use to that terminology. Instead of calling it a folder, call it a directory. Making a directory is really simple. We just say mkdir, space, and then the name of the directory we want. So I am going to create one called testdir. Hit Return and it created it. It didn't give me any output there. If I do ls-la you'll see that it created. If we come down here at the very last entry, you can see there's a directory because it has this d at the front and that differentiates it from just a standard file which has a dash.
Now if you were to try it again and create the same directory again, you'll get an error letting you know that file exists. It says File exists but it's actually letting us know that the directory exists and then makes sure we don't accidentally overwrite something we don't mean to. Now, if we want to create a directory inside a directory, we can just pass in a path, mkdir testdir/test1. That will create the test1 directory inside testdir. It's just a path, nice and simple. So that will work.
What if I want to go two deep though? If we do test1/test2, now I am saying in addition to going inside the test directory I want you to create two directories. The test1 directory that doesn't exist followed by the test2 to directory that doesn't exist. This won't work. If we try this, it will come back and say, "Oops! Sorry, test1 doesn't exist." In order to make it work, we need to pass in the -p option. p is parents, the parent directories. So create all parent directories as needed until you get to the final directory that I've got.
That's very helpful if we want to create a large directory structure. We can say all right, not just this folder but also these folder is deeper down, create all of them all at once. That's nice handy trick. And if we did ls-la,and we'll type in the directory, testdir/, it will give us the contents of that directory. The other thing I think is kind of nice is the -v option. So we say mkdir -v is for verbose, let's use that p option again, testdir/test1, and let's create another one called test3 that will sit right next to test2.
So there you see it gives me some feedback and lets me know which directories it created. If it created four directories, we would have four entries there, telling us each one that it created. So that's really all to creating directories. Just make sure that you create a directory with the name that doesn't already exist and if you can pass in a full path to the directory that you want, but if some of those directories in that path don't already exist, you will want to also pass in the -p options so it will create them as well.
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.