In Unix, how do I create a new directory?

To create a subdirectory in the home directory of your Unix account, use the mkdir command. For example, to create a subdirectory called work, at the Unix prompt from within your home directory, enter:

  mkdir work

The mkdir command requires at least one argument and will take multiple arguments. To create three directories named work, programs, and reports, enter:

  mkdir work programs reports

If you're currently in your home directory and you want to make a new directory in another directory, you don't need to use the cd command first. You may specify a pathname with the mkdir command, for example:

  mkdir bin/work

The mkdir command in conjunction with the -p option creates the directories specified in a path. This is very useful when you want to make a directory structure that is several directories deep, and none of the subdirectories exist yet. For example, the following command will create the work, work/programs, work/programs/reports, and work/programs/reports/completed subdirectories:

  mkdir -p work/programs/reports/completed

Without the -p option, this command would have returned an error.

For more information on the mkdir command, see the online manual. At the Unix shell prompt, enter:

  man mkdir

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document abng in the Knowledge Base.
Last modified on 2008-08-22.

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.