F5F Stay Refreshed Software Operating Systems Create a new directory in Linux using commands like mkdir or cd followed by the path.

Create a new directory in Linux using commands like mkdir or cd followed by the path.

Create a new directory in Linux using commands like mkdir or cd followed by the path.

S
SHARPEYEDBEAR
Junior Member
9
12-03-2021, 12:17 AM
#1
Hello . linux noob here! , currently studying linux within a cyber course im attending to and i have an assignment im having a hard time figuring out with just google in hands. i wanted to know if theres a way to create a folder and subfolders within that folder in just one command. i managed to do something like that - Mkdir support ; mkdir support/support{1..3} but i was wondering , as this is pretty much two codes in one line , if theres a way to do the same with a single command. Thanks upfront!
S
SHARPEYEDBEAR
12-03-2021, 12:17 AM #1

Hello . linux noob here! , currently studying linux within a cyber course im attending to and i have an assignment im having a hard time figuring out with just google in hands. i wanted to know if theres a way to create a folder and subfolders within that folder in just one command. i managed to do something like that - Mkdir support ; mkdir support/support{1..3} but i was wondering , as this is pretty much two codes in one line , if theres a way to do the same with a single command. Thanks upfront!

B
binqiu9999
Member
63
12-03-2021, 12:17 AM
#2
Create directory structure using command line tools. Refer to manual for available commands.
B
binqiu9999
12-03-2021, 12:17 AM #2

Create directory structure using command line tools. Refer to manual for available commands.

J
justfyre
Junior Member
37
12-03-2021, 12:17 AM
#3
you can achieve this by using a single command with a wildcard. instead of repeating the pattern multiple times, you can leverage shell expansion or a loop construct. for example, in bash you could write: `mkdir -p support/*` which will create all subfolders up to depth 3 automatically. if you need more than 100, you’d need to adjust the depth or use a script to generate the names dynamically.
J
justfyre
12-03-2021, 12:17 AM #3

you can achieve this by using a single command with a wildcard. instead of repeating the pattern multiple times, you can leverage shell expansion or a loop construct. for example, in bash you could write: `mkdir -p support/*` which will create all subfolders up to depth 3 automatically. if you need more than 100, you’d need to adjust the depth or use a script to generate the names dynamically.

E
eskzz
Posting Freak
909
12-03-2021, 12:17 AM
#4
Use a straightforward bash command to create multiple directories. Loop through the desired range and execute mkdir for each one.
E
eskzz
12-03-2021, 12:17 AM #4

Use a straightforward bash command to create multiple directories. Loop through the desired range and execute mkdir for each one.

X
xMephist0x
Junior Member
43
12-03-2021, 12:17 AM
#5
Thanks a lot, man! I got my answer.
X
xMephist0x
12-03-2021, 12:17 AM #5

Thanks a lot, man! I got my answer.

I
iTz_ChriS_PvP
Junior Member
17
12-03-2021, 12:17 AM
#6
Create the necessary directories if they don't exist.
I
iTz_ChriS_PvP
12-03-2021, 12:17 AM #6

Create the necessary directories if they don't exist.