ADVERTISEMENT

Linux Commands ❯ mkdir

mkdir

Create the DIRECTORY(ies), if they do not already exist.
syntax:

mkdir [OPTION]... DIRECTORY...
  • mkdir my_dir1
    create a directory called my_dir1 in the current directory
  • mkdir my_dir1 my_dir2
    create directories, my_dir1 and my_dir2 in the current directory
  • mkdir user_{logs,commands}
    create 2 directories with names - user_logs and user_commands
  • mkdir -p my_dir1/my_dir2
    create my_dir2 in my_dir1 if my_dir1 already exists. otherwise create my_dir1 and then my_dir2 under that.
  • mkdir -v -p my_dir1/my_dir2/my_dir3
    create the directory structure my_dir1/my_dir2/my_dir3 and print messages to indicate each activity