CentOS8 ほとんどのコマンドが実行できなくなった場合

CentOS8 ほとんどのコマンドが実行できなくなった場合

突然、catやらsudoやらlsやら大抵のコマンドが「: command not found…」となり実行できなくなるという事態が発生したので、その際の原因と対応方法

環境

OS  CentOS Linux release 8.0.1905 (Core)

エラー内容

sudoやlsを実行すると「command not found…」が発生

sudo
bash: sudo: command not found...
Install package 'sudo' to provide command 'sudo'? [N/y] y


 * Waiting in queue... 
The following packages have to be updated:
 sudo-1.8.25p1-8.el8_1.x86_64   Allows restricted root access for specified users
Proceed with changes? [N/y] y


 * Waiting in queue... 
 * Waiting for authentication... Failed to install packages: Failed to obtain authentication.
ls
bash: ls: command not found..
cat
bash: cat: command not found...

原因

/etc/profile.dにPATHを指定する記述を、誰かが作成していたため

対応方法

rootでログインして、対象のファイルを、とりあえず削除で復旧