Creating your own directories is extremely simple under Unix, and can be a useful organizational tool. To create a new directory, use the command mkdir. Of course, mkdir stands for ma ke directory.
mkdir directory
Let's do a small example to see how this works:
mkdir can actually take more than one parameter, and you can specify either the full pathname or a relative pathname; report-1993 in the above example is a relative pathname.
Finally, there is the opposite of mkdir, rmdir for remove directory. rmdir works exactly as you think it should work: ;
rmdir directory
An example of rmdir is:
As you can see, rmdir will refuse to remove a non-existant directory, as well as a directory that has anything in it. (Remember, report-1993 has a subdirectory, chap2, in it!) There is one more interesting thing to think about rmdir: what happens if you try to remove your current directory? Let's find out:
Another situation you might want to consider is what happens if you try to remove the parent of your current directory. In fact, this isn't even a problem: the parent of your current directory isn't empty, so it can't be removed! ;;