- Laptop
- Terminal
- Laptop
- Anaconda Powershell
- Click here to download the latest version of
Anaconda NavigatorforMacOS - Once the download has finished run the installer
- Click here to download the latest version of
Anaconda NavigatorforWindows 10 - Once the download has finished run the installer
- Navigate to Finder > Applications > Utilities > Terminal
- Run the
Terminal, you should see something that looks like this:
- Navigate to
Anaconda Powershell(it should be in theStartmenu) - Run the Anaconda Powershell
Note: who would like to take a screenshot of the Anaconda Powershell and send it to me? Thx!
$
>
The command prompt, illustrated above per operating system, indicates to a user where they can enter commands (type things)
pwd: or print working directory, shows the directory you are currently inls: lists all contents of a directory (folder)cd: or change directories, use this to move to a different part of your computer
-
check the current working directory (where you are on your computer):
pwdnote you should be in the
homedirectory -
list the contents of the
homedirectory:ls -
choose a FOLDER to open, or change the
working directory, withcd:cd FOLDERfor example
cd Downloadsnote the command line has autocomplete, hit TAB as you type characters to try to use it!
-
hit ENTER to run the command
-
check the command prompt, notice anything different?
my command prompt (for example)
- before step 4
(base) 95-mdpmclapca:~ cta$ - after step 4
(base) 95-mdpmclapca:Downloads cta$
- before step 4
-
confirm that the
present working directoryhas changed:pwd -
list the contents of the FOLDER directory (
Downloadsin my example):ls -
return to the
homedirectory with this SUPER FUN SHORTCUT:cd ~ -
confirm that the
present working directoryis now thehomedirectory:pwd -
note that the command prompt has returned to its default state
my command prompt (for example)
(base) 95-mdpmclapca:~ cta$
mkdir: make and name a new directorytouch: make and name a new fileecho: outputs the strings being passed as arguments>: overwrite data in a file (if the file exists)>>: append data to a file (if the file exists)cat: reads data from a file and outputs the datanano: or GNU nano, a text editor
-
make a new FOLDER with
mkdir:mkdir DATA -
change directories into
DATA:cd DATA -
confirm that the
present working directoryhas changed:pwd -
make a new
.txtfile withtouch:touch data.txt -
confirm that
data.txtis present inDATA:ls -
we can print messages at the command line with
echo:echo "Hello World" -
we can also use
echoto pass information into afilewith>:echo 'data1' > data.txt -
confirm the contents of our file with
cat:cat data.txt -
let's say we have 2 data points, try adding
data2to our file with the following:echo 'data2' > data.txt -
confirm the contents of our file with
cat, see any issues here?:cat data.txt -
catreveals that the command in step 9 has overwrittendata1withdata2 -
let's repeat our procedure and overwrite
data2withdata1:echo 'data1' > data.txt -
here we use
>>to appenddata2todata.txt:echo 'data2' >> data.txt -
confirm the contents of our file with
cat:cat data.txtyou should see both
data1anddata2 -
another way to explore files via the command line is with
nano, the command to launch teh GNU nano text editor. Opendata.txtin nano:nano data.txt -
you can navigate through
data.txtwith the arrow keys and will notice a rather old-fashioned User Interface at the bottom of the window. Ctl-X to exit

