Are dashes allowed in filenames Linux?

Are dashes allowed in filenames Linux?

@methyl: While spaces are obviously not, hyphens are recommended by the Unix standard except as first character. @guest115: Unix kernels do not make any limitations in filenames outside two forbidden characters, / and null i.e. \0 and two reserved filenames: .

What character should be avoided in Unix filenames?

In short, filenames may contain any character except / (root directory), which is reserved as the separator between files and directories in a pathname. You cannot use the null character. No need to use . (dot) in a filename.

Can you use dash in filename?

Don’t start or end your filename with a space, period, hyphen, or underline. Keep your filenames to a reasonable length and be sure they are under 31 characters. Avoid using spaces and underscores; use a hyphen instead. This will also improve your search engine rankings.

What are the rules for naming a Linux file?

Following are general rules for both Linux, and Unix (including *BSD) like systems: All file names are case sensitive. 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.

Which is the correct way to name a script in Unix?

Scripts that are called by inetd sometimes are tagged with a leading in., such as in.tftpd. The ending z in vmlinuz means zipped, but I’ve never seen any other file named this way. In unix filename is just a string, unlike DOS, where filename was composed from name and extension. So any of given filenames is completely acceptable.

Are there any exceptions to the Unix file naming convention?

Exception is zlib and probably a few others. Scripts that are called by inetd sometimes are tagged with a leading in., such as in.tftpd. The ending z in vmlinuz means zipped, but I’ve never seen any other file named this way. In unix filename is just a string, unlike DOS, where filename was composed from name and extension.

How many characters does a file name have to be?

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 a demo.txt file and demo.txt directory name. However, other directory may have files with the same names.