0

Most recent versions of most Linux distros allow blank space in file and directory naming. I was wondering if there is a way to disable that and go back to the old UNIX standard of no spaces in file system naming and examples of how that is done in some common distros, such as Ubuntu, RHEL, Fedora etc.

  • I believe you could always have spaces, they just had to be either escaped or the arguments needed to be wrapped in quotes (Single or double). – slm Sep 26 '14 at 16:09
  • 1
    @sim is correct. Unix has always allowed any character in a file name with the exception of / and \0. Where did you get your information that space was disallowed? – doneal24 Sep 26 '14 at 16:54
1

This is not possible. Please also explain what do you mean by "Most recent versions of most Linux distros": as far as I know, spaces are supported since the very first version of UNIX System V filesystem made in 1974.

1

Linux has always allowed any byte other than / and null in file names, like most other Unix variants (including the original).

To change that, you would need to modify the filesystem code in the kernel. I'm not aware of any existing patch to do that. There isn't even a standard error code for attempts to create a file name that isn't supported, only ENAMETOOLONG which is specifically for cases where the length of the filename or path is too large. EINVAL would be a reasonable choice; it's what Linux's FAT driver uses, among others.

POSIX defines a portable filename character set consisting of ASCII letters, digits, and the three punctuation characters .-_. However many unix applications expect other characters to work: several programs have a name containing + (e.g. c++), X11 and Perl want :, CVS wants ,, Emacs wants #, Gnome wants % (for gconf), a lot of programs want ~ for backup files, some programs want % for URL encoding, some programs want = and + for Base64, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.