Section 2 of 3 - Return to Section 1?
Part of my writing on hobby videogame development




Navigating via Command-Line: Mac Terminal


To launch: run "Terminal" or search for Terminal in Spotlight

Context via the traditional Mac OS X file browser of the example files and directories:



Examples of how to navigate and view those directories with the command-line:



Mac Terminal (or Linux Shell) Notes:

deleonic

This is my username at this terminal. Where this example shows deleonic, yours will show your username (not deleonic!).

/Users/deleonic

User's directory. This can be abbreviated with a ~ (tilde).
"cd ~/TestDir" works the same as "cd /Users/deleonic/TestDir"

adsl-69-110-24-228:TestDir deleonic$

The part before the : can generally be ignored (yours will say something different). The part after the : is the name of the directory in focus. The word behind the $ is the current user (yours will say something different).

pwd

Short for Present Working Directory. Type this to show the path of the directory currently in focus. This is important for getting your bearings - type this if lost.

ls

Short for "list" - lists all files and folders in the directory that is currently in focus.

cd

Short for Change Directory. Needs to be told which directory to change to.

cd folderInIt

Change Directory to "folderInIt". Because there is no "/" in front of the directory name ("folderInIt", not "/folderInIt") it will look only within the folder currently in focus - we'll need the directory in focus to be TestDir for this command to work.

cd ..

Change Directory to parent directory; change focus to the folder containing the folder currently in focus ("go up one").

Common variations not shown in the example above:

cd ~

Change Directory to user's directory ("go directly to /Users/deleonic", where deleonic is my username).

cd ~/TestDir/folderInIt

Change Directory to /Users/deleonic/TestDir/folderInIt, no matter which folder is currently in focus.

Other notes:

Unlike DOS Prompt, Linux/Mac is strictly case sensitive. Typing "cd folderInIt" will work, but typing in "cd FOLDErinit" will not. By convention, programmers on Linux/Mac tend to keep filenames and folder names either use either all lowercase ("otherfile.ini"), camel-backed ("folderInIt"), or with the first letter of every word capitalized ("TestDir").

Note: Mac and Linux use the "/" slash everywhere. This is the same slash that is used for website addresses.

Pressing the [tab] key on most newer versions of Windows/DOSPrompt will auto-complete the filename or foldername currently being typed in. "cd fo[tab key]" will autofill into "cd folderInIt" if the current directory is TestDir, since there's only 1 folder/file in the directory that begins with "fo".

Continue to the Third and Last Section...