To create a subdirectory, you can use the mkdir command followed by the name of the subdirectory you want to create. If you want to create a subdirectory within an existing directory, you can specify the path. Here’s how to do it:
-
Navigate to the parent directory (optional):
If you want to create a subdirectory within a specific directory, first navigate to that directory using thecdcommand:cd /path/to/parent_directory -
Create the subdirectory:
Use themkdircommand followed by the name of the subdirectory. For example, to create a subdirectory namedsubdir:mkdir subdir -
Create a subdirectory with a specified path:
Alternatively, you can create a subdirectory directly by specifying the full path:mkdir /path/to/parent_directory/subdir -
Create nested subdirectories:
If you want to create a subdirectory within another new subdirectory, you can use the-poption:mkdir -p /path/to/parent_directory/new_subdir/another_subdir
This command will create new_subdir and another_subdir within it, creating any necessary parent directories along the way.
