You're supposed to type :
gedit ~/Untitled\ Document
Why? "space" is a character in linux, it's "interpreted" rather than "read".
In a succession of arguments in a terminal command, a space will be interpreted as or will mean: "now I will pass the next argument".
With this in mind, your gedit did exactly what you told it to do, first edit a document called "Untitled", if it doesn't exist, create it, as soon as you save and exit out of that one move on to editing a document called "Document", if it doesn't exist create it.
So, if you want a space to be read rather then interpreted, you need to "escape" it. Basically the main use of
\ (backslash) under linux.
This is what the backslash character interprets as: "whatever follows me, ignore it, just read it as a string (text) not as an interpretable character".
If you click and drag the file to your terminal after typing
gedit you'll find that it fills it with the
This applies for long file paths as well, if one of the folders has a space in it, it must be escaped.
An easy workaround for this is to use double quotes arround the path or filename in order to have the entire thing be read as a string (text), like this :
gedit ~/"Untitled Document"
One last trick to get it right is to use the terminal's autocomplete feature : Tab
If you have entered a case sensitive part of the name or path that is at least 2 characters long, tab will autotocomplete with the only possible match.
Say you have no other files starting with
will fill out your missing file incuding the
You can also use double Tab as a quick list of the remaining options if there are more than one.
If there is only one option Tab will autocomplete selecting it without you needing to prefill ancharacters at all.
By the way, if you open a terminal, at the moment it opens you are aleady in "home" AKA : ~/
typing that extra bit works but is unecessary:
gedit Untitled\ Document
works fine. If you cd to another directory (for example
cd Downloads) it would maybe make sense, but you could always just type
cd alone and it would bring you right back to home and you could type your paths without
~/ again, which is less keystrokes and faster.