10 Essential WSL Terminal Commands Every Beginner Developer Should Know

Mahmudur Rahman - Jan 28 - - Dev Community

Hey there, fellow devs! đź‘‹

If you're just starting your journey into the world of programming, one of the first tools you'll need to get comfortable with is the terminal. Whether you're on macOS, Linux, or even Windows (with WSL), the terminal is your gateway to efficiently managing files, running scripts, and interacting with your system.

To help you get started, here’s a list of 10 essential terminal commands that every beginner developer should know:


1. pwd - Print Working Directory

  • What it does: Shows the current directory you're in.
  • Example:

     $ pwd
     /Users/yourname/projects
    

2. ls - List Directory Contents

  • What it does: Lists all files and directories in the current folder.
  • Pro Tip: Use ls -la to show hidden files and detailed information.
  • Example:

     $ ls
     file1.txt  file2.txt  projects
    

3. cd - Change Directory

  • What it does: Moves you into a different directory.
  • Example:

     $ cd projects
     $ pwd
     /Users/yourname/projects
    

4. mkdir - Make Directory

  • What it does: Creates a new directory.
  • Example:

     $ mkdir new_folder
    

5. touch - Create a New File

  • What it does: Creates an empty file.
  • Example:

     $ touch new_file.txt
    

6. rm - Remove Files or Directories

  • What it does: Deletes files or directories.
  • Pro Tip: Use rm -r to remove directories and their contents.
  • Example:

     $ rm old_file.txt
     $ rm -r old_folder
    

7. cp - Copy Files or Directories

  • What it does: Copies files or directories from one location to another.
  • Example:

     $ cp file1.txt file1_copy.txt
    

8. mv - Move or Rename Files

  • What it does: Moves files or directories or renames them.
  • Example:

     $ mv file1.txt new_location/file1.txt
     $ mv old_name.txt new_name.txt
    

9. cat - Concatenate and Display File Content

  • What it does: Displays the contents of a file.
  • Example:

     $ cat file1.txt
    

10. grep - Global Regular Expression Print

  • What it does: Searches for a specific pattern in a file.
  • Example:

     $ grep "search_term" file1.txt
    

Bonus Tip: man - Manual Pages

  • What it does: Displays the manual for any command.
  • Example:

     $ man ls
    

Why Learn Terminal Commands?

  • Efficiency: Performing tasks via the terminal is often faster than using a GUI.
  • Automation: You can write scripts to automate repetitive tasks.
  • Versatility: Many development tools and environments rely on terminal commands.

Your Turn!

What’s your favourite terminal command or tip? Share it in the comments below! Let’s help each other grow as developers. 🚀

Happy coding! đź’»


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .