In this section we will be going over the following commonly used commands:
pwd (print working directory) into your terminal. If your username is
cookie, you might see:
/Users/cookie(on a Mac)
cd ..to go up a folder; then if you type
pwdagain, you should see
This is the folder in which all your files and folders are saved, called the home folder.
ls (list), **or
dir (directory)** for Windows, into your
terminal. This command shows you a list of all the files and folders in the
current folder (which should be your home folder).
Desktop should be one of
the folders; let's go in there!
cd (change directory) is the command that lets you go into a folder.
However, you need to tell the computer which folder to go into. You need to type
cd Desktop and press
Enter to go into the Desktop folder.
Pro tip: You can type cd Desk and then hit
tab to auto-complete.
Software engineers use tab to type less, which reduces the chance of typos. If
you have multiple files and folders that start with the same name, hitting
tab may fail because the computer does not know how to autocomplete your
request. You will have to type a few more characters and then hit
mkdir notes2357 creates a new folder called notes2357 in the current folder
(which should be Desktop), and you should be able to see the folder if look at
your desktop in the GUI.
To see all the files and folder in your desktop folder, type
The path to a folder is the list of all the other folders you have to go
through to get to it. The longer the path is, the "deeper" that folder is nested
inside other folders. To see the full path of where you currently are, you can
cd for Windows).
When using paths,
~ is a short way to write out the path to your home folder:
mkdir ~/Desktop/notes2357/curriculumwill create a folder called
.. means the parent folder:
Let's assume our current path is:
ls ..will list out the files and folders in
ls ../../..will list out the files and folders in
cd ../..will take you to
Make sure you include a space between the command (
ls) and the options (like