One command to create a directory and file inside it linux command

mkdir B && touch B/myfile.txt

Alternatively, create a function:

mkfile() { mkdir -p -- "$1" && touch -- "$1"https://stackoverflow.com/"$2" }

Execute it with 2 arguments: path to create and filename. Saying:

mkfile B/C/D myfile.txt

would create the file myfile.txt in the directory B/C/D.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)