i have a directory name with ISO&Emulator having some Important Files. and this directory is in different partition, and partition not showing in my FileManager(Nautilus). so i mount my partition and access it from terminal, but i can't get into directory because of its name.
when i tried to change directory:
cd ISO&Emulator
result:
[1] 1635
bash: Emulator: command not found
bash: cd: ISO: No such file or directory
[1]+ Exit 1
its taking directory name as a command. any ways for access this directory from terminal?
how to fix this?
You should quote the file or directory name, that contains special characters, when you using it:
Or escape (or quote) just the special character:
In most cases you can use the auto-completion function:
Recently I found a nice answer, provided by @MartinThornton, that describes how to bind PgUp and PgUp to Select a particular result from completion suggestions.
See also: How to make tab completion append slash for directory symlinks?
Unlike the single quote marks the double quote marks are applicable when the name contains a variable:
Since this isn't a command-line-only system and a graphical desktop environment is installed, you should know about another way to use files and directories from the terminal whose names require quoting or are otherwise cumbrersome to type: Drag the folder icon from your file browser into the terminal window. On you system the file browser is Nautilus, but this works with nearly all file browsers. This pastes the full path of the file or directory whose icon you dragged with correct quoting automatically applied.
This isn't a full substitute for knowing how to quote pathnames (or, really, any text) yourself using the techniques pa4080 describes, but it's extremely useful, can save you a lot of time, and if you're not comfortable with when and how to quote using
\
, in most graphical terminal emulators that's the form of quoting that is automatically applied when you do this, so it will demonstrate it to you. (In some,'
'
are used.)Unless you've changed it, the shell you get when you open a terminal window or log on in a virtual console is Bash. The purpose of quoting in any shell is to tell the shell not to treat certain characters specially. You may want to read 3.1.2 Quoting in the Bash reference manual.
When you quote manually, I suggest you prefer the
'
'
(single quotes) form, since it's the simplest and easiest way to quote more than a few characters of text. If what you want to quote doesn't itself contain a'
character then you can always enclose it in single quotes, because the only character with special meaning after'
begins quoting is the subsequent'
that ends quoting.Finally, you may be wondering what happened when you had an unquoted
&
in your command.This treated what came before it (
cd ISO
) as one command, ran it asynchronously in the background, and treated what came after it (Emulator
) as a second command to run as well (in the foreground, since it had no&
after it).[1] 1635
reported the background job had started (it was job 1, and its process ID happened to be 1635).bash: Emulator: command not found
reported there was no command calledEmulator
.bash: cd: ISO: No such file or directory
arrived from the background job to report there was noISO
directory to change to.[1]+ Exit 1
reported job 1 had finished.