aaron maxwell

Terminal Commands

pwd

Tells what your current directory is. Stands for "print working directory".

cd

Change directory. If you run it without arguments (e.g., type "cd" then enter), it goes to your home directory. Remember you can type "tab" to get possible choices.

Remember, "directory" and "folder" basically mean the same thing. Ways to use it:

cd SomeDirectory
Change into the directory.
cd "Some Directory"
If the directory name has a space in it, you need to surround it with quotes.
cd ..
Go to the parent directory.
cd
(by itself) Go to the home directory.
cd ~/SomeDirectory
Go to the directory SomeDirectory that is in your home directory.

ls

List files. Use ls -F to add a "/" to the end of folders; or ls -G to color-code.

mkdir

Create a new directory. Use it like: mkdir NewDirName

Running Python Programs

python3 something.py

Run the program something.py (which must be in the current directory), using Python 3

python something.py

Run the program something.py using Python 2.7

python3 -m doctest something.py

Run the doctests in the program something.py. Code in a "main block" will not be run. Remember, a "main block" looks like this:

if __name__ == "__main__":
    print("This is the main block.")

It also works with Python 2 (i.e. using python instead of python3).