cd on terminal

When I'm in TERMINAL and I issue the cd command it says no such file or directory. I cut this from the terminal session:

Last login: Tue Nov 12 20:10:57 on ttys000

The default interactive shell is now zsh. To update your account to use zsh, please run chsh -s /bin/zsh. For more details, please visit https://support.apple.com/kb/HT208050. iMac:~ robertsantovasco$ cd desktop iMac:desktop robertsantovasco$ cd L1 demo -bash: cd: L1: No such file or directory iMac:desktop robertsantovasco$ cd L1 -bash: cd: L1: No such file or directory iMac:desktop robertsantovasco$ cd L1 demo -bash: cd: L1: No such file or directory iMac:desktop robertsantovasco$ cd / iMac:/ robertsantovasco$ cd desktop -bash: cd: desktop: No such file or directory iMac:/ robertsantovasco$ cd L1 demo -bash: cd: L1: No such file or directory iMac:/ robertsantovasco$ cd L1 demo -bash: cd: L1: No such file or directory iMac:/ robertsantovasco$ cd desktop -bash: cd: desktop: No such file or directory iMac:/ robertsantovasco$ cd desktop -bash: cd: desktop: No such file or directory iMac:/ robertsantovasco$ CD desktop /usr/bin/CD: line 4: cd: desktop: No such file

Answered by robert0605 in 814460022

Thank you very much.

  1. Consider chaning to zsh as recommended in the output. If you do this you can press the TAB key to complete names of files to avoid tpos.
  2. It looks like you are trying to change into a folder called "L1 demo". If so, that folder has a space in it. You need to enclose the folder name in quotes like this:
cd "L1 demo"

Or escape the space character with backslash

cd L1\ demo

So that the shell understands it to be a single argument to the cd command.

A few hints here:

Firstly, you only have to do this once, but please type:

chsh -s /bin/zsh

and press Enter.

That will change your shell - the environment you're in when you open the Terminal - to zsh, the new, default environment for macOS.

pwd will tell you your current location.

cd directoryWithoutSpaces will try to change directory (cd = change directory) to the directory called directoryWithoutSpaces inside your current location.

If the directory you want to go to has spaces in it, you can either surround the directory name (not the cd command, just the directory) with double quotes, or you can 'escape' the space by putting a backslash in front of each space, so...

cd "directory with spaces" will try to change directory to the directory called directory with spaces inside your current location. And cd directory\ with\ spaces will do the same thing.

So, let's say you have a folder on your desktop called cheese. You open the Terminal and you type pwd to see where you are. You should be in your home directory, which will be displayed as ~/robertsantovasco. You type cd Desktop and you're in ~/robertsantovasco/Desktop. Type cd cheese and you're now in ~/robertsantovasco/Desktop/cheese.

If you want to go up a level, you can type cd .. so you're now in ~/robertsantovasco/Desktop.

There's a handy shortcut to go back to the directory you were just in: cd -. So, if you followed the steps above to go into ~/robertsantovasco/Desktop/cheese and back to ~/robertsantovasco/Desktop then typing cd - will put you back into ~/robertsantovasco/Desktop/cheese.

This is a simple set of instructions for using the Terminal, but you likely need to do a little more in-depth reading.

Accepted Answer

Thank you very much.

Thank you very much.

Thank you very much.

cd on terminal
 
 
Q