Can touch create directories too?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 04 2025
0295

No, the touch command cannot create directories. It is specifically designed for creating empty files or updating the timestamps of existing files.

To create directories, you should use the mkdir command. For example:

mkdir new_directory

This command will create a new directory named new_directory. If you want to create multiple directories at once, you can do so like this:

mkdir dir1 dir2 dir3

Or to create nested directories, you can use the -p option:

mkdir -p parent_directory/child_directory

0 Comments

no data
Be the first to share your comment!