DEV Community

Shivam Jain
Shivam Jain

Posted on

2 1 1 1 1

Learning Linux on the Go : CLI

As a beginner stepping into the world of Linux, the command-line interface (CLI) might seem like a daunting and mysterious realm. However, let me assure you that the CLI is not only a powerful tool but also remarkably fast and productive once you become acquainted with its capabilities. In this blog post, we'll take a dive into the basics of the Linux CLI, shedding light on fundamental commands that will set you on a path to navigating, manipulating files, and performing tasks with confidence.

Unveiling the Command Line

Linux command syntax: command options arguments

Gliding Through Folders

The heart of file management lies in moving through directories and manipulating them.

  1. cd (Change Directory): Navigate between directories effortlessly.

    • Example: cd Documents - Moves to the "Documents" directory.
  2. rmdir (Remove Directory): Delete an empty directory.

    • Example: rmdir EmptyFolder - Deletes the empty folder named "EmptyFolder."

Mastering File Operations

Working with files is a breeze once you know the basics.

  1. touch: Create empty files.

    • Example: touch file.txt - Creates an empty file named "file.txt."
  2. rm: Remove files or directories (use with caution!).

    • Example: rm file.txt - Deletes the file named "file.txt."
    • Example: rm -r Folder - Recursively deletes the "Folder" directory and its contents.
  3. mv: Move or rename files and directories.

    • Example: mv old.txt new.txt - Renames "old.txt" to "new.txt."
    • Example: mv file.txt /new/location/ - Moves "file.txt" to a different location.
  4. cp: Copy files and directories.

    • Example: cp file.txt copy.txt - Copies "file.txt" to a new file named "copy.txt."
    • Example: cp -r Folder /backup/ - Copies the "Folder" directory and its contents to the "/backup/" directory.

Exploring General Commands

Discover essential commands that provide useful system information.

  1. pwd (Print Working Directory): Display the current directory's path.

    • Example: pwd - Prints the path of the current directory.
  2. date: Show the current date and time.

    • Example: date - Displays the current date and time.
  3. cal: Display a calendar for the current month.

    • Example: cal - Shows a calendar for the current month.
  4. ls: List files and directories in the current location.

    • Example: ls - Lists files and directories in the current directory.
    • Example: ls -l - Lists files in long format, showing detailed information.

A challenge :)

Try deleting a folder with some files (make a dummy folder , don't blame me for deleting something important :P )

try using rmdir . What does it do?

Well , that's the thing about linux , you need to be the google/gpt genius .

heed this sage advice: in the Linux realm, be the inquisitive genius, not the reckless fool. Each command wields power; wield it wisely and embrace the journey of discovery. The Linux realm beckons, dear comrade. Welcome!

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay