UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 4.5 Private (Personal) Directories Chapter 4
Organizing Your Home Directory
Next: 4.7 Make More Directories!
 

4.6 Naming Files

Let's think about a filing cabinet again. If the files in your filing cabinet were called letter1, letter2, letter3, and so on, you'd never be able to find anything.

The same is true on your computer. You should come up with a descriptive name for each file to create. UNIX systems let you have very long filenames. A few systems have a 14-character limit, but most allow names that are 256 characters long - certainly longer than you will ever need.

I can't tell you how to make a filename descriptive, except to suggest that rather than using names like letter, you make a filename that describes what the letter is about. In the case of a letter, using the recipient's name may help - assuming that you can easily make a connection between john_shmoe and "that's the letter about trends in gold prices" (though I'd suggest that the name gold_price_trends_oct is an even better name than john_shmoe). Bruce Barnett has suggested that, by using long filenames, you can create a simple "relational database." For example, you could find out everything you've recorded about the price of gold with a command like more *gold*price*. Of course, this doesn't provide the fancy features that a commercial database would have - but you may not need those features and, if so, why spend good money to buy them?

Similarly, if you're a programmer, the name of each file in your program should describe what the code does. If the code diagonalizes matrices, the file should be called something like diag_mat.c. If the code reads input from bank tellers, it should be called something like teller_input.c.

Another way to distinguish between different kinds of files is by using suffixes or filename extensions (1.17).

- ML


Previous: 4.5 Private (Personal) Directories UNIX Power ToolsNext: 4.7 Make More Directories!
4.5 Private (Personal) Directories Book Index4.7 Make More Directories!

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