How to fix "mkdir: missing operand" error

Endrit Qerreti

Endrit Qerreti

mkdir is a command that allows you to create a directory on Linux.

With mkdir you can create one or multiple directories via the terminal.

If the wrong syntax is used when trying to create a directory, you may get the error "mkdir: missing operand"

This error indicates that something's missing, but it doesn't really specify what part is missing". The error might be confusing, especially if you are new to linux.

In this tutorial, you will learn how to fix the error "mkdir: missing operand" on any Linux distro.

Why does this error happen?

In order to create a directory with mkdir command, you must use the right syntax, for example to create an empty directory on your machine by using the mkdir command, you can do so by using the right syntax.

If you don't specify the name of the directory that you want to create with mkdir, then you may get the error "mkdir: missing operand".

mkdir 

How to fix "mkdir: missing operand" error

You are getting this error on your terminal, only because the syntax that you are using it's not the right syntax.

For example, to create a directory on Linux with mkdir, you can do so by using the correct syntax.

The correct syntax is:

mkdir directory

The command above will create an empty directory on your machine called directory

So the missing operand in this error is the directory name, in this case directory

To create multiple directories with mkdir, you can do so by simply specifying two directory names as below:

mkdir directory_1 directory_2

In this case, the command above will create two empty directories called directory_1 and directory_2

Conclusion

In this tutorial, you learned that the error "mkdir: missing operand" happens when you are trying to create a directory on Linux, without specifying the directory name after the mkdir command.

So the solution to this error is by simply using the right syntax to create a directory mkdir directory