Operating System - HP-UX
1752618 Members
4434 Online
108788 Solutions
New Discussion

Re: no command is working

 
Guy Tsudkevich
Occasional Advisor

no command is working

on my quest to fingdthe right PATH command on the right file i probably made the wrong change.

and now the situation is that no command is working beside "pwd" and "cd" 

can you help me fix this?

 

 

P.S. This thread has been moved from HP-UX > System Administration to HP-UX > languages. - Hp Forum moderator

4 REPLIES 4
Torsten.
Acclaimed Contributor

Re: no command is working

I remember you changed PATH variable yesterday to get bash working. How did you do this?


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Patrick Wallek
Honored Contributor

Re: no command is working

You should always be able to run commands be specifying the full path to the command.

 

A lot of commands that you regularly use are stored in the /usr/bin directory.  So to run a command like 'vi' you would do:

 

# /usr/bin/vi

 

To edit your /etc/PATH file again do:

 

# /usr/bin/vi /etc/PATH

 

and undo any changes you made yesterday.

 

You will then likely have to login again and make sure your path is working.  Do NOT log out of your current session until you are sure you can login successfully again.

Dennis Handly
Acclaimed Contributor

Re: no command is working

>no command is working beside "pwd" and "cd" 

 

These are shell builtins, so they will always work.

You need to change PATH:

export PATH=/usr/bin:$PATH

 

Then figure whether you want to modify /etc/PATH or each user's ~/.profile.

Bill Hassell
Honored Contributor

Re: no command is working

If you typed this command:

 

PATH=/usr/local/bin

 

to get bash to run, now the pathnames for other commands have been removed and you must use the full path for everything else. That's why none of the usual commands seemed to have disappeared. The PATH variable (just like DOS/Windows) is a helper to save you from having to type the full pathname for every command.

 

The correct way to add a new path is:

 

PATH=$PATH:/usr/local/bin

 

If you type the first command above and did not store this line in your profile, log out and and back in again and your PATH will be restored and the other commands will be found again.

 

If it was stored in /etc/profile or .profile, then use /usr/bin/vi to edit the file to the correct string. Then log out and back in again to restore your PATH variable.

 

If you edited /etc/PATH and you did not keep a copy of the old file, you'll need to restore the old file from your most recent backup.



Bill Hassell, sysadmin