About Linux FAQ

Browse More FAQs:

Linux/UNIX: Rules for naming file and directory names

Posted by Vivek Gite [Last updated: September 1, 2006]

Following are general rules for both Linux. BSD, Unix like systems:

* File names are case sensitive. So filename vivek.txt Vivek.txt VIVEK.txt all are three different files.

*You can use upper and lowercase letters, numbers, "." (dot), and "_" (underscore) symbols.

* You can use other special characters such as blank space, but they are hard to use and it is better to avoid them.

* In shot, filenames may contain any character except /, which is reserved as the separator between files and directories in a pathname.

* No need to use . (dot) in a filename. Some time dot improves readability of filenames. And you can use dot based filename extension to identify file. For example

  • .sh = Shell file
  • .tar.gz = Compressed archive

* Most modern Linux and UNIX limit filename to 255 characters. However, some older version of UNIX system limits filenames to 14 characters only.

* A filename must be unique inside its directory. For example, inside /home/vivek directory you cannot create demo.txt file and demo.txt directory name. However, other directory may have files with the same names. For example, you can create demo.txt directory in /tmp.

See also:

E-mail this to a friend      Printable version

Related Other Helpful FAQs:

Discussion on This FAQ

  1. KarthiKeyan Says:

    i can not execute the following shell command…

    “cd directory name with spaces”

  2. SutantoKurniawan Says:

    Escape the spaces with “\”.
    eg.

    “cd Directory\ Name\ With\ Spaces”

  3. RoHaN Says:

    Thank You Very Much Vivek Sir For All Such Given Information Above…! :-)

    SD/-
    RoHaN.

  4. Joe Says:

    alternatively, you can use double quotes for the directory name like

    cd “directory name with spaces”

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.