home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 4.6 Naming Files Chapter 4
Organizing Your Home Directory
Next: 4.8 Making Directories Made Easier
 

4.7 Make More Directories!

Creating many directories has several advantages:

  • First, it is easier to find any particular file if your home directory is well-sorted. Imagine a rack of filing cabinets that isn't sorted; people just insert files wherever they fit. You may as well throw your data out; when you need something, you'll never be able to find it.

  • Second, UNIX can access files much faster when directories are relatively small. Ideally, directories should have at most 60 (or so) files in them.

  • Third, directories are an important part of UNIX file protection ( 22.1 ) . You can use directories to help protect certain files against access by others.

Make directories liberally! Make a new directory for every new project you start; make subdirectories within these directories for subtopics. Your home directory should ideally contain nothing but subdirectories. Here are some recommended conventions:

  • If you're a programmer, create a new directory for each project. For example, create a directory called src for source files, a directory called doc or man for documentation, a directory called obj for object files, a directory called rel for the current working version (or almost-working version) of the program, a directory called test for test files and results, and so on. If the program is large, your src directory (and your obj directory) should also be split into different subdirectories, each containing different parts of the project.

  • It's a good idea to put all personal files (as opposed to work files) in a directory that can be protected against snoopers. See article 4.5 .

  • Many users save all of their mail ( 1.33 ) in one directory (often called Mail ), which is then divided into subdirectories by topic. I use a variation of this scheme; I keep general mail in my Mail directory, but I save correspondence about particular projects with the project itself. For example, my Power Tools mail is shelved with the source code for this article.

Article 4.8 shows some quick ways to make directories.

- ML


Previous: 4.6 Naming Files UNIX Power Tools Next: 4.8 Making Directories Made Easier
4.6 Naming Files Book Index 4.8 Making Directories Made Easier

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System