0.1 Commands
Hello
Zen and the art of Coding
Please email hello@zenandtheartofcoding.info for a password

Commands 🫡

  • theres only a few important ones that you will use all the time. with ALL things with coding, you can always just google what you need. here is a cheat sheet (opens in a new tab) that I found. also, most times frameworks and tools have lines you can just copy and paste

pwd - print working directory

  • ok so full disclosure, I thought this stood for Present Working Directory until I just looked it up. Printing is you telling a computer to display something in the terminal, but thinking of it as Present Working Directory still totally works because pwd shows you where you are in your computer. It displays your current path

ls - list

  • ls is shorthand for list. my dumb brain uses the mnemonic list shit 🙃
  • this is how you see the files in the folder that you are currently in
  • bonus: use the flag -a to see everything in the folder including hidden files like this: ls -a. #hacker 😎

cd - change directory

  • honestly, this is #1. this is the main way to navigate your computer and the most relevant command for coding
  • a directory is just a folder and navigating your computer is really just moving from folder to folder. the Mac Finder and Windows Explorer are really just GUIs for the cd command
  • to use most coding tools, you need to cd into the correct folder and then you usually copy and paste whatever you need

navigating with cd

  • to use cd, you type cd, space and then type the next folder you want to go to. so, if you want to pop into your Downloads folder, you type cd Downloads 🤯
  • pro tip hit ls first, see what's in the folder, type the first letter or two of where you are going and then hit tab to autocomplete. hit pwd to see make sure you are in the right folder and then ls to see all the shit in there 😎
  • to go back (or up a level) you use two dots followed by an optional slash like this: cd ../
    • think of the two dots as a back button click. one of the cool things about using the terminal is you can keep going and do stuff like use two at a time, that is when you need the slash to separate them. go back twice like this: cd ../../
  • another cool command to know is cd ~
    • that will always take you home if you get lost and can be a shortcut if you are super deep somewhere and don't want to count how many levels up you need to go ala cd ../../../../../

personal note: tbh this is definitely enough to get started. the truth is you can/will use the terminal with the finder but here are some more cool terminal commands I like:

open . - open current directory

  • the . is shorthand for here or current working directory
  • this just opens the finder to whatever folder you navigated to in the terminal

mkdir - make directory

  • this is cool for making folders fast
  • use it by typing the title of your new folder after mkdir like this: mkdir My New Folder

touch - create a file

  • tbh I don't have a mnemonic for this one
  • you use it the same as mkdir by adding the name of your file after touch like this: touch index.html

  • theres obviously a ton more but these are the ones I use every day. theres of course commands to delete files and directories like rmdir for remove directory but I don't use those because some of those actions are permanent (because you are not using the trash) so thats when I still right click delete in the finder or in the code editor.