How to Use the Terminal - Linux Command Line Basics
"A black screen with white text all over it, and I have no idea what's going on..." Are you avoiding the terminal like this? In this article, through a dialogue between Linny-senpai and Lina, let's learn the basics of terminal operations together.
What you will learn
- What the terminal is and why engineers use it over the mouse
- How to read the prompt and use the three core commands:
pwd,ls, andcd - How to handle common errors and use shortcuts like Tab completion and
Ctrl + C
1. Introduction: What is a Terminal?
Conclusion: The terminal lets you control your computer with text — faster and more precise.
What is a Terminal?
A terminal is an application for sending commands to your computer using text. Instead of clicking with a mouse, you operate by typing commands (instructions) on your keyboard.
Benefits of Using Terminal
- Fast: Faster than mouse operations once you're used to it
- Automatable: Can repeat the same tasks automatically
- Precise: Can specify detailed settings exactly
- Essential for servers: Many servers don't have a GUI
2. Understanding the Prompt
Conclusion: The prompt shows user@host:directory; ~ means home and . means current location.
user@computer:~$ displayed on the screen. What is that?Prompt Structure
yamada@penguin-gym:~/Documents$
| Part | Meaning |
|---|---|
yamada |
Username (who's currently logged in) |
@ |
Separator |
penguin-gym |
Computer name (hostname) |
: |
Separator |
~/Documents |
Current location (directory) |
$ |
Regular user indicator (# for root) |
~ mean?~ represents your home directory. The home directory is like your "personal room" for each user, which means /home/username.Special Symbols to Remember
| Symbol | Meaning |
|---|---|
~ |
Home directory |
. |
Current directory |
.. |
Parent directory (one level up) |
/ |
Root directory (top level) |
3. Your First 3 Commands
Conclusion: pwd, ls, and cd check location, list files, and move — the three core commands.
pwd, ls, and cd. With these three, you can find out "where you are," "what's here," and "where to go."pwd - Check Where You Are
pwd stands for "Print Working Directory" and displays the directory you're currently in.$ pwd /home/yamada
/home/yamada right now!pwd and you'll immediately know where you are.ls - List Files
ls stands for "list" and displays the files and folders in your current location.$ ls Documents Downloads Pictures file.txt
Documents, Downloads, and Pictures are folders (directories), and file.txt is a file. Add the -l option to see more details.$ ls -l drwxr-xr-x 2 yamada yamada 4096 Jan 24 10:00 Documents drwxr-xr-x 2 yamada yamada 4096 Jan 24 10:00 Downloads drwxr-xr-x 2 yamada yamada 4096 Jan 24 10:00 Pictures -rw-r--r-- 1 yamada yamada 52 Jan 24 10:00 file.txt
cd - Change Directory
cd stands for "change directory" and moves you to a different directory.$ cd Documents $ pwd /home/yamada/Documents
cd Documents got me into the Documents folder!cd ... To return to your home directory, use cd ~ or just cd.$ cd .. # Go up one level $ cd ~ # Return to home $ cd # Return to home (short form)
4. Useful Shortcuts
Conclusion: Tab completes names; arrows browse history; Ctrl+C stops any stuck command.
Tab Completion (Super Important)
$ cd Doc[Tab] # Completes to: cd Documents/
Commonly Used Shortcuts
| Shortcut | Function |
|---|---|
Tab |
Auto-completion |
Up Arrow / Down Arrow |
Browse command history |
Ctrl + C |
Cancel running command |
Ctrl + A |
Move to beginning of line |
Ctrl + E |
Move to end of line |
Ctrl + U |
Delete from cursor to beginning of line |
Ctrl + L |
Clear screen (same as clear) |
Ctrl + C?Ctrl + C.5. Common Errors and Solutions
Conclusion: No such file or directory: check spelling and run pwd to verify your location.
cd Documents and got "No such file or directory"...Error 1: No such file or directory
$ cd Documents bash: cd: Documents: No such file or directory
Causes and Solutions
- Typo: Case matters.
documentsandDocumentsare different - Doesn't exist: First check with
lsto confirm it exists - Wrong location: Check where you are with
pwd
Error 2: command not found
$ lss bash: lss: command not found
ls, not lss.Error 3: Permission denied
$ cd /root bash: cd: /root: Permission denied
/root is an admin-only area, so regular users can't enter. We'll explain permissions in detail in another article.Troubleshooting Steps
- Check where you are with
pwd - Check contents with
ls - Verify command spelling (watch for case sensitivity)
- View help with
man command-name
Mini Exercises
Conclusion: Use mini exercises to practice pwd, ls, and cd and lock in the basic workflow.
Exercise 1: Check Your Location
Run pwd to check your current directory. Did you find out where you are?
Exercise 2: View File List
Run ls to see the files and folders in your current location. Then try ls -l for detailed view.
Exercise 3: Move Between Directories
Use cd to move to an existing directory, then verify with pwd. After that, return with cd ...
ls before using cd, I can prevent errors.Review
Conclusion: pwd, ls, cd, Tab, and Ctrl+C: these five basics are the terminal foundation.
pwd for current location, ls for contents, and cd for moving!Ctrl + C to cancel, and Tab for completion. With these basics down, you can keep learning more commands.3-Line Summary
Conclusion: pwd, ls, and cd in a 3-line recap — lock in the basics before moving on.
pwdfor location,lsfor contents,cdfor moving - these 3 are the basics- When in trouble:
Ctrl + Cto cancel,Tabfor auto-completion - When errors occur, start by checking with
pwdandls