Getting Started with Basic Linux (Bash) Commands Part -1

Subrat YadavSubrat Yadav
2 min read

1. Navigating the File System

  • pwd: Print Working Directory

    • Displays the current directory you are in.

    • Example: pwd

  • ls: List Directory Contents

    • Lists files and directories in the current directory.

    • Example: ls

  • cd: Change Directory

    • Used to navigate between directories.

    • Example: cd /path/to/directory

2. File and Directory Management

  • mkdir: Make Directory

    • Creates a new directory.

    • Example: mkdir new_directory

  • touch: Create an Empty File

    • Creates a new empty file or updates the timestamp of an existing file.

    • Example: touch newfile.txt

  • cp: Copy Files and Directories

    • Copies files or directories from one location to another.

    • Example: cp source.txt destination.txt

  • mv: Move or Rename Files and Directories

    • Moves files or directories or renames them.

    • Example: mv oldname.txt newname.txt

  • rm: Remove Files or Directories

    • Deletes files or directories (use with caution!).

    • Example: rm file.txt

3. Viewing and Editing Files

  • cat: Concatenate and Display Files

    • Displays the contents of a file in the terminal.

    • Example: cat file.txt

  • nano: Simple Text Editor

    • Opens a file in the Nano text editor for editing.

    • Example: nano file.txt

less: View File Contents

  • Allows you to view the contents of a file one screen at a time.

  • Example: less file.txt

More to come in future blogs stay updated ...

0
Subscribe to my newsletter

Read articles from Subrat Yadav directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Subrat Yadav
Subrat Yadav