Help sheet for navigating Unix shell on the Mac, or the command prompt on PCs.
1) Getting to the command line.
- On a Mac, open the application called "Terminal".
- On a PC, find "Command Prompt". In many XP installations, this is under Accessories.
2) Navigating directories/folders. A few useful commands.
- pwd (Mac/Unix only). This will tell you what directory you are in. (present working directory)
- ls (Mac/Unix) Will give you a listing of all files in the present working directory.
- dir (PC) Will give you a listing of all files in the present working directory.
- cd By itself, this command will take you "home" - to where you started.
- cd foldername This will move you inside the folder indicated, assuming that folder exists in the "present" folder.
- cd .. This will move you "up one level".
Example.
> pwd
/Users/scottm
> ls
Courses Grading info.txt
Java
Programs resume.doc
todo.xls
This shows folders named Courses, Grading, Java, and Programs, and files called info.txt, resume.doc, and todo.xls.
> cd Courses
We should now be inside the Courses folder.
> ls
15-100 15-128
15-391
This shows 3 folders for 3 courses.
> cd 15-100
Now we should be inside the 15-100 folder.
> pwd
/Users/scottm/Courses/15-100
> cd ..
Take us back up a level.
> pwd
/Users/scottm/Courses
> cd 15-391
Now we should be inside the 15-391 folder.
> cd
Take us "home".
> pwd
/Users/scottm