Figuring out Terminal commands


#1

Sorry to take up your time with very basic questions. I’m going through the Appendix A of Learning Python the Hard Way in order to learn the terminal command line commands. I’ve been able to follow your instructions in the lessons in the book, for the most part. Where I’ve been running into trouble is when I’ve tried using “pushd” or “cp” on anything outside the exercise you provide. For example, I’ve tried “pushd” to move to my pictures or documents file, and it says the file doesn’t exist. Same thing with “cp”. I am also making sure I go back to the home directory using cd ~.

I also am sure how to move something in and out of the home directory.

Any help you can provide is appreciated. By the way, I am learning a great deal from your materials.

Thanks,

Brooks


#2

Ok so you need three commands to get around in the terminal. Imagine the directories are like rooms in your house and the lights are out. You’d do this:

cd – Go to room.
pwd – What room am I in?
ls – Turn the lights on to look around.

So, first find out where you are:

pwd
ls

Copy the path that pwd prints out. Now, cd to where you want those files to go:

cd ~
pwd
ls
cd Desktop # or something like that
pwd
ls

See how I go “where am I?” and then “turn the lights on”. All the time.

Now, you can use cp to copy the files from where you were to where you are.


#3

Thank you very much for the response. That is what I thought I was doing and didn’t work. I just tried cd Desktop and it worked this time. Maybe I wasn’t holding my mouth right. Thanks again for the help

Brooks


#4

Ok, you need to read what I wrote one more time, and read every line. You must do this:

pwd
ls
cd

You can’t cd to Desktop if ls doesn’t show you Desktop where you are. You can’t figure out where you are unless you type pwd. Your entire issue with this is you don’t type those three commands all the time.

The reason I’m so aggressive on this is the one thing that’s going to hold you back is “spooky magic thinking.” There is always a reason a computer does something, you just can’t see it. Computers are not magic at all. When I see someone go “well it works now I don’t know why” I make them go back and find out why because that means you are assuming the computer is magic and things fixed their self. That never happens. You did something different and if you figure out what that is then you’ll remember it for next time.

So, go back and try to find out why this was. Use pwd/ls/cd to do it.


#5

You’re right. So basically I can only used pushd, or cd to get to something I can see in the ls of that particular directory. The way to know what directory I’m in is by using pwd, ls. I was trying to jump from one directory to a file in an entirely different directory. Is that correct?


#6

Yep, that is right. You can’t be in a directory and then jump to a random one. You have to either be somewhere that shows your target with ls, OR give the entire path of the target.