红联Linux门户
Linux帮助

Filenames in Unix

发布时间:2007-10-24 00:30:23来源:红联作者:gfhlole
Unix is rather flexible regarding file names. A valid Unix filename can contain any character other than "/". Most systems allow filenames of up to 256 characters in length. The filenames motd, motd.new and motd.backup are all valid in Unix. You could also have filenames like motd_new.backup. Unix does not attach any special significance to characters like "." or "_" in filenames; they are treated just like any other character. However, use of these characters can make filenames more meaningful to users.

Many compilers and other Unix programs do impose some restrictions on filenames. For instance, the C++ compiler expects that filenames for your programs should end in .h or .cpp. Thus Lab1.foo is not a valid name for a RESOLVE/C++ main program file, but Lab1.cpp is.

The same rules that apply to filenames also apply to directory names.

Important Note: The Unix system treats a directory as a special kind of file whose contents are the list of files and subdirectories within it. As a result, you'll notice that many of the rules that apply to files also apply to directories.
文章评论

共有 0 条评论