Terminal vs Shell
Understanding the distinction will help you navigate Linux more effectively.
Terminal
The terminal is the program that provides a window or interface where you can interact with the shell. In the past, this referred to physical terminals (keyboards and screens connected to mainframes). Today, it usually means a terminal emulator, a software application that mimics those terminals inside a desktop environment.
Examples of terminal emulators:
- GNOME Terminal (GNOME desktop)
- Konsole (KDE Plasma)
- xterm (lightweight classic emulator)
- Alacritty, Terminator, Tilix (modern alternatives)
In short: The terminal displays what you type and what the shell returns.
Shell
The shell is the actual command interpreter that takes the text you type and executes it. It is a program running inside the terminal.
Popular Linux shells include:
- Bash (Bourne Again SHell, the most common)
- Zsh (extended features, customization, used in macOS by default now)
- Fish (user-friendly, with auto-suggestions)
- Dash, Ksh, Tcsh (used in specific systems or for scripting)
The shell is what understands commands like ls, cd, pwd, and runs them.
How They Work Together
- The terminal is the “container” (the screen/program).
- The shell is the “engine” (the interpreter that runs your commands).
Example: When you open GNOME Terminal and type ls:
- The terminal captures your keystrokes.
- The shell (e.g., Bash) interprets
ls. - The shell executes the command and sends output back.
- The terminal displays the result on screen.
In summary:
- Terminal = interface (window/emulator)
- Shell = interpreter (command processor)
Navigating the Filesystem (pwd, ls, cd)
One of the most important skills in Linux is learning how to move around the filesystem using the command line. Unlike a graphical file manager (where you click folders), the Linux shell uses commands to display where you are, list files, and change directories.
`pwd` – Print Working Directory
The pwd command shows your current location in the filesystem.
- Example:
- Meaning: You are currently inside the Documents directory of user _amr_.
$ pwd /home/amr/Documents
`ls` – List Files and Directories
The ls command lists the contents of the current directory.
- Basic usage:
- Useful options:
ls -l→ detailed list (permissions, owner, size, date).ls -a→ shows hidden files (those starting with.).ls -lh→ human-readable sizes.
$ ls file1.txt file2.png project/
`cd` – Change Directory
The cd command lets you move into another directory.
- Examples:
$ cd Documents # go into Documents
$ cd .. # go up one level (parent directory)
$ cd /etc # go to /etc folder (absolute path)
$ cd ~ # go to your home directory
$ cd - # go back to previous directory
Putting It All Together
A typical workflow when navigating might look like this:
$ pwd
/home/amr
$ ls
Documents Downloads Pictures
$ cd Documents
$ pwd
/home/amr/Documents
$ ls -l
-rw-r--r-- 1 amr amr 1200 Sep 25 notes.txt
drwxr-xr-x 2 amr amr 4096 Sep 25 projects
Here, you:
- Checked where you are with
pwd. - Listed the files in your home directory with
ls. - Entered the Documents folder with
cd Documents. - Confirmed your new location with
pwd. - Listed detailed contents with
ls -l.
Mastering these three commands — pwd, ls, cd — gives you the foundation to explore any Linux system confidently.
File Operations (cp, mv, rm, cat, nano, vim)
After learning to navigate the Linux filesystem, the next step is working with files and directories. Linux provides powerful commands to create, copy, move, delete, and edit files.
`cp` – Copy Files and Directories
The cp command creates a duplicate of a file or directory.
- Copy a file:
- Copy a directory (with contents):
cp file.txt backup.txt
cp -r project/ project_backup/
`mv` – Move or Rename Files
The mv command moves files to another location or renames them.
- Rename a file:
- Move a file:
mv oldname.txt newname.txt
mv file.txt /home/amr/Documents/
`rm` – Remove Files and Directories
The rm command deletes files permanently (no recycle bin). Use with caution!
- Remove a file:
- Remove a directory and its contents:
rm file.txt
rm -r folder_name
Warning: Once removed, files cannot be easily recovered.
`cat` – View File Contents
The cat command displays the contents of a text file directly in the terminal.
- Example:
cat notes.txt
For long files, combine with less or more:
cat longfile.txt | less
Editing Files in Linux
`nano` – Simple Text Editor
Nano is a beginner-friendly text editor that works directly in the terminal.
- Open a file in nano:
- Save changes:
CTRL + O - Exit:
CTRL + X
nano notes.txt
`vim` – Advanced Text Editor
Vim is a powerful but complex editor. It has different modes (insert, command).
- Open a file in vim:
- Switch to insert mode: press
i - Write text, then press
ESCto return to command mode - Save and exit:
:wq - Quit without saving:
:q!
vim notes.txt
Summary
- cp → copy files
- mv → move/rename files
- rm → delete files
- cat → display file contents
- nano → simple editor
- vim → advanced editor
Getting Help (man, --help)
Linux comes with extensive built-in documentation and help options. Instead of memorizing every command, you can use the system itself to learn what a command does and how to use it.
`man` – The Manual Pages
The man command shows the manual page (documentation) for a command.
- Example:
man ls
This opens the manual for the ls command, explaining options like -l or -a.
- Navigation inside
man: - Use arrow keys or Page Up/Page Down to scroll.
- Press q to quit.
- Search for a word: type
/keywordand press Enter. - Manual pages are grouped into sections (commands, system calls, configuration files, etc.). For example:
man 5 passwd
Shows documentation about the passwd file format (section 5).
`--help` Option
Most commands also support the --help option, which gives a short description and lists available flags.
- Example:
- Useful when you need a quick reference without browsing the full manual.
ls --help
Displays all options for ls directly in the terminal.
Combining Both
- Use
--helpwhen you need quick syntax reminders. - Use
manwhen you want detailed explanations and examples.
🛠️ Extra Tools for Help
- whatis → one-line description of a command.
- apropos → search for commands related to a keyword.
whatis grep
apropos network
In summary: Linux has help built right in. man = detailed manuals, --help = quick options, and tools like whatis and apropos make discovery easier.