File naming convention in Linux



This post is designed to introduce how files are named in Linux file system.


You can name a file in any combination of given sets.
1.     {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z}
2.     {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
3.     {period (.), underscore (_), comma (,)}



You cannot name a file period (.) or period period (..)
Note: File period (.) denotes directory in which you are in whereas period period(..) denotes parent directory.


Unix File Naming Practices

You need to follow the official rules for file naming in Unix, but here are some good 
practices that I've found also help keep things straight:


1.     Avoid naming a file with the same name as a Unix command. You can find out if a name is a Unix command by using the man command.


2.     Use file extensions that are widely recognized when possible. For example, if you create a text file, use the character string .txt as the last part of the file name.





3.     Make all the letters of all your files (and directory names) lower case. Unix cares about the case.



4.     Start a file name with a letter or number. If you start it with a dot (.), it will be a hidden file.

In Unix-like file systems, the null character and the path separator / are prohibited.





5.     Make your names short, but not cryptic. Use correctly-spelled nouns when possible. For example, store your inventory in inventory.dat and not invtry.dat.


TO read about File system of Linux file-system in linux

Sources:

  1. wiki-Filename
  2. december.com-unix_filenames


Related Posts Plugin for WordPress, Blogger...