DEV Community

Cover image for Introduction to Linux Commands for New Users
Anthony
Anthony

Posted on

Introduction to Linux Commands for New Users

Linux is a powerful operating system favored by developers, system administrators, and enthusiasts for its flexibility and control. If you're new to Linux, its command-line interface (CLI) might seem intimidating at first. However, learning a few essential commands can unlock a world of possibilities and make your Linux journey much smoother.

This guide introduces some of the most basic Linux commands to help you get started.


Why Use the Command Line?

The Linux command line allows users to interact directly with the operating system. It is:

  • Efficient: Execute tasks quickly.

  • Powerful: Perform complex operations not always available in graphical interfaces

  • Customizable: Tailor workflows to specific needs using scripts and commands.


Getting Started: Opening the Terminal

-Keyboard Shortcut: Press Ctrl + Alt + T or Alt + T (I use Parrot os).

  • Desktop Menu Section: Look for "Terminal" in the application menu.

Once the terminal is open, you're ready to start!


Essential Linux Commands

1. Navigating the File System

The Linux file system is hierarchical, resembling an inverted tree.

  • pwd (Print Working Directory)
    Displays your current directory.
    pwd

  • ls (List)
    Lists the contents of a directory.
    ls
    Add options like -l for detailed view or -a to show hidden files:
    ls -la

  • cd (Change Directory)
    Moves between directories(folder2 becomes the current directory) .
    cd /Desktop/folder1/folder2


2. File and Directory Management

  • mkdir (Make Directory)
    Creates a new directory.
    mkdir new_folder

  • touch (Create File)
    Creates an empty file.
    touch newfile.txt

  • rm (Remove)
    Deletes files or directories.
    rm file.txt
    rm -r folder_name # Deletes a directory

  • cp (Copy)
    Copies files or directories.
    cp file.txt /destination/path/

  • mv (Move)
    Moves or renames files.
    mv oldfile.txt newfile.txt


3. Viewing and Editing Files

  • cat (Concatenate)
    Displays the content of a file.
    cat file.txt

  • nano/pluma (Editor)
    Opens files in a text editor.
    nano file.txt
    Use Ctrl + O to save and Ctrl + X to exit.


4. System Information

  • uname
    Shows system information.
    uname -a

  • df -h
    Displays available disk space.
    df -h

  • top
    Monitors running processes.
    top
    Press q to exit.


5. Getting Help

  • man (Manual)
    Displays the manual for a command.
    man ls

  • --help
    Provides a brief overview of a command.
    ls --help


Tips for New Users

  • Practice Regularly: Familiarity comes with use.

  • Use Tab Completion: Type part of a command or file name and press Tab to auto-complete.

  • Experiment Safely: Use a virtual machine or a separate environment to try new commands.


Conclusion

Mastering the Linux command line may seem daunting at first, but starting with these foundational commands sets you on the right path. As you grow more comfortable, you'll discover the full potential of Linux and its tools.

Happy learning!

Top comments (0)