Java – “hdfs namenode -format” when attempting to execute command “hdfs: command not found” during hadoop installation

“hdfs namenode -format” when attempting to execute command “hdfs: command not found” during hadoop installation… here is a solution to the problem.

“hdfs namenode -format” when attempting to execute command “hdfs: command not found” during hadoop installation

Full misstatement:

No command 'hdfs' found, did you mean:
  Command 'hfs' from package 'hfsutils-tcltk' (universe)
  Command 'hdfls' from package 'hdf4-tools' (universe)
  hdfs: command not found

Solution

There may be a problem with your HDFS installation, try providing the full path to hdfs in the command.

/path/to/dir/hdfs namenode -format

The path depends on your operating system and the Hadoop distribution you are using, etc. Use locate or find.

If it works for the full path, it may be a PATH issue, export the path into a .bashrc, and try.

Cheers.

Related Problems and Solutions