17

How long can be files names and folder names in Ubuntu Linux and what characters are allowed in file name and folder name in Ubuntu Linux?

Jorge Castro
  • 73,717

2 Answers2

22

File names in Linux were 14 bytes long in earlier Unix version. But The modern Linux system has 255 bytes for file names.

As a character requires 1 byte, The length becomes 255 characters. Also the folders are treated as files in Linux system

See this link for more information

Anwar
  • 77,855
4

I'm not sure what the maximum file name length can be (for ext4), but it's more dependent on the file system, than Linux itself. On FAT32, I think it is 255 characters. You probably don't ever actually need a file name that long.

As for characters allowed, any byte value is allowed on the ext4 file system, except for the NULL byte (and /, as that is the directory separator1). However, you should limit your file names to the UTF-8 character set, for the widest range of compatibility across applications, and devices.

1. As stated in the glibc manual, "any character except the null character is permitted in a file name string," but a / in the file name string separates the name of one file or folder from that of its parent.

Eliah Kagan
  • 119,640
dobey
  • 41,650