Skip to content

Command Line Basics

To understand how to interact with the command line – and see a good example of how it works in practice – I recommend watching How to write Python in Visual Studio Code and run it in Terminal. It's only fifteen minutes long, and you can probably skip to halfway through for the command line parts.

Being lazy

Instead of typing out a long file/directory name, type the first few letters and then press tab. It will automatically fill in the rest of the filename. Use this every time you’re typing anything on the command line.

Press and to scroll through previous commands. It can save you a lot of typing.

On a mac, you can drag a file or folder from Finder onto the Terminal and it will automatically type the full path

The only commands you need

You can get pretty far with just a handful of commands:

  • cd to move around
  • pwd to know where you're at
  • ls to list the files in your current directory
  • cat to display the complete contents of a file
  • grep to search through files.

I explain a lot more elsewhere in this section.