The 7 Main Rules For Naming Files and Folders in Linux and Unix

In this article I will tell you the main rules for naming files and folders in Linux and Unix systems.

1. In Linux and Unix, the filenames are case sensivite. So, LinuxG.txt not the same as linuxg.txt.

2. For naming files and folders in Linux and Unix, you can use upper and lower case letters, numbers, dots “.” and underscore “_” .

The filenames beginning with a dot (like .bashrc) are hidden files.

3. The file extensions in Linux and Unix are optional. They are used only to help the user recongnise the file type. Read more about the extensions in Linux and Unix here.

4. Other special characters can be used, such as: “<“, “>”, “|”, “\”, “:”, “(“, “)”, “&”, “;”,”{“,”}”,”*”,”?” etc, but they have to be escaped by the / character. Read more about escaping special characters in this articles.

5. The \ (root directory) character is the delimiter between directories and files and it cannot be used in file or folder names, in Unix and Linux Systems.

6. The file names must be unique inside their directory. You can have files or folders with the same names, but in different locations.

7. The new Linux and Unix systems limit the filenams to255 characters (255 bytes).

Tagged with: , , , , ,
Posted in The Linux and Unix Articles!
2 comments on “The 7 Main Rules For Naming Files and Folders in Linux and Unix
  1. Owen Carlton says:

    This is good information but it does not but it does not help me with my problem. In my Ubuntu 12.10 I have some Folders that are multi Words (Joomla Files) It seems to be treating each word as an individual folder and of course, cannot find it. I cannot do anything with these folders because of this. Cannot find any other info about this anywhere.
    Can you please advise.

  2. Gavin Shreeves says:

    Rename your file from the terminal by putting its name in single quotes.

    Assuming you have opened a terminal in the same folder as your file, type:

    mv ‘Joomla Files’ JoomlaFiles

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!