3 ms·
The only characters not allowed in a filename on Linux are 0x00 (the null byte) and '/'. It's perfectly valid to have '~' in it. You may be confused because yo
by aaronmdjones 8y ago
The only characters not allowed in a filename on Linux are 0x00 (the null byte) and '/'. It's perfectly valid to have '~' in it.
You may be confused because your shell expands it to the value of $HOME -- which you can prevent by putting it inside single quotes.
aaron@aspire5742:~$ echo hi > 'foo~bar.txt'
aaron@aspire5742:~$ ls -l *.txt
-rw-r--r-- 1 aaron aaron 3 Nov 16 03:20 foo~bar.txt
aaron@aspire5742:~$ cat 'foo~bar.txt'
hi
aaron@aspire5742:~$