Terminal Trauma
Look, the terminal can feel a little... intimidating. Everything's black and white, no buttons to click, no icons to drag. And things have gotten pretty button-y and drag-y these days. Most of the time, you can do everything with two or three clicks. It's awesome.
However, there are some things—like what we're doing today—that are much easier (and faster!) in the terminal. Once you get the hang of it, you'll find it's not as scary as it seems. We promise.
Common Commands
Here's a quick rundown of the commands we'll be using throughout the workshop. We've grouped them by category for easy reference!
Git Commands
-
git clone
: Create a copy of a remote repository on your local computer. -
git add
: Stage changes to be committed. -
git commit
: Save staged changes to the repository's history. -
git push
: Send your local changes to the remote repository. -
git sparse-checkout
: Allows you to download only specific parts of a repository after a sparse clone.
Navigation Commands
-
pwd
: Print the current working directory. -
cd
: Change the current directory. -
ls
: List the files and directories in the current folder. -
ls -l
: List files with details.
Commands for Files and Folders
-
touch
: Create a new, empty file.touch index.html
-
mkdir
: Create a new folder (directory).mkdir myfolder
-
rm
: Remove a file.rm style.css
-
rm -r
: Remove a folder and its contents recursively.rm -r myfolder
-
cat
: Reads and outputs the contents of a file. In this workshop, we use it to display the contents of your public key file so you can copy it and add it to GitHub.cat ~/.ssh/id_ed25519.pub
Flags
Flags are like modifiers for terminal commands. They add extra functionality or tweak how a command behaves. Think of them as the sprinkles on your ice cream—totally optional, but they make everything better.
Flags usually come after the main command and are preceded by a dash (`-`). Some flags have a single dash (e.g., `-r`), while others have double dashes (e.g., `--help`). Here's an example:
ls -l
This command lists files in long format, showing extra details like permissions and file sizes. Below are the other flags we'll use
-
--sparse
: Clone only specific parts of a repository. This is only a flag forgit
commands. -
-r
: Recursive—used to perform actions on directories and their contents. -
-t
: This flag specifies the type of key to create. In this workshop, we useed25519
, a modern and secure key type. -
-C
: This flag allows you to add a comment to your SSH key, often used to identify it. In this case, we use your GitHub email address as the comment.
Understanding ssh-keygen
The ssh-keygen
command generates a
new SSH key pair. This command creates both a public key (which you
share with GitHub) and a private key (which stays secure on your
computer). You'll encounter this command when setting up SSH for
secure authentication.