LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Bash: command not found! (https://www.linuxquestions.org/questions/linux-general-1/bash-command-not-found-377077/)

Adil_uk 10-26-2005 10:09 AM

Bash: command not found!
 
Hi

I'm having a very weird problem. whatever command I type I keep getting "bash: ls: command not found". That go for all the command Except for the "pwd" and "echo" no idea why its doing that?

By the way its a "SunOS" I don't have choice in the matter, as its a University Server and I have to use it to do my work.

some example.

[simt /home/ugrad/adh098] ls -l
bash: ls: command not found
[simt /home/ugrad/adh098] ls
bash: ls: command not found
[simt /home/ugrad/adh098] man
bash: man: command not found
[simt /home/ugrad/adh098] man bash
bash: man: command not found
[simt /home/ugrad/adh098] cd
[simt /home/ugrad/adh098] bash
bash: bash: command not found
[simt /home/ugrad/adh098] echo whats going on?
whats going on?
[simt /home/ugrad/adh098] ls -l
bash: ls: command not found
[simt /home/ugrad/adh098] ls
bash: ls: command not found
[simt /home/ugrad/adh098] pwd
/home/ugrad/adh098
[simt /home/ugrad/adh098]



P.S do I need to edit my profile to correct this problem?

Appreicate you help.

oneandoneis2 10-26-2005 10:15 AM

echo $PATH

Adil_uk 10-26-2005 10:36 AM

echo $PATH

Return

/bin/ksh/


I have feeling I need to change some setting in the .profile

oneandoneis2 10-26-2005 10:47 AM

Yep - PATH tells Bash where to look to find the executables like "ls" - usually , they'll be somwehre like /usr/bin

You need to add those directories to your PATH to make them work. In the meantime, use the full pathname to get the functionality: "/usr/bin/ls" instead of just "ls"

oneandoneis2 10-26-2005 10:59 AM

*EDIT: Duplicate post*

Adil_uk 10-27-2005 05:03 AM

I Fixed Problem
 
I now know what caused the problem. My ".profile" only had one line that said.

MAIL=/usr/mail/${LOGNAME:?}


But i've added this line to it.

PATH=/usr/bin/ksh/

and that when the problem started... so I've removed this line and exit it the shell, and logged back in, and everthing was normal.



P.S if I want to have bash by default when I log in what should I add to my ".profile" ?


thanks for you help.

phil.d.g 10-27-2005 05:35 AM

That is why you had the problems,

your path needs to list all the locations where binary files are found eg: bin;usr/bin;/usr/local/bin. If you want to change your shell then instead of PATH=/usr/bin/ksh you need
Code:

SHELL=/usr/bin/ksh

And to answer your question - to have bash as your default shell then you need
Code:

SHELL=/usr/bin/bash
though please make sure it exists before setting it, you can do that by typing bash in your current shell and seeing if you get a bash prompt

Adil_uk 10-27-2005 05:38 AM

Everyday I'm learning new things


thanks for the tip

starchild321 12-16-2005 07:25 PM

I am trying to install crossover and getting the message bash: $: not found. I am running SUSE 10 Pro. Can someone help?

thanks

Komakino 12-17-2005 06:36 AM

If you want to add a line to the PATH, do it like:
Code:

PATH=$PATH:/new/path:/another/new/path
etc

The $PATH bit means it includes what the currently set path is. What you put in changed the path, rather than adding to it.

grisswold 10-09-2008 09:48 PM

Can anybody help me with this?

I dnt know if this is an SME problem or with the bash something... I've tried searching help from SME forums but nothing seems to help so I've figured maybe this could be with the bash problem o something...

Anyways here my problem, everytime I type this to the shell
Quote:

expand-template /root/.my.cnf
It would then give me an error "bash:expand-template: command not found"...
So the only way for me to get that command to work is this
Quote:

/sbin/e-smith/expand-template /root/.my.cnf
even if I just type in "db" in the shell, it give me the same problem "bash:db: command not found"...

Now does anyone of you guys no about on how to resolve this? Like how to change bash to the default... I'm a newbie a linux and SME, so if any of u have any info in helping, cud u also give a step-by-step detail in how to..

pra 12-10-2008 09:55 AM

can anybody solve this problem!!
[prashanth@localhost ~]$ xlc_r –q64 –qarch=auto –qmkshrobj Hello.c –o libhello.so
bash: xlc_r: command not found
I am trying to compile native c code using JNI.but not able to do so

PeterUK 07-24-2009 07:47 AM

This works for me
 
Where is the ".profile" file? I have added path by the shell, but I would like to know where is the file? Thanks

[QUOTE=Komakino;2003519]If you want to add a line to the PATH, do it like:
Code:

PATH=$PATH:/new/path:/another/new/path
Hi, I had a problem with qt 4 specially for the uic3 convector, was giving me bash error

I added the PATH on the shell and it works. Thanks

wireisetc 03-13-2010 09:52 AM

Adding response for completeness...
 
I noticed there was a dangling question in the last post. So should someone get here, I am adding a bit more detail.

Quote:

Originally Posted by PeterUK (Post 3618801)
Where is the ".profile" file? I have added path by the shell, but I would like to know where is the file? Thanks

Quote:

Originally Posted by Komakino (Post 2003519)
If you want to add a line to the PATH, do it like:
Code:

PATH=$PATH:/new/path:/another/new/path

The bash shell can use several configuration files. There are the default startup/configuration files in /etc (eg /etc/profile). These are intended to provide reasonable default settings. You can tailor your bash shell environment by creating specially named files in your home directory. These are:
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
When you login, the configuration files are searched for and read in an ordered fashion (/etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile) In this manner your setting will add to or override the defaults.

When you are starting a bash shell after logging in, the ~/.bashrc file will be read if it exists.

Typically one creates any of ~/.bash_profile, ~/.bash_login, ~/.profile for settings that are needed for all of your bash shells. ~/.bashrc is reserved for setting the environment specifically for your interactive shells. bash reads the login configuration files just once at login. ~/.bashrc is read for each startup of an interactive shell.

The fine details for bash are found in the manual page, bash(1). Type
Code:

man bash
on your command line.

Bonne chance et bon courage!

--Eric

maazrehan 04-09-2012 01:04 AM

Bash Error: Command Not Found
 
Hi you,

The solution is simple. Run the following.

/usr/bin/gedit ~/.bashrc

My file shows following contents:

############ START NS 2.33 ############################
export NS_HOME=/home/maazrehan/NS2/ns-allinone-2.33
export PATH= $PATH:$NS_HOME/bin:$NS_HOME/tcl8.4.18/unix:$NS_HOME/tk8.4.18/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NS_HOME/otcl-1.13:$NS_HOME/lib
export TCL_LIBRARY=$NS_HOME/tcl8.4.18/library
############ END NS 2.33 ##############################

I see that there is a SPACE on the following line after PATH=, which is an error.

export PATH= $PATH:$NS_HOME/bin:$NS_HOME/tcl8.4.18/unix:$NS_HOME/tk8.4.18/unix

Remove all such spaces, save the file and logout from the terminal. Now, again login in the terminal with root. All commands will work.

---Maaz Rehan


All times are GMT -5. The time now is 12:00 AM.