0
0
Iot-protocolsHow-ToBeginner · 3 min read

How to Use Terminal on Raspberry Pi: Basic Commands and Tips

To use the terminal on Raspberry Pi, open the Terminal app from the desktop or connect via SSH. You type commands like ls to list files or sudo to run commands as an administrator. The terminal lets you control your Raspberry Pi by typing simple text commands.
📐

Syntax

The basic syntax for terminal commands on Raspberry Pi is:

  • command [options] [arguments]

Here, command is the program you want to run, options modify how the command works (usually start with a dash -), and arguments are the targets like files or directories.

bash
ls -l /home/pi
💻

Example

This example shows how to list files in your home directory with details:

bash
ls -l /home/pi
Output
total 12 -rw-r--r-- 1 pi pi 220 Apr 10 2023 .bash_logout -rw-r--r-- 1 pi pi 3771 Apr 10 2023 .bashrc -rw-r--r-- 1 pi pi 807 Apr 10 2023 .profile
⚠️

Common Pitfalls

Common mistakes when using the terminal on Raspberry Pi include:

  • Typing commands with wrong spelling or case (commands are case-sensitive).
  • Forgetting to use sudo when a command needs administrator rights.
  • Running commands without understanding what they do, which can cause errors or damage.

Always double-check commands before pressing Enter.

bash
wrong: Ls -l
right: ls -l
Output
bash: Ls: command not found
📊

Quick Reference

CommandDescription
lsList files and folders
cdChange directory
pwdShow current directory path
mkdirCreate a new directory
rmRemove files or directories
sudoRun command as administrator
nanoOpen text editor
exitClose the terminal session

Key Takeaways

Open the Terminal app or connect via SSH to start using the Raspberry Pi terminal.
Use the syntax: command followed by options and arguments to control your Pi.
Commands are case-sensitive; type carefully and use sudo when needed.
Common commands include ls, cd, mkdir, and nano for basic file and system tasks.
Always verify commands before running to avoid mistakes or damage.