Ubuntu Terminal Basics
Introduction
The terminal is one of the most powerful tools in Ubuntu, providing direct access to the underlying system through a text-based interface. While graphical interfaces make many tasks accessible, mastering the terminal unlocks greater efficiency, automation capabilities, and deeper control over your Ubuntu system.
In this guide, we'll explore the fundamental terminal commands and concepts that every Ubuntu user should know. Whether you're completely new to Linux or looking to strengthen your foundation, these basics will set you on the path to terminal proficiency.
What is the Terminal?
The terminal (also called the command line or shell) is a text-based interface where you type commands to interact with your computer. In Ubuntu, the default terminal application runs a shell program called Bash (Bourne Again SHell), though other shells like Zsh or Fish are also available.
Opening the Terminal
There are several ways to open a terminal in Ubuntu:
- Press
Ctrl + Alt + T
(keyboard shortcut) - Search for "Terminal" in the applications menu
- Right-click on the desktop and select "Open Terminal" (if this option is enabled)
Understanding the Terminal Prompt
When you open the terminal, you'll see a prompt that typically looks like this:
username@hostname:~$
This prompt tells you:
- Your username
- The hostname of your computer
- Your current directory (
~
represents your home directory) - The
$
symbol indicates you're logged in as a regular user (a#
would indicate root user)
Basic Navigation Commands
1. pwd
- Print Working Directory
Shows your current location in the file system.
$ pwd
/home/username
2. ls
- List Files and Directories
Displays the contents of the current directory.
$ ls
Documents Downloads Music Pictures Videos
Common options:
ls -l
- Long format showing permissions, size, etc.ls -a
- Shows all files including hidden ones (starting with .)ls -h
- Human-readable file sizes
$ ls -la
total 112
drwxr-xr-x 16 username username 4096 Mar 10 14:22 .
drwxr-xr-x 3 root root 4096 Jan 15 10:45 ..
-rw------- 1 username username 9320 Mar 10 14:20 .bash_history
drwxr-xr-x 2 username username 4096 Mar 8 09:12 Documents
drwxr-xr-x 3 username username 4096 Mar 9 17:45 Downloads
3. cd
- Change Directory
Navigates between directories.
$ cd Documents
$ pwd
/home/username/Documents
Special directory references:
cd ~
- Go to your home directorycd ..
- Go up one directory levelcd -
- Go to previous directory