📁

Creating Directories in Bash and Windows

Jun 2, 2025

Understanding Directory Creation in Bash and Windows

Commands for Creating Directories

  • Bash & Windows: The command to create a new directory is mkdir. In some contexts, it might also be referred to as mkdirectory.

Creating a Directory in Bash

  • Basic Command:
    • mkdir mycoolfolder: This command creates a new directory named mycoolfolder.
  • Verification:
    • After running the command, verify that mycoolfolder appears on your desktop or in the intended directory.

Handling Spaces in Directory Names

  • Using Backslashes:
    • In Bash, to handle spaces in directory names, use a backslash (\) to escape spaces.
    • Example: mkdir my\ cool\ folder
  • Using Quotes:
    • Alternatively, use quotes to encompass the entire directory name.
    • Example: mkdir "my cool folder"

Tips

  • Escaping Characters:
    • Unlike Windows, which uses backticks, Bash uses backslashes for escaping characters.
  • Review & Practice:
    • If uncertain about the commands or their usage, review this guide or rewatch instructional videos to better understand the concepts.

This guide serves as a quick reference for creating directories on Linux systems using Bash, especially when dealing with directory names that contain spaces.