What's in a filename?

University of Wisconsin Madison

Computer Systems Lab CS1000

Wiscinfo
Wiscinfo
CS Home
CS Home
CSL
CSL
Feedback
CS1000
Feedback
Feedback

next up previous contents index
Next: How are files Up: The File System Previous: What can I

What's in a filename?

Files must be named so that you can identify them to the system (these names are appropriately called filenames). Filenames can be as long as you wish (up to about 255 characters) and can contain many different characters, although we suggest you stick to the standard ones: letters, digits, underscores and periods. Some typical filenames are main.c, prog1.C, file.o, a.out and main. Filenames which contain metacharacters that also have special meaning to the shell ( ) [ ] $ | ! & ' " ? / < and > should be avoided.

There are several conventions for naming files. For example, you may have noticed above that the file containing the C program was named prog1.c. The C compiler expects its input from files whose names end in .c. In general, a suffix designates a source file (program text) and the absence thereof designates an executable. Here are some of the common suffixes:

 

.c   C source
.cc or .C   C++ source code
.f   Fortran text
.o   intermediate object code (NOT human readable)
.Z   compressed file (NOT human readable, use uncompress)
.gz   gzipped file (NOT human readalbe, use gunzip)
.tar   tarred file (usually NOT human readable, use tar -xvf)



Caitlin Howell
Thu Jan 16 20:24:40 CST 1997