Athena's blog

Linux filenames (and legal characters within them)

Athena Lilith Martin

Published on

The following are legal in Linux (and most other Unix) filenames: ()[]<>$:;&@?`’“!=+*^%#~| and space. (Note here that I do mean Linux, the kernel, not any of the operating systems built on it.)

Some of them may be difficult to correctly input in some contexts, but you can use them. Linux, at least with most filesystems, only prohibits / and NUL bytes, allowing any other byte sequence, including invalid UTF-8.

However, given that filenames are supposed to be… names, it is usually best to restrain yourself to things that can actually be decoded by a person as meaningful language, or that at least can be easily input in contexts such as a shell command, which means sticking to normal word characters plus punctuation such as (English examples) .,-_ and space, used sanely.

If you do want to name a file $*@! though, nothing will stop you.