Learn Python3 the Hard Way - Command Line Crash Course


#1

I am trying to do Exercise 8 Session on page 268:
Moving Around (push, popd)

My prompt looks like this:
Lowells-MBP: lowellcopeland$

The book says to do the following:
cd temp
mkdir i/like/icecream

Here is what I get as a response

Lowells-MBP:~ lowellcopeland$ cd temp
Lowells-MBP:temp lowellcopeland$ mkdir i/like/icecream
mkdir: i/like: No such file or directory

Can anyone give me a hint as to what I am doing wrong.


#2

Hi @LowellCope

When you do

mkdir i/like/icecream

you got an error because the ”i” and ”like” folder does not exist yet.
the mkdir command without options can just make a subfolder to the one you are in at the moment.

But you can use the ”-p” flag.

mkdir -p i/like/icecream

Then it will create all of them in one line of code.


#3

I just have to like one more answer of you @ulfen69 :slight_smile:
Good job!


#4

Hi Ulfen69 & DidierCH,

I am still struggling with some parts of the assignment for Session 10 in the Command Line Crash Course in Learning Python 3 the Hard Way - Page 275. In the Do More section I tried, using Terminal, to copy a file to the my home directory and to the desktop. I tried using some of the files in the temp directory we created earlier but I was not able to get it to work. My prompt reads Lowells-MBP: ~lowellcopeland$ One of those is probably the home directory, but neither works.

Is this something that can be done from Terminal? Of course I will appreciate your advise.

Sincerely,
LowellCope


#5

Hi Ulfen69 & DidierCH,

I am still struggling with some parts of the assignment for Session 10 in the Command Line Crash Course in Learning Python 3 the Hard Way - Page 275. In the Do More section I tried, using Terminal, to copy a file to the my home directory and to the desktop. I tried using some of the files in the temp directory we created earlier but I was not able to get it to work. My prompt reads Lowells-MBP: ~lowellcopeland$ One of those is probably the home directory, but neither works.

Is this something that can be done from Terminal? Of course I will appreciate your advise.

Sincerely,
LowellCope


#6

Hello @LowellCope.

This is your home directory.
Do you have a folder for the course (lpthw)?
I did one for the course. After that I created folders for each chapter (after ex20) inside to keep my self a little bit structured.

Do you have something similar?
If so I guess your temp folder is in there.

Go in there

cd home/lpthw/ex_some_name/temp

Copy the file to the desktop

cp the_file.py /home/Desktop

And yes. The terminal can do this and much more. When you learn more and get used to it you will probably find it better for at least some of the work you do on the computer.


#7

Hey @LowellCope, I believe the central problem you’re having is you need to do this all the time:

pwd
ls

Usually when people can’t figure out how to move or copy it’s because they have no idea where they are (pwd) and what’s there (ls). Think about it like walking around a dark house, and every time you type cd you walk into a new dark room. You’re then trying to move things around inside this dark house but you aren’t turning the lights on (ls) and you have no idea what room you’re in (pwd).

So, try this:

cd to where the file is
pwd
ls
cd to where you want it to go
pwd
ls

Now you know the full paths of both where the file was and where you want it to go, and you can work from there.