
Linux Fundamentals: Terminal Basics – Commands, Navigation, and File Management
Introduction
The terminal is one of the most powerful tools in Linux. It allows you to interact with your system directly using text commands, giving you full control over your operating system. Whether you’re a beginner or just need a refresher, this guide will walk you through the basics of the terminal, including essential commands, navigation, and file management.
1. What is the Terminal?
The terminal, also known as the command-line interface (CLI), is a text-based way to interact with your Linux system. Unlike graphical interfaces, the terminal lets you perform tasks quickly and efficiently using commands.
2. Opening the Terminal
To get started, you’ll need to open the terminal:
- Shortcut: Press
1Ctrl + Alt + T
- on most Linux distributions.
- Menu: Search for “Terminal” in your application menu.
3. Basic Terminal Commands
Here are the most essential commands every Linux user should know:
pwd – Print Working Directory
- What it does: Shows the current directory (folder) you’re in.
- Example:
1pwd
2# Output: /home/your-username
ls – List Files and Directories
- What it does: Lists the contents of the current directory.
- Example:
1ls
2# Output: Documents Downloads Pictures Videos
cd – Change Directory
- What it does: Moves you to a different directory.
- Example:
1cd Documents
2pwd
3
4# Output : /home/your-username/Documents
mkdir – Make Directory
- What it does: Creates a new directory.
- Example:
1mkdir Projects
2ls
3
4# Output : Documents Downloads Pictures Projects Videos
touch – Create a File
- What it does: Creates an empty file.
- Example:
1touch example.txt
2ls
3
4# Output : example.txt
4. Navigating the File System
Understanding how to move around the file system is crucial. Here’s how:
Moving Up and Down Directories
- Go to the parent directory:
1cd ..
- Go to your home directory:
1cd ~
- Go to the root directory:
1cd /
Using Absolute and Relative Paths
- Absolute Path: Starts from the root directory (/).
1cd /home/your-username/Documents
- Relative Path: Starts from your current directory.
1cd Documents/Projects
5. Managing Files and Directories
Now that you can navigate, let’s learn how to manage files and directories.
cp – Copy Files and Directories
- What it does: Copies a file or directory to a new location.
- Example:
1cp example.txt Documents/
mv – Move or Rename Files
- What it does: Moves a file to a new location or renames it.
- Example:
1mv example.txt newname.txt
rm – Remove Files and Directories
- What it does: Deletes a file or directory.
- Example:
1rm newname.txt
6. Tips for Using the Terminal
- Tab Completion: Press Tab to auto-complete file or directory names.
- Clear the Terminal: Type clear or press Ctrl + L to clear the terminal screen.
- Get Help: Use the man command to read the manual for any command. For example:
1man ls
Conclusion
Mastering the terminal is a fundamental skill for any Linux user. With these basic commands, you can navigate your file system, create and manage files, and perform tasks efficiently. Practice these commands regularly, and soon you’ll feel confident using the terminal for everyday tasks.