On this page... (hide)
DOS was infamous for its strict file name limits, eight Latin characters or numbers, no spaces, one period than three more such characters. UNIX has never had such severe restrictions, even contemporaneously with DOS. DOS was just arbitrary and annoying in this regard.
But while you can put a broad number of characters in UNIX file names there are some you cannot put in at all and several which you really shouldn't because it may make things difficult for you.
Many files, most actually, have an extension. This is a dot followed by a string of text or numbers. This aids people and operating systems in knowing what program to associate each file with. For example, the extension .png indicates a "portable network graphic" which is a type of picture format used on webpages and desktops.
Strictly these are not actually required. UNIX can identify most types of files without using extensions (by looking at a part of the file called the magic number but this is not completely reliable so it is highly recommended that all files be given extensions. Programs will take care of this automatically for you so you don't have to worry about it but you should not rename the files in the file-manager to remove the extensions.
These are the characters that we recommend for use in file-names:
UNIX file names are case sensitive unlike most modern operating systems (read: Windows). Also unlike Windows, directories/folders are treated as files.
This leads to two interesting conclusions:
It is not recommended that you put two files with the same name but differing capitalization in the same folder as this will inevitably confuse you as your brain does not stop to consider capitalization except in paragraphs as society does not teach it to do that.
Here is a list of common key-board characters that you absolutely should not use in file names at all. Most of them have special meanings on most operating systems including UNIX and some will make the file unreadable on foreign O.S.s
While the only one of these characters that cannot be used at all on UNIX is the forward slash they all have special meanings to most operating systems and some are incompatible with other OSs. Macs, for example, cannot open files with colons in their names at all. If you create file names with these characters in them the system may have trouble opening them.
As a special note, if a filename begins with . UNIX will hide it from view (it still exists, though). Lots of configuration files begin with a dot for this reason. You have hundreds of hidden dot-files in your home directory.
The following filenames cannot be handled by Windows even though they are legal on UNIX.
@@ CON, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9 LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. @@
Windows NT, XP and later also forbid the following:
@@ $AttrDef $BadClus $Bitmap $Boot $LogFile $MFT $MFTMirr pagefile.sys $Secure $UpCase $Volume $Extend $Extend\$ObjId $Extend\$Quota $Extend\$Reparse @@
Note: ($Extend is a directory)
This applies whatever the extension. For example: NUL.txt is a valid UNIX file name but Windows will not be able to handle it. Windows could handle NULlity.txt, though.
Do not use the following file names or extensions as they may be auto-deleted by weekly self-maintenance processes of System. They will also not be backed up automatically.
~ or #
.bak .core or .tmp or any file named just tmp in lowercase with no extension
.DS_store
Thumbs.db
.cache