Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu.

Similar presentations


Presentation on theme: "CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu."— Presentation transcript:

1 CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu

2 About Me My name is Hubert (Sathaporn) Hu.  You should only call me Sathaporn if you know Thai… Otherwise, call me Hubert. My email address is: sathaporn.hu@ucalgary.ca sathaporn.hu@ucalgary.ca  Please put CPSC217 in email’s subject I also have website: http://husathap.github.io.http://husathap.github.io  The course material is also available here!

3 Today’s Tutorial Tips! Installing Python Terminal 101 Changing Password Hello World!

4 Tips! To help you survive university, I have some tips for you! 1.Your TA is also a student. So he probably doesn’t know everything. 2.Your TA is also busy, so he might be not able to help you with everything. (This also means don’t leave your questions until the day before the assignment is due!) 3.University is FAST & FURIOUS! So get familiar with your class content now! You are also expected to know the materials more thoroughly!

5 Installing Python Please install Python 3 (AND NOT VERSION 2+) on the machine. If you are using the lab’s computer, Python 3 is already installed. Each platform handles the installation differently, so I suggest that you look into Python’s website for it.

6 Terminal 101 From what I heard from your instructor, most of you haven’t attended the block week class that will teach you how to use Unix… Which is a shame… However, the instructor has asked me to teach the basic of shell scripting. Terminal 101 won’t show up in your exam, so don’t worry about it too much. This tutorial covers this topic very shallowly though, so it helps if you do more self-studying on it.

7 Terminal 101 To get started, open your terminal.  If you’re using Windows, you can open Powershell. Then you will greeted with an unfriendly screen with something like this:...stuffs...>

8 Terminal 101: pwd In your terminal, you will be positioned inside a folder … normally in your root or your user folder. The current directory is indicated in …stuffs…...stuffs...> There is also a handy program called “pwd” that displays your current directory. EXERCISE: type pwd to see what happens.

9 Terminal 101: dir/ls If you want to know the directories, use “dir” “ls” will list all files in the directory. EXERCISE: type dir then ls to see what happens. These programs also take an argument as well. So if you have a folder named “Folder” using “dir Folder” will shows directories inside “Folder.” EXERCISE: execute dir with a valid folder and then ls with a valid folder.

10 Terminal 101: cd Well, you can see the folders, but what about accessing it? Use cd! EXERCISE: Use cd into a folder listed by dir. If you need to backtrack, then type “cd..” EXERCISE: Backtrack by typing “cd..” TIPS: You can also cd directly into a folder by execute cd with the folder’s path.

11 Terminal 101: mkdir/rmdir You can also make a folder as well. Use “mkdir” to create a new one. Use “rmdir” to delete it! EXERCISE: Make a new folder with mkdir and delete it with rmdir. DANGER: Deleting a folder through terminal doesn’t move it to a Trashcan. Rather, the whole folder is gone FOREVER! TIPS: rmdir will only delete empty folder. You must empty the folder’s content first.

12 Terminal 101: rm If you want to delete a file, use rm to eliminate it. EXERCISE: Type “touch garbage.txt” to create an empty file and then delete it. DANGER: rm doesn’t move the file into the Trashcan! So if the file is deleted through rm, it’s pretty much gone! TIPS: rm may ask you whether you’re really sure or not. Type Y to proceed, N to cancel!

13 Terminal 101: Executing a program If you want to execute a file, simply type its path into the Terminal. TIPS: Sometimes, the file can be locked! I won’t go into the detail on how to unlock it. Certain programs can be opened just by typing its name, so you don’t need to know its path.  Examples are: dir, ls, cd, mkdir, rmdir, rm, python, … If you don’t know how to use a program, then open it with --help. EXERCISE: Try getting help for ls.

14 Changing your password! Some of you may not have changed your password for your UCalgary IT account. So after class, please use this terminal program passwd on a computer in the lab to change it! Of course, if you don’t know how to use passwd, use passwd --help or Google! Seriously, you must be good at Googling stuffs if you want to survive computer science!

15 Hello World! EXERCISE: Make a Python program that prints Hello World! on to the screen in a text editor of your choice. HINT: You only need one line! To execute this code, you must go use Terminal to run a program named python using the path of the program as a parameter. EXTENDED EXERCISE: Complete Exercise #1 given by your instructor.


Download ppt "CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu."

Similar presentations


Ads by Google