I have a collection of files and directories with strange names, they contain spaces and the special characters \
, *
, )
, (
and ?
. All of them cause problems when I try to use them in the command line or scripts, e.g.:
$ cd space dir
bash: cd: space: No such file or directory
$ cat space file
cat: space: No such file or directory
cat: file: No such file or directory
$ cat (
bash: syntax error near unexpected token `newline'
$ echo content >\
> ^C
$ ls ?
( ) * ? \
How do I enter file or directory names that contain special characters in the terminal?