Hadoop Command Not Found: Verify the Install Before Editing PATH

hadoop: command not found is a shell command-discovery failure. First prove that the intended Hadoop distribution actually contains a runnable bin/hadoop script, then compare that installation with what the failing shell resolves. Do not reinstall Hadoop, edit multiple profiles, or troubleshoot Java until you know which stage fails.

Apache HadoopHadoop 3.x · Unix-like shellsLast reviewed Sep 27, 2026
🎯 You’re likely in the right place if:
Running `hadoop` returns “command not found” or similar.You downloaded or unpacked Hadoop but the shell cannot invoke it by name.You are using a Unix-like shell such as bash, zsh or WSL.
Choose the path that matches what you see
./bin/hadoop version worksThe installation is present; fix HADOOP_HOME/PATH rather than reinstalling Hadoop.
./bin/hadoop version also failsInspect the Hadoop distribution, permissions and Java before editing PATH.
command -v hadoop points to an old installRemove the stale path or select the intended Hadoop installation.
Hadoop is found but Java failsThe command-discovery problem is solved; continue with Java/Hadoop configuration instead.
bin/hadoop does not existStop editing PATH. Verify that you are in the intended, complete Hadoop distribution.
Works in one shell but not anotherCompare PATH and startup/profile loading in the failing shell instead of reinstalling Hadoop.
Works interactively but fails in a job/serviceDiagnose that process environment directly; it may not load your interactive shell profile.
Difficulty: Easy–ModerateRisk: Low first
🔎 First check — prove the script exists, then run it directly

From the intended Hadoop distribution root, verify bin/hadoop exists before testing PATH. Then invoke that exact script. This separates missing/wrong distribution, direct-execution, and shell-discovery failures.

cd /path/to/hadoop ls -l ./bin/hadoop ./bin/hadoop version

Interpret: script missing → wrong/incomplete distribution; script exists but direct invocation cannot start → diagnose that execution error first; version prints → Hadoop is runnable and the remaining hadoop-by-name failure is shell/PATH resolution.

Did Hadoop run from ./bin/hadoop?
ADSENSE · reserved slot after the first useful step

Why this happens

Apache Hadoop commands are scripts in the distribution's bin directory. A shell resolves hadoop by name through its command lookup/PATH. HADOOP_HOME is useful to identify the Hadoop installation for Hadoop configuration and scripts, but setting it alone does not make the shell discover hadoop; the relevant bin directory still has to be resolvable.

Diagnose before changing more

1
Does the intended distribution contain bin/hadoop?
If not, PATH cannot fix it. Confirm the extraction/install location and that you are not standing in a source tree, parent directory or incomplete package.
2
Does ./bin/hadoop version start?
If yes, the script is runnable and command discovery is the remaining issue. If it starts and then reports Java/configuration errors, command discovery has already succeeded.
3
Is HADOOP_HOME the actual distribution root?
It should point to the directory that contains bin, etc and other Hadoop directories.
4
Does Java fail after Hadoop is found?
That is a different stage: command discovery succeeded, so troubleshoot Java/Hadoop configuration separately.
5
Does command -v hadoop resolve another installation?
If so, fix PATH precedence or remove the stale entry rather than stacking another Hadoop bin directory ahead of it blindly.
6
Does only another shell, IDE, SSH session, service or job fail?
Inspect PATH in that exact process. Interactive shell startup files are not universal environment configuration.

Fix #2 — set HADOOP_HOME and PATH for the current shell

Point `HADOOP_HOME` to the real Hadoop installation and prepend its `bin` directory to PATH. Use your actual installation path.

export HADOOP_HOME=/path/to/hadoop export PATH="$HADOOP_HOME/bin:$PATH" command -v hadoop hadoop version
🟡 Before changing configuration: Test the values in the current shell first. Do not permanently save a path until it works.

Verify: Run command -v hadoop and hadoop version in the same shell. Both should resolve the intended installation.

Did Fix #2 work?

Fix #3 — persist only the environment that already worked

After the temporary values work, identify the startup file actually read by the shell/session where you need Hadoop. For an interactive bash/zsh terminal that may be a file such as ~/.bashrc or ~/.zshrc, but login shells, IDE terminals, SSH, services and automation can have different startup behavior. Do not copy the exports into every profile file.

hadoop version
🟡 Keep it reversible: Edit only the shell profile you actually use, and avoid duplicate or stale Hadoop paths.

Verify: Open a new terminal and run hadoop version again. The command should still resolve without manually exporting variables first.

Did Fix #3 work?

Fix #4 — works in your terminal, fails in IDE, SSH, service or automation

Run the same discovery checks inside the failing environment. A successful interactive terminal proves only that that process has the right PATH. IDE terminals, remote sessions, schedulers, services and containers can inherit a different environment and may not read your usual shell startup file.

printf '%s\n' "$SHELL" printf '%s\n' "$PATH" command -v hadoop || true command -v java || true

Verify: rerun the exact command/job/service context that originally reported hadoop: command not found. Do not treat success in a different terminal as final verification.

What not to do

Do not add several Hadoop bin directories to PATH at once.Do not persist environment variables before they work in the current shell.Do not treat a later Java/configuration error as proof that Hadoop is still “command not found.”Do not assume setting HADOOP_HOME alone makes hadoop discoverable by the shell.Do not add PATH entries for a directory until you have proved that directory actually contains the intended bin/hadoop.Do not copy Hadoop exports into every shell profile to fix one environment; identify which startup path the failing process actually uses.

Still seeing the error?

If `command -v hadoop` returns a path but Hadoop itself fails, the command-not-found problem is solved. Continue with the new error message, such as Java configuration, permissions or Hadoop configuration, rather than adding more PATH entries.

Before escalating, capture:the exact shell error textoutput of ./bin/hadoop version from the distribution directoryoutput of command -v hadoopcurrent HADOOP_HOME and relevant PATH segmentshell type and startup file being usedoutput of ls -l ./bin/hadoop from the intended distribution rootwhether the failure is interactive shell, IDE, SSH, service, scheduler or containerthe first new error after command discovery succeeds, especially Java/configuration errors

Official references

Still stuck? Ask the community

Share your operating system, software version, exact error text, and which fix you already tried. Another reader may have seen the same setup.

Keep it safe: never post passwords, API keys, access tokens, recovery codes, license keys, private URLs, or confidential logs.
Powered by GitHub DiscussionsSign in with GitHub to comment. Reading comments does not require sign-in.

Loading community discussion…