名前に特殊文字を含むファイルまたはディレクトリを入力する方法は?


cd-commandコマンドラインファイル名

ターミナルで次のフォルダーに入りたい:

Milano, Torino (Jan)-Compressed



このディレクトリに入るには、コマンド cd をどのように記述すればよいですか?

スペースおよび ` , * , ) , ( and ?` などのその他の特殊文字は、コマンド ラインまたはスクリプトで使用しようとすると問題を引き起こします.

`
$ 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 in general?

#### Accepted Answer

That command is ambiguous because spaces are normally used to separate arguments. cd does not know what you want to do but you have two possibilities to solve it:

Either you “ **mask** ” the spaces (and all other special characters) so that the terminal knows you mean the space as a character and not as a separator:

cd Milano, Torino (Jan)-Compressed


Or you put your folder name or path into **quotes** :

cd "Milano, Torino (Jan)-Compressed"




The post [How to enter a file or directory with special characters in its name?](https://stackallflow.com/ubuntu/how-to-enter-a-file-or-directory-with-special-characters-in-its-name/) appeared first on [Stack All Flow](https://stackallflow.com).