Transitioning from a visual operating system like Windows or MacOS to Linux can feel intimidating, but the true power of Linux lies in its Command Line Interface (CLI). Mastering a few essential terminal commands allows you to navigate your system faster, manage files more efficiently, and perform administrative tasks that are often hidden in a standard graphical interface.
1. Navigating the File System
Before you can manage files, you need to know how to move around. The terminal doesn't have a 'Back' button, so you must use these fundamental navigation commands:
- pwd (Print Working Directory): Displays the exact path of the folder you are currently in. This is your 'You Are Here' marker.
- ls (List): Shows all files and folders in your current directory. Adding ls -lh will show file sizes in a readable format.
- cd (Change Directory): The primary way to move between folders. For example, cd Documents moves you forward, while cd .. moves you back up to the parent folder.
2. Creating and Managing Files and Folders
In Linux, you can create, move, and delete files much faster using the terminal than by right-clicking in a file manager:
- mkdir [folder name]: Creates a new directory (folder) instantly.
- touch [file name]: Creates a new, empty file (e.g., touch script.py).
- cp [source] [destination]: Copies a file. To copy an entire folder, you must use cp -r (recursive).
- mv [source] [destination]: Moves a file to a new location. This command is also used to rename files.
- rm [file name]: Deletes a file. Warning: Files deleted via terminal do not go to the Trash; they are gone permanently.
3. Gaining Administrative Power with Sudo
Most system-level changes in Linux require 'Root' privileges. The sudo command (SuperUser DO) allows you to run commands with administrative security permissions. When you type sudo before a command, the system will ask for your password to ensure you have the authority to make significant changes, such as installing software or modifying system configurations.
4. Installing and Updating Software
Most Linux distributions (like Ubuntu, Mint, or Debian) use a package manager called APT. This is the 'App Store' of the terminal. Use these commands to keep your system healthy:
- sudo apt update: Checks for the latest versions of your installed software.
- sudo apt upgrade: Downloads and installs all available updates.
- sudo apt install [package name]: Installs a specific piece of software (e.g., sudo apt install git).
5. Monitoring System Performance
If your computer is running slow, you can use the terminal to see exactly which process is hogging your resources:
- top: Opens a live, updating list of all active processes, sorted by CPU usage.
- free -m: Quickly shows how much RAM (Memory) is being used and how much is currently free.
- df -h: Shows your disk space usage in a 'human-readable' format so you know which drive is getting full.
By mastering these essential Linux terminal commands, you move from being a casual user to a power user, gaining full control over your operating system's performance and structure.
💡 Pro Tip: Keep your software updated to avoid these issues in the future.
Category: #OS