A computer can be thought of as a set of hardware (processor, memory, storage, network) that operates using software (documents, programs, data, etc). The software on a computer is made up of files, organized into a hierarchal directory (folder) system. Another name for directory (original name) is folder (newer name), but they both refer to the same thing.
At the top of this hierarchy is the root directory. Below the root directory is an area where the user can store their files and sub-directories, called the users "home" directory, which is named the same as the user's username. This offers an opportunity for the user to organize their files into directories that are named according to their use or type. Here is an example of a users home directory showing some sub-folders:
└── scout
├── Documents
│ ├── school
│ │ └── schedule.pdf
│ └── college
│ └── essay1.doc
├── Pictures
│ └── suzi.jpg
├── coding
│ ├── test1.py
│ └── cs50
│ ├── week0
│ │ ├── indoor
│ │ │ └── indoor.py
│ │ └── playback
│ │ └── playback.py
│ └── week1
└── Music
├── Wolf Alice
│ └── dont_delete_the_kisses.mp3
└── Tay-tay
Computers have a shell terminal, which is like a text-based control panel for your computer. Instead of clicking buttons with a mouse, you type commands with the keyboard, and the computer runs them. The terminal is the window or program you open (like an app) where you type.
The shell is the program running inside that window that actually understands and executes your commands (like bash, zsh, or powershell).
The shell prompt is the little bit of text you see before the cursor, where the shell is “waiting” for your input. Typically, it is just the $ symbol, but sometimes there are other pieces of information, for example:
user@computer:~$
"user" is your username.
"computer" is the machine’s name.
"~" means you’re in your home folder.
The "$" means the shell is ready for a command.
So, when you see the prompt, it’s like the computer saying: 👉 “I’m ready—what do you want me to do?”
You type a command (like ls to list files), press Enter, and the shell runs it and usually outputs some information. Then it shows you another prompt, waiting for your next instruction.
VS Code (see below) has a built in terminal that you can use to interact with the computer's file system, like creating directories, running your python programs, submitting programs to CS50, and more (see next section)
Here are some basic commands that are built-in to every shell. Most have to do with file and directory operations, and these will be most useful for your CS50 class.
ls - "list": list contents of directory
$ ls # list files in current dir
$ ls -alF # list all files (detailed output)
$ ls ~/foo # list files in directly foo
pwd - "print working directory": print out the current directory
$ pwd
cd - "change directory": used to change to another directory
$ cd # change to home directory
$ cd ~ # also change to home directory
$ cd ~/coding/cs50 # change to the directory "cs50", which is under "~/coding" dir
$ cd .. # move up a directory, ie, in previous sample this would move to "~/coding"
cp - "copy": copy a file
$ cp file.txt copy.txt # copy file
$ cp -r dir backup/ # copy folder
mv - "move": move a file, or rename it
$ mv file.txt blah/ # cove file to a dir called "blah"
$ mv old.txt new.txt # rename file
rm - "remove": remove (delete) a file or directory
$ rm file.txt # delete file
$ rm -r blah/ # delete folder
mkdir - "make directory": used to create a new directory in the current working dir
$ mkdir indoor # create a directory called "indoor" under current dir
$ mkdir ~/foo # create a directory called "foo" under home dir
rmdir - "remove directory": remove (delete) a directory
$ rmdir blah # delete directory
cat - "catenate": print out the contents of a file
$ cat foo.py # print out the contents of foo.py to screen
clear - clear the screen
$ clear
exit - exit (close) the shell
$ exit
VS Code (Visual Studio Code) is a very popular source code editor used by programmers all over the world (including your dad). It has many features that help streamline the development process and make coding easier. It is usually downloaded and installed to run as a program on your computer, but CS50 course provides something called cs50.dev: It is is a cloud-based version of VS Code that provides you with your very own “codespace” with everything that you need for the course pre-installed. No need to download and install VS Code or Python on your own Mac or PC! If not already familiar, be sure to watch the Visual Studio Code for CS50 Short for a full overview.