Gremlins in using the Terminal.

Nik-Ken-Bah

Well-Known Member
Joined
Sep 9, 2019
Messages
735
Reaction score
716
Credits
2,741
Ok!
What I was doing. Trying to check the integrity of a few distros I downloaded.
I cd into the folder containing said distros. I had allocated each distro with their own folders. That went OK. :)
So the path was this cd J_ISO (main folder ) done -- cd MX (folder.) returned bash: cd: MX: No such file or directory which is virtually saying eff off Noddy. :eek:o_O
So what am I doing bloody wrong?
Not the first time this has happen BTW.
Just as an aside the distros were Manjaro , LMDE , Salix and MX to use in virtual Box.
TIA
 


You need to input to cd the exact name of the folder, case sensitive (capital letters matter). Check with the command ls that the MX folder actually exists and it is in the expected case.

For example:
Screenshot from 2021-03-15 21-24-58.png


You can also use the [TAB] key to check whether you started typing the directory correctly:

Code:
➜  Downloads  cd J
# press tab key will autocomplete
➜  Downloads cd J_ISO
 
Ah, looks like you added a space after MX (and Salix as well). Try running mv 'MX ' MX and then cd'ing into MX as usual.
 
@LorenDB
What I need to do is create another folder for the Integrity check PNG and see how I go from there as I cd into manjaro without a hitch. Ta.
 
@LorenDB
Well I did a little fiddling and found that any folder listed in a directory enclosed by this ( ' ) you cannot cd into.
As I cd into Manjaro no problema so I changed the folder name to " Manjaro-mx" and it cd into that folder with ease.
I checked this by trying to cd into LM Debian Ed and it didn't want to go there either and you will notice what I mentioned earlier.
 
I never check integrity of a iso I've downloaded from an oem website and have never had a bad iso download.

I download the iso and create bootable media and boot from it and that speaks for the integrity of the iso.

I know more users who have wasted valuable time trying to check the iso's download integrity only to experience headaches trying to do so.

Live and learn and learn by doing.

Just my opinion.
 
Live and learn and learn by doing.
That I be a doing,:) to get use to the terminal and accessing files through the terminal, so later on this becomes second nature when having to deal with more difficult commands.
 
If you have a space at the end, you can cd into it but you have to quote it.

So:

Code:
cd "MX "

To test:

Code:
mkdir "test "
ls -la
cd "test "
cd ../
rm -rf "test "
 
You beat me to it again! ;)
 
Seeing as they're wanting to play in the terminal, I gave 'em a few more commands to play with.

I should also mention that it works with text after the space.

Code:
mkdir "test this"
 
Using quotes (single or double) is not a good idea though. Tab completion doesn't work for one thing.

Using spaces at the end, as @Nik-Ken-Bah did with 'MX ' makes it practically impossible to see when using ls to list files and directories.... yet that trailing space is necessary to cd into that directory.

Correction on tab completion. Using MX is too short and I need to enter more characters for tab completion to work. Oops. :oops:
 
The best idea is to just use sensible naming when working with files. That prevents all of this.
 
@stan @KGIII
Take a look at my post at #6 you will see what I found.
Also notice the LM Debian Ed and Salix in the screen shot I posted earlier.
 
Well I did a little fiddling and found that any folder listed in a directory enclosed by this ( ' ) you cannot cd into.
But you CAN cd into those folders.... you must type them EXACTLY as you created them, including the quote mark, and including the spaces... even the space at the end. Computers are unforgiving about upper case, lower case, and all that stuff... you must be careful and exact.
 
sensible naming when working with files
Not only that it has to be a name that you understand without pondering if it is the right one. :p:D
 
you must be careful and exact.
I just did as you suggest and was able to cd straight into Salix using the quote marks, but here is the thing the folder is simply Salix without the quote mark that quote mark comes when you ls the directory J-ISO.
Which to me means that I have to cd into the main directory (folder in Files){ J-ISO} then ls that directory to find out how the machine has written the sub directories ( folders in the main Folder) then use the naming convention of the ls to cd into that sub-directory. Correct?
 
I just did as you suggest and was able to cd straight into Salix using the quote marks, but here is the thing the folder is simply Salix without the quote mark that quote mark comes when you ls the directory J-ISO.
Which to me means that I have to cd into the main directory (folder in Files){ J-ISO} then ls that directory to find out how the machine has written the sub directories ( folders in the main Folder) then use the naming convention of the ls to cd into that sub-directory. Correct?
What is "J-ISO" ? Was that directory created by a program, or a script? Or did you create it?
 
Was that directory created by a program, or a script? Or did you create it?
No! It was a folder created by me to store ISO files to make it easier for me to locate when I want to use those files in Virt-Box or create a USB stick to load directly on my hard drive. I named it J- ISO to distinguish it from another file named ISO to something earlier. The files in that J-ISO folder contains all the named folders which contain the appropriate ISO and GPG and MD checks.
 
Hmmm, I am noticing that some of my files and folders have single quotes around them too. A little Google searching shows this explanation. So don't feel alone, Davey.... this is confusing a lot of folks, now including me. o_O;)

What that article is telling us is this: The single quote marks are automatically put there by the ls command for any file or folder name that contains a space. Your screenshot in post #3 explains why you can go straight into Manjaro with cd Manjaro.... because it has no space. but the other 3 folders do have one or more spaces. With MX and Salix, you must cd 'MX ' or cd 'Salix ' (with those spaces) and inside the quotes... it's the only way to get inside those folders, but you can do it.

Spaces have always given trouble in Linux... and often you will find people using - or _ between words in a file or folder name, or run words all together, like MXLinux19.

The special trouble with Salix and MX is that when you created those folders, you put a space at the end of the name. Testing on my system, if I create a folder test<space> with the space on the end, the mkdir command knows my mistake and strips the space off, so the folder is just plain test. I think that you may have specifically used the quotes to mkdir 'MX ' and mkdir 'Salix ' (using single or double quotes) that put you in this spot. Or else your Linux Mint behaves differently from my Zorin Lite distro. Or perhaps there's another reason that isn't coming to me.

Whew! Too much?

@LorenDB says how to fix these folders in post #4 above. I'll repeat:
Code:
mv 'MX ' MX
mv 'Salix ' Salix
mv 'LM Debian Ed'  LM-Debian-Ed

If you run these three commands, you can then cd MX or cd Salix or cd LM-Debian-Ed easily. But the LM Debian Ed is not as much of a problem as the others, so you can leave the space there if you prefer them. Just be careful about spaces at the end... that's the tricky one. :)
 
Last edited:

Members online


Latest posts

Top