There are -p option in mkdir command to create parent directories as needed
wolf@linux:~$ tree
.
0 directories, 0 files
wolf@linux:~$
wolf@linux:~$ mkdir dir1/dir2/dir3
mkdir: cannot create directory ‘dir1/dir2/dir3’: No such file or directory
wolf@linux:~$
wolf@linux:~$ tree
.
0 directories, 0 files
wolf@linux:~$
wolf@linux:~$ mkdir -p dir1/dir2/dir3
wolf@linux:~$
wolf@linux:~$ tree
.
└── dir1
└── dir2
└── dir3
3 directories, 0 files
wolf@linux:~$
Are there similar features in vi or touch command?
In this case, I would like to create file authorized_keys in nonexistent directory .ssh with vi or touch.
authorized_keys is a file, and not a directory. Hence, mkdir -p .ssh/authorized_keys command is not applicable here as authorized_keys will be created as directory, not a file.
wolf@linux:~$ ls .ssh
ls: cannot access '.ssh': No such file or directory
wolf@linux:~$
Would it be possible to do this without mkdir .ssh or mkdir -p .ssh?
wolf@linux:~$ touch .ssh/authorized_keys
touch: cannot touch '.ssh/authorized_keys': No such file or directory
wolf@linux:~$
mkdir -p?I just want to use vi without mkdir
– Wolf Aug 13 '20 at 06:08mkdir -pwhich is not my requirement. – Wolf Aug 13 '20 at 06:10mkdir -p. But I wanted similar feature inviortouchif possible. – Wolf Aug 13 '20 at 08:22