Sample Header Ad - 728x90

Characters best avoided in filenames when used in Bash, e.g. `?`

1 vote
2 answers
3966 views
1. For example: $ ls -l total 344 -r-------- 1 t t 145657 Mar 11 01:53 joeltest-slides.pdf -rw-rw-r-- 1 t t 166814 Mar 11 01:55 The Joel Test: 12 Steps to Better Code? by Joel Spolsky.pdf drwx-w--w- 2 t t 4096 Sep 19 2012 The Joel Test 12 Steps to Better Code_files -rw--w--w- 1 t t 31940 Feb 12 2011 The Joel Test 12 Steps to Better Code.html $ mv The\ Joel\ Test\:\ 12\ Steps\ to\ Better\ Code{ \ by\ Joel\ Spolsky.pdf,.pdf} mv: missing destination file operand after ‘The Joel Test: 12 Steps to Better Code{’ Try 'mv --help' for more information. What does missing destination file operand mean? Is it because ? in the filename? 1. In Bash, as far as performing file operations by builtin or external commands is concerned, what characters are best avoided when naming files? For exmple, Does the above example imply ? is one of them? Does [my previous post](https://unix.stackexchange.com/questions/268593/why-can-file-expansion-work-for-filenames-with-a-newline-character) imply the new line character is one of them? Does [my previous](https://unix.stackexchange.com/questions/266217/find-and-rename-files-including-directories-whose-filenames-contain-space) [posts](https://unix.stackexchange.com/questions/266216/search-for-and-remove-files-safely) imply the white space is one of them? 3. Is it correct that, from Linux's point of view, there is no restriction on characters that can be used in filenames? Neither from filesystem type (ext4) 's point of view?
Asked by Tim (106420 rep)
Mar 11, 2016, 07:09 AM
Last activity: Jun 9, 2025, 07:40 PM