Varun
Varun

Reputation: 1229

Command not working in EC2?

None of the commands are working in ec2 machine.

-bash: id: command not found
-bash: id: command not found
-bash: id: command not found
-bash: tty: command not found
-bash: mktemp: command not found
-bash: $TMP: ambiguous redirect
-bash: rm: command not found
-bash: vim: command not found

I guess I did some changes in /etc/environment for setting PATH of java and after some time I am not able to run any of the commands in the next login.

Anyone please help, what should I do in order to run these commands perfectly again?

Upvotes: 1

Views: 2470

Answers (1)

Varun
Varun

Reputation: 1229

I screwed up by appending the PATH by using export PATH=$PATH: in /etc/environment file, as was not aware that $PATH does not work there in /etc/environment.

How i found my problem ?

A- I used command "which ls" then it showed me ls command location and which is /usr/bin and it also shows that PATH does not contain this.

How I solved my problem ?

A- As none of the command is working not even vi command so there was only option left was to do this : PATH=$PATH:/usr/bin export PATH

And after doing this , now i am able to sudo on my machine.

I hope ,it can be helpful for any other person who mistakenly screwed his/her environment.

Upvotes: 4

Related Questions