Skip to content

Terminal Commands

There are several terminal shells, some of which will be installed by default with your operating system. The Windows 11 terminal offers several built-in shells for you to choose from, where the default is PowerShell.

Windows Terminal Shells

Here are some command-line tools for PowerShell/Command Prompt to help you navigate the file/folder structure.

  • cd - Change Directory
  • dir - List the contents of the current directory/folder
  • mkdir - Create (or make) a new folder
  • clear or cls - Clear the terminal screen
  • exit - Exit the terminal

Installed CLIs

Command-Line Interfaces are programs created for use in terminal environments. Most modern CLIs tend to implement the following two flags.

  • --version - Display information on the installed version of the application.
  • --help - Display information on how to use the application from within the terminal.

Here are primary tools that you will typically need/use in your development. (See System Setup for information on installing these tools.)

git

We can use the git version control application directly from the command line. Here are some useful commands to get started.

  • git --help - This command will give you a list of all of the available git commands. --help is a special flag that can be used with many command line applications to get more information about how to use them. It can also be used with git commands to get more information about a specific command. For example, git add --help will give you more information about how to use the git add command.
  • git init - This command will create a git repository in the current folder
  • git status - This will give you the current status of your git repository
  • git add . - Use this command to “stage” all of your current changes so that they are ready to be committed.
  • git commit -m "Your Message" - This command will take all of the staged changes and create a snapshot of the current state of your repository. Using commits is how we generate a commit history for our repository.
  • git pull - Use this command to grab any changes from your remote repository (e.g.: GitHub.com) and pull them down onto your local repository (the one on your computer).
  • git push - This command will take whatever commits you have on your computer and push them to the remote repository on GitHub.com.

There are a lot of things to learn when it comes to working with git, but these commands are the day-to-day ones that you will do as you work with version control.

Here’s some other helpful commands with regard to the remote repository connections for your local repository.

  • git remote -v - View all the remote repositories
  • git remote remove [remoteName] - Remove a remote entry
  • git remote add [remoteName] [URL-to-Repository] - Add a remote repository

GitHub CLI

You can use the GitHub CLI (gh) to interact with the remote GitHub.com repository associated with the current repository. Here are some common ones I use.

  • gh browse - Open the repository on GitHub in your browser
  • gh issue list - List the open issues
  • gh issue create - Create a new GitHub issue
  • gh issue view [num] - View the details of the issue indicated by [num] (e.g.: gh issue view 7)
  • gh issue edit [num] - Similar to the view subcommand, but allowing you to edit some aspect of an existing issue

pnpm and npm

The subcommands are mostly the same for pnpm and npm. Here are some of the most commonly used.

  • pnpm init - Create a new Node-based project
  • pnpm add [package] or pnpm install [package] - Add a third-party package to the project (e.g.: pnpm add @picocss/pico)
  • pnpm add -D [package] - Add a package as a Developer resource (not to be included in the final project output) (e.g.: pnpm add -D vite)
  • pnpm [script] - Run a script identified in the package.json (e.g.: pnpm test or pnpm dev)

VS Code

Visual Studio Code comes with a CLI named code. Here are some commonly used commands.

  • code [path] - If [path] is a file, it will open the file in the current/active VS Code instance. If [path] is a folder, it will open the folder in a new VS Code instance.
  • code -n [path] - Open the file or folder identified by [path] in a new instance of VS Code.
  • code -r [path] - Reload the active instance of VS Code for the file/folder specified by [path]. Typically, you will want to run this within the terminal of VS Code to reload that instance.