Master the Linux Terminal: 8 Essential Commands and Prompt Basics
This guide introduces the Linux terminal as a productivity tool, explains the shell and prompt components, and walks through eight core file‑management commands (pwd, ls, cd, mkdir, touch, cp, mv, rm) plus essential shortcuts like Tab completion, command history, and interrupt keys.
1. What Is a Shell?
The black window you see is a Terminal (terminal emulator) , and the program that runs inside it is the Shell . The shell receives your commands, translates them for the operating system kernel, and returns the results.
Bash (Bourne Again SHell) : the default shell on Ubuntu, widely used.
Zsh : a more feature‑rich shell popular among developers (installation covered in later tutorials).
2. Opening the Terminal
Shortcut: Ctrl + Alt + T (keep this shortcut handy).
Or search for "Terminal" in the Activities menu.
3. Understanding the Prompt
After opening the terminal you will see a line such as:
user@hostname:~$ user: the current logged‑in username. hostname: the computer’s host name. ~: the current directory, representing the home directory /home/user. $: indicates a regular user; # would indicate the super‑user (root), which should be used with caution.
4. Core Navigation Commands
In the terminal you navigate with commands instead of a mouse. First, understand two path concepts:
Absolute path : starts from /, e.g., /home/user/Downloads.
Relative path : starts from the current directory, e.g., Downloads or ../Documents.
pwd (Print Working Directory)
Shows the full path of the current directory.
pwd
# Output: /home/userls (List)
Lists files and folders in the current directory.
ls
ls -l # detailed info (permissions, size, time)
ls -a # show hidden files (those starting with .)cd (Change Directory)
Changes the current directory.
cd Downloads # enter Downloads
cd .. # go up one level
cd ~ # return to home directory
cd / # go to the root directorymkdir (Make Directory)
Creates a new folder.
mkdir Projectstouch
Creates an empty file.
touch readme.txtcp (Copy)
Copies files or directories.
cp file.txt file_backup.txt
cp -r folder1 folder2 # -r for recursive copy of a directorymv (Move)
Moves or renames files.
mv file.txt Documents/ # move
mv oldname.txt newname.txt # renamerm (Remove)
Deletes files. Note that Linux terminal deletions bypass the recycle bin.
rm file.txt
rm -rf foldername # force delete a folder and its contents (use with care)5. Practical Tips
Tab completion : type part of a command or path (e.g., cd Do) and press Tab to auto‑complete (e.g., cd Downloads/).
Arrow keys : press up/down to scroll through command history, avoiding re‑typing.
Ctrl + C : abort a running program that is stuck.
Ctrl + L or clear: clear the screen.
Check help before executing : use command --help or man command (e.g., man ls).
Quote paths with spaces : wrap them in quotes, e.g., cd "My Files", otherwise the shell splits the path.
Practice these commands repeatedly; you’ll find typing on the keyboard far faster than navigating with a mouse.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ubuntu
Focused on Ubuntu/Linux tech sharing, offering the latest news, practical tools, beginner tutorials, and problem solutions. Connecting open-source enthusiasts to build a Linux learning community. Join our QQ group or channel for discussion!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
