Appendix Master the command line


#1

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…


#2

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 ~


#3

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.


#4

Hi @lee8oi

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


#5

But there is no shortcut to the right directory?


#6

You can do

cd ~

to go back to your home directory.


#7

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


#8

Hi @D.J_Q

cd your_folder

#9

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”


#10

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.


#11

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.


#12

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


#13

Hello @DidierCH

I guess it is push Zed talking about.

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


#14

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.


#15

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