Please enable JavaScript to use CodeHS

Terminal & Bash

Bash Basics

Try common Bash commands in a mini terminal. Type commands like ls, pwd, cd, echo, mkdir, cat, and clear to see how the command line works.

Bash ~10 min High school / college prep
The Big Idea

What is Bash?

Bash is a command language. When you type commands into a terminal, a program like Bash reads them and tells the computer what to do.

Developers use Bash to navigate folders, create files, run programs, and automate tasks. Learning a few commands is the first step toward feeling comfortable on the command line.


Interactive

Try it: Mini Bash Terminal

Type a command and press Enter or click Run. The terminal starts in /home/student. Try pwd, ls, cd images, echo hello, and help.

Welcome to the mini Bash terminal. Type 'help' to see available commands.
student@codehs:~$

How It Works

Common Bash commands

  • pwd prints the current directory.
  • ls lists the files and folders in the current directory.
  • cd folder changes into a folder; cd .. goes up one level.
  • echo prints text to the screen.
  • cat file shows the contents of a file.
  • mkdir folder creates a new folder.
  • clear clears the terminal screen.

Check Yourself

Quick quiz

1. Which command shows the current directory?

2. Which command lists files?

3. Which command prints text?


Keep exploring

Explore more terminal and command-line tutorials.

Part of the Terminal & Bash tutorial series.