Link Search Menu Expand Document

Command Line Interface

Table of contents

  1. Description
  2. CLI Access
  3. File System Navigation
  4. Python Interpreter

Description

The command line interface (CLI) allows users to interact with the computer’s operating system and files using text and written commands. A graphical user interface (GUI) can serve the same purpose, but uses point-and-click graphics instead of text-based commands.

CLI Access

  • Windows: Press <win> <r>, then type “cmd” in the text box.
  • Mac: Press <cmd> <space>, then type “terminal” in the text box.

File System Navigation

  • ls: lists all files and subfolders in the current directory (In Windows, the command is dir).
  • cd directory_name: Changes the current directory to the indicated directory name.
  • cd .. : Changes the working directory to the parent directory.
  • pwd: Displays the current directory path.
  • cat filename: Displays the contents of the given filename.

Python Interpreter

You can open the Python Interpreter directly from the command line, and enter any Python commands. You must have Python installed on your system to access it from the CLI.

  • To open the interpreter: type “python3
  • To close the interpreter: type “quit()

Note: The Python version preinstalled on Mac OSX is Python2, which is very different from Python3. Install Python 3 on your system before using the command-line interpreter.