Transitioning from a graphical user interface (GUI) to the command line can be intimidating for new Linux users. However, the Linux Terminal (also known as the command line or shell) is the most powerful tool at your disposal. Mastering a few basic commands can significantly speed up your workflow and help you manage your system like a pro. This guide covers the essential commands every beginner needs to know.
Step 1: Opening the Terminal
To get started, you need to open your terminal emulator. On most Linux distributions (like Ubuntu, Fedora, or Linux Mint), you can use the keyboard shortcut Ctrl + Alt + T. Alternatively, you can search for "Terminal" in your application menu.
Step 2: Navigating the File System
Unlike a file manager where you click folders, in the terminal, you move using text commands. Here are the core navigation commands:
- pwd (Print Working Directory): Shows you exactly which folder you are currently in.
- ls (List): Displays all files and folders in your current directory. Use ls -la to see hidden files and detailed information.
- cd (Change Directory): Used to move between folders. For example, cd Documents moves you into the Documents folder, while cd .. moves you up one level.
Step 3: Managing Files and Directories
Creating, moving, and deleting files is much faster in the terminal once you know the syntax:
- mkdir (Make Directory): Creates a new folder. Example: mkdir MyProject.
- touch: Creates a new empty file. Example: touch notes.txt.
- cp (Copy): Copies a file or folder. Syntax: cp source_file destination.
- mv (Move): Used to move files or rename them. Syntax: mv old_name.txt new_name.txt.
- rm (Remove): Deletes a file. Warning: Terminal deletions are permanent and do not go to the Trash. Use rm -r to delete a folder and its contents.
Step 4: Using Superuser Privileges (Sudo)
Some commands require administrative permissions, such as installing software or modifying system files. In Linux, we use sudo (SuperUser Do) before a command to execute it with root privileges. When you type a command starting with sudo, you will be prompted for your user password. Note that no characters will appear while you type your password for security reasons—just type it and hit Enter.
Step 5: Installing and Updating Software
Most beginners use a package manager to handle software. On Debian-based systems (like Ubuntu), you will use the apt command:
- sudo apt update: Refreshes your package list to check for available updates.
- sudo apt upgrade: Installs the available updates for your software.
- sudo apt install [package_name]: Downloads and installs a specific program (e.g., sudo apt install vlc).
Step 6: Monitoring System Performance
If your system is running slowly, you can use the terminal to identify the cause:
- top: Displays a real-time list of running processes and how much CPU/RAM they are using. Press q to exit.
- df -h: Shows how much disk space is remaining on your partitions in a human-readable format.
- free -m: Displays the amount of free and used memory (RAM) in megabytes.
Pro Tip: Use the Tab key for auto-completion. If you start typing a file or folder name and press Tab, the terminal will fill in the rest for you, preventing typos and saving time!
💡 Pro Tip: Keep your software updated to avoid these issues in the future.
Category: #OS