Appendix Master the command line

Hello, I’m struggling with those two questions:

  • cd to the apple directory with one command.
  • cd back to temp with one command, but not further above that.

I tried cd , cd /, cd .\ and other versions of points and slash, it’s not that…

Hello @D.J_Q

The basic usage of the command is cd + directory + / next_directory + / next_if_more

cd /home/apples/next…

One can say you get ”down” or ”in to” these directories.
If you want to get ”up” or ”out from” there, you use:

cd ..# corrected
or
cd ../../..# corrected

Two dots mean one level up.
So the second example above moves three directories up.

And if you want to go home quickly there is a handy way to use.

cd ~

1 Like

The 2 dots is correct. 3 dots is not.

change to parent directory (directory that contains the current directory)

cd ..

change to parent directory’s parent

cd ../..

and so on.

Hi @lee8oi

Thanks for correcting this.
I didn’ t saw that.

1 Like

But there is no shortcut to the right directory?

You can do

cd ~

to go back to your home directory.

Yes, I get that, but I meant diving to one subdirectory with one command.

Hi @D.J_Q

cd your_folder

Hi @ulfen69. It does not work unfortunately. If I get up to cd ~, and then try to dive in a subfolder situated several steps under my home folder (let’s call it subsubsub), it does not work to write cd subsubsub. I get “cd: no such file or directory: subsubsub”

Hi.

Then you have to do:

cd sub_folder1/sub_folder2/sub_as_long_as_you_need

And now and then type

pwd

To see where you are.
And

ls

To see whats in there.

1 Like

Yes, m’y point exactly. This is what I have been doing but Zed seems to say there is a way to access subfolders with one command.

Can you tell us to which chapter you refer to? Appendix A, Chapter ???

Hello @DidierCH

I guess it is push Zed talking about.

Unfortunately I cannot help you with this.
I have to learn myself.

I think you might be confused about “one command”. You are probably thinking:

cd this/is/apple/grape/fig
magicapplecommand

Where you think “one command” means a single word that will go there. That’s not “one command”, one command is a single line that you type to make it do something. What I mean is:

cd ..
cd ..
cd ..

That’s three commands, but:

cd ../../..

Is one command. Now, you can use one command, but you have to use pushd and popd and it’s more complex.

Ok, then we are on the same page. Thank everyone for the help.

1 Like