The touch command is used to create a file.
touch file.mdUnlike the mkdir command, there isn’t an equivalent of the -p flag to create the intermediate directories if they don’t exist. In order to do this, we need to combine both the commands
touch dir1/dir2/file.mdIf dir1 and dir2 don’t exist, the shell will return an error touch: dir1/dir2/file.md: No such file or directory
mkdir -p dir1/dir2 && touch dir1/dir2/file.mdWe can combine mkdir and touch to achieve the result