command prompt terminal, open on windows
you can find it by searching for “Command Prompt” in the Start Menu.
While “terminal”, “shell”, “command line”, “CLI”, and “command prompt” are technically different, they are often used interchangeably. What do they refer to?
A program that allows you to interact with your computer in a text-based way.
(Traditionally “terminal” meant a physical device you could type commands into, essentially a keyboard and a screen.
These days, when we say “terminal”, we mean “terminal emulator”, a program that emulates a physical terminal; it’s a program that lets you type commands into a window on your computer.
Which commands you can use is determined by the shell.
The terminal emulator is just responsible for drawing text on the screen and processing your keystrokes.)
GUI
Graphical User Interface or “Gooey”
When you use on a mouse to click on icons, buttons, or menus, you’re using a GUI.
Drawbacks to GUIs
-They’re weak. You are given much more control over your computer through a CLI. With a GUI you’re limited to the options that the developer of the GUI has given you.’’
-They’re slow. Once you know the commands to type, it’s much faster to type them than to click through endless menus with a mouse.
-They’re not as reproducible. If you want to share a set of instructions, you can just copy and paste commands without worrying about screen sizes and user preferences.
-They’re not automatable. It’s easy to write code that manipulates text (as you’ve seen in Python), but it’s much harder to write code that manipulates GUIs.
-They’re not as cool. You will be invited to 90% fewer romantic outings if you are a GUI user.
How do you determine your username?
Type whoami in the command prompt terminal
How to see what version of windows you’re running:
Options:
1) pressing Win + R and typing winver, or
2) go to Start > Settings > System > About and checking “Windows specifications,”
Terminal vs Terminal Emulator
Traditionally “terminal” meant a physical device you could type commands into, essentially a keyboard and a screen.
These days, when we say “terminal”, we mean “terminal emulator”, a program that emulates a physical terminal; it’s a program that lets you type commands into a window on your computer.
Which commands you can use is determined by the shell.
The terminal emulator is just responsible for drawing text on the screen and processing your keystrokes.
Shell or REPLs
A terminal is just a program that lets you issue text-based commands and renders the output of those commands.
A shell runs those commands.
REPL:
Read
Eval (evaluate)
Print
Loop
That is, shells are programs that:
1. read the commands you type
2. evaluate those commands, usually by running other programs on your computer
3. print the output of those commands
4. give you a new prompt to type another command and repeat
Example:
f you’re using Ubuntu on WSL, you’re probably running a Bash shell.
If you’re using macOS, you’re probably running a Zsh shell.
The point is that you’re probably using Bash or Zsh, and for the purposes of this course, they’re basically the same.
Both Bash and Zsh are shells, and they also happen to be powerful programming languages. They have variables, functions, loops, and more.
That said, only crazy people write large programs in shell languages… shells are optimized for running other programs and writing small scripts, not for writing large applications.
$
Starting a line $ symbol is a convention to show it’s a shell prompt, and it should not be typed. The actual command listed below as an example is echo $name.
$ echo $name
Lane
Create and use a variable
Create a Variable
Example:
name=”Lane”
Notice there are no spaces between the variable name, assignment operator = and value “Lane”.
Use a variable:
$ echo $name
Lane
Unlike in Python, where you can just use a variable’s name, in your shell you need to prefix the variable name with a $ to use it, else it would just print name instead of the value.
Note: Starting a line $ symbol is a convention to show it’s a shell prompt, and it should not be typed. The actual command listed below as an example is echo $name.
Variable interpolation
Variable interpolation is a common technique used in programming to build dynamic strings that contain values that may change over time. (f strings are an example of variable interpolation in python.)
It involves evaluating a string that contains placeholders and replacing the placeholders with their corresponding values. The placeholders are usually represented by a symbol or a keyword, and the values are usually variables or expressions that have been defined previously in the code.
$ echo Hello $name
Hello Lane
Note: Starting a line $ symbol is a convention to show it’s a shell prompt, and it should not be typed.
Distros of Linux (name a few)
Linux distributions (distros) are different versions of the Linux operating system.
(Linux (icon: penguin))
command prompt (the built-in windows command prompt; viewed as terrible by some–those people recommend using ubuntu instead). icon: windows.
ubuntu (icon: white circle on orange background)
RHEL (icon: guy in a red hat) (pronunce rell rhymes with bell)
Raspberry Pi OS (previously called Raspbian): (raspberry logo).
Top print out the history of commands you’ve typed in your shell, you can use the __ command
history
Example:
$department=”engineering”
$team=”opps”
echo I work in $department on $team
I
work
in
engineering
on
opps
Id CommandLine
– ———–
1 $department=”engineering”
2 $team=”opps”
3 echo I work in $department on $team
Up & down arrow keys
You can use the up and down arrows to quickly cycle through your command history.
clear command
ctrl+l
This will clear your terminal
Note: This won’t delete your history; it’ll just clear the screen.
Terminal Alternatives
Editor/IDE Built-In Terminals
Most text editors for developers have a built-in terminal.
For example, VS Code, Zed, and Cursor are popular text editors that also have a built-in terminal. While I do use Zed’s terminal for most of my coding work, in this course, I do not recommend using a built-in terminal because we don’t need the extra text editor features.
Ghostty
Ghostty is a very new terminal emulator that differentiates itself by being fast, feature-rich, and native. It’s a great option if you love to customize, and want a modern, fast, and feature-rich terminal.
Alacritty
Alacritty is another popular terminal emulator that is known for its speed and extensibility. Before Ghostty, Alacritty was the go-to terminal for many developers who wanted a fast and customizable terminal.
Windows Terminal
Windows Terminal is the terminal emulator for Windows. Use the “cmd.exe” program settings to change the default terminal. Be sure to start WSL whenever you open a new terminal window.
Terminal Emulators
Windows Terminal, Ghostty, and Alacritty are all terminal emulators — programs whose whole job is to show you a terminal window and let you run shells/commands inside it.
Linux Operating System
Ubuntu is a Linux operating system (distribution). It includes terminals (like GNOME Terminal), but Ubuntu itself is not a terminal program.
So you can run terminal emulators inside Ubuntu, but Ubuntu is the OS, not the emulator.
Directories & Files
Also known as “folders” on windows are containers that hold files and other directories
Files are just a dump of raw binary data (i.e., the 1s and 0s). The bytes in a file can represent anything: text, images, videos, etc.
The filesystem tree starts with a single directory called the ____
root directory
The root directory contains files and directories, which can contain more files and directories, and so on.
When you open your terminal, your working directory (i.e., the one you’re in) is going to be somewhere…most commonly it’s your home directory (e.g., /home/kasey)
pwd
print working directory
This command will show you the filepath of your current working directory (i.e., the one you’re in).
Linux/Windows WSL
/home/wagslane
The first slash (/) represents the root directory. It’s the tippy-top of the filesystem tree.
The next part (home) is the name of a directory inside the root directory.
Finally, the last part (wagslane) is the name of a directory inside the home directory.
So this path represents a directory 2 levels down from the root directory:
root
└── home
└── wagslane
macOS
/Users/wagslane
The first slash (/) represents the root directory. It’s the tippy-top of the filesystem tree.
The next part (Users) is the name of a directory inside the root directory.
Finally, the last part (wagslane) is the name of a directory inside the Users directory.
So this path represents a directory 2 levels down from the root directory:
root
└── Users
└── wagslane
filepath
A filepath is a string that describes the location of a file or directory on your computer.
ls
list command
It will show you the contents of your current working directory
cd
cd: change directory command
Example: If you do
cd worldbanc
It will move into the worldbanc directory