\documentclass[12pt]{article}

\newcommand\comname[1]{\textbf{#1}}
\newcommand\comoutput[1]{\texttt{#1}}
\newcommand\compath[1]{\texttt{#1}}

\newcounter{commandcounter}

\newcommand\complusdesc[2]{\addtocounter{commandcounter}
  {1}\textbf{\thecommandcounter. #1 } \emph{#2}\\ }

\parindent=0cm
\parskip=.5cm
\topmargin=-1.5cm
\textheight=25cm

\pagestyle{empty}

\begin{document}
\subsection*{Running commands in a Terminal}

It is best to run your GUI Python programs from a Terminal rather than
from directly in IDLE.  To open a Terminal, click on the icon that
looks like a black computer screen (there should be one on your Dock,
if not you can find it in Applications/Utilities).  There
are thousands of different commands which can be run from within a
Terminal, but we will only look at a handful.

\begin{sloppypar}
  \complusdesc{pwd}{(Path to Working Directory)} You can find out what
  directory (folder) you are in using the command \comname{pwd}.  This
  stands for Path to Working Directory (the working directory is also
  called the current directory - it is the one you are in).  When you
  open a new Terminal window and type \comname{pwd} the output should
  be something like \comoutput{/home/cshome/a/astudent} because you
  are in your home directory (Your home directory is the directory
  that has the same name as your username).
\end{sloppypar}

\complusdesc{ls}{(List)}
You can list the contents of the directory you are in using the
command \comname{ls}.  If you type \comname{ls} in a Terminal while
you are in your home directory, you should see a list which contains
the same files and directories that you can see if you open up a
Finder window and go to your home directory.

\complusdesc{cd}{(Change Directory)} You can change to a different
directory using the command \comname{cd}~\emph{argument} (where
argument is a directory to change to).  So if \comname{ls} shows that
there is a \compath{Lab1} directory in the current directory
\comname{cd~Lab1} will change into the Lab1 directory.  If you type
\comname{cd} by itself then you will change into your home directory.
If you type \comname{cd ..} then you will change into the parent
directory of the one you are in.

\emph{Note:} If there are any spaces in a directory name then you will
need to put a \textbf{$\backslash$} in front of each one.  For
example to change into a directory called \compath{Lab~1} you will
need to type \comname{cd~Lab$\backslash$~1}

\complusdesc{python}{}
You can run a python program by typing
\comname{python~myprogram.py} in the Terminal (assuming that
myprogram.py is in the current directory).  If you just type
\comname{python} by itself then it will start the python interpreter.

\emph{Extras:} Two extra features which make typing commands in a
Terminal quicker are command-history and tab-completion.  You can
scroll through a list of previous commands by pressing
\comname{up-arrow}.  When typing a command or a file or directory
name, if you press \comname{TAB} then the Terminal will attempt to
complete the command for you.  For example if the only file starting
with \comname{m} in the current directory is \comname{myprogram.py}
you could type \comname{python~m} and then press \comname{TAB} to save
typing the rest of the program name.
 
\end{document}
