Skip all navigation

Mail Calendar Contacts Downloads more tools
home Helpdesk Issues News about Search
Print Version   Feeds   Get QR  
Edit 
More Page Actions ↓

UNIX file-names

1.  Preamble

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.

2.  Extensions

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.

3.  Acceptable characters

These are the characters that we recommend for use in file-names:

  • A to Z in upper and lower case
  • Period
  • Dash
  • Underscore (shift+hyphen)
  • Space

4.  Things to avoid

4.1  Files with the same names except capitalization.

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:

  1. You cannot name a directory and a file exactly the same thing in the same directory, for example: you cannot put a directory named "Document" in your home folder along with a file named "Document".
  2. You can confuse the living daylights out of yourself with capitalization. You can have a file/folder named "Document" and another file/folder named "document" in the same folder.

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.

5.  Characters to avoid

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

  • Slash and Backslash
  • Currency symbols like $ and £
  • Question and Exclamation marks.
  • Colons and semicolons.
  • The pipe symbol (shift+back-slash).
  • Greater and lesser than signs
  • Tilde
  • Octothorpe (shift+3)
  • Ampersand
  • Backtick (usually on the tilde key)
  • Prime marks and Quotation marks. (Prime marks are stright, quotation marks curly).
  • Brackets, braces and parenthetical.

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.

5.1  Windows Incompatible Filenames

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.

5.2  Filenames That the System may Delete

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.

  • Anything with a ~ or #
  • Anything with the extension .bak .core or .tmp or any file named just tmp in lowercase with no extension
  • .DS_store
  • Thumbs.db
  • .cache


Text last modified on March 28, 2011, at 03:13 AM
You are here: Support » UNIX file-names


Helpdesk

Report A Problem

FAQ

QR Code datagram

Vistua Hub version 4.1 © MMVI-MMIX Vistua.com. All Rights Reserved. All times UTC. Silk icon-set by Fam Fam Fam

.

About / Contact / Terms / XHTML / CSSSwitch to mobile or touch verion