Getting below error while trying to create a folder in hadoop

-bash-4.2$ hdfs dfs -mkdir /nikhil

mkdir: Permission denied: user=nikhilmittal156044, access=WRITE, inode="/nikhil":hdfs:hdfs:drwxr-xr-x

You are trying to create directory at top level which is no allowed.

Try the following, it will create the directory in your home directory in hdfs:

hdfs dfs -mkdir nikhil

Pl learn about relative and absolute paths in HDFS