コマンドが見つかりません

コマンドが見つかりません

ターミナルウィンドウを開くたびに、この現象が表示されます。誰もがこの問題に対する恒久的な解決策を見つけることができますか?

bash: /usr/lib/jvm/jdk-16.0.1: Is a directory
Command 'dircolors' is available in the following places
 * /bin/dircolors
 * /usr/bin/dircolors

The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
dircolors: command not found
Command 'dirname' is available in the following places
 * /bin/dirname
 * /usr/bin/dirname

The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
dirname: command not found
Command 'dirname' is available in the following places
 * /bin/dirname
 * /usr/bin/dirname

The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
dirname: command not found

一時的な目的で次のコマンドを使用します。

export PATH="/usr/bin:$PATH"

ベストアンサー1

この問題を解決する方法は2つあります。

  • シェル初期化ファイルのコマンドが正しく実行されるように、/bin と /usr/bin をパスに戻します。
  • シェル初期化ファイルを編集してパスにないコマンドを削除するか、必要なパスコンポーネントが見つからない場合は実行をスキップします。

シェル初期化ファイルは、ホームディレクトリに隠されたファイルです。これらのファイルの名前は、使用するシェルによって異なります。たとえば、bashを使用している場合、これらのファイルには.bashrc、.bash_profile、および.profileが含まれます。

ただし、これらのファイルを編集すると、そのファイルにエラーが追加された場合、アカウントが正しく機能しなくなる可能性があります。パスが正しいことを確認するのが最善です。または、パスから/binまたは/usr/binを一時的に削除する必要がある場合は、結果のエラーを無視してください。

おすすめ記事