Terminal Basics

Use the terminal to run development tools by typing commands. Codespaces, macOS, Linux, and WSL normally use a Bash-compatible shell. Native Windows development normally uses PowerShell.

Open VS Code's terminal with Terminal > New Terminal. It starts in the folder open in VS Code.

GoalBash and PowerShell
Show the current folderpwd
List filesls
Enter a foldercd FOLDER_NAME
Go up one foldercd ..
Refer to the current folder.
Clear the terminalclear in Bash; Clear-Host in PowerShell

Put quotation marks around a path containing spaces:

cd "folder with spaces"

It is easier to avoid spaces when naming programming projects.

Useful terminal features

  • Press Tab to complete a partially typed file or command.
  • Press Up Arrow and Down Arrow to reuse earlier commands.
  • Press Ctrl+C to interrupt a program that is running in the terminal.
  • Use code . to open the current folder in VS Code when the code command is available.

Platform differences

Bash runs a program in the current folder with ./program.exe. PowerShell uses .\program.exe. Paths in Bash use /; native Windows paths normally use \ and a drive letter such as C:.

Once you can navigate to a project folder, use Compile and Run to build a program. Use Input Redirection to send a file to a program.