On Wed, Nov 27, 2024 at 12:55:10 +0100, to...@tuxteam.de wrote: > First: cd is not a command, it is a shell builtin > (this is subtle, but important).
It's both. You can even call it a "builtin command". > Second: even if cd were a "command", the splitting > of args at whitespace (among *a lot* of other things) > is done by the shell before the command has even a > chance at it. Yes. The shell *parses* each command you type, and among the steps taken by the parser, one of the most basic is tokenizing the input into words. Given a command like this: cd /mnt/c/Program Files the tokenizer breaks it into words: [cd] [/mnt/c/Program] [Files] The first word will be the name of the command to run, and all the words after that will be arguments passed to the command. If you want "Program Files" to be treated as a single word, then you must use quoting. There are several forms, and they're all acceptable: cd "/mnt/c/Program Files" cd '/mnt/c/Program Files' cd /mnt/c/Program\ Files cd /mnt/c/"Program Files" In all four cases, the tokenizer only sees two words: [cd] [/mnt/c/Program Files] (A second parsing step is quote removal, which discards the quoting characters that were used to aid the tokenization.) Also just for the record, bash's tab completion feature is extremely helpful. If you type just "cd /mnt/c/Pro" and then press the Tab key, it will look at the actual file system and find files or directories that match the current partial word. If there's only one match, then it'll type out the rest of the filename for you. If there are multiple matches, the behavior depends on your settings. You may need to press Tab a second time to get a list of the matches, so that you can type more characters to make your partial word have only a single match. When tab completion auto-types a filename with whitespace in it, it'll use the backslash quoting form to mark the spaces as literal characters rather than word separators.