cd-commandcommand linefilename
I want to enter the following folder in the terminal:
Milano, Torino (Jan)-Compressed
How should I write the command cd
to enter this directory?
Spaces and several other special characters like `,
*,
),
(and
?` 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 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).
Top comments (0)