LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-26-2005, 10:09 AM   #1
Adil_uk
LQ Newbie
 
Registered: Feb 2005
Location: London
Distribution: Auditor
Posts: 25

Rep: Reputation: 0
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.
 
Old 10-26-2005, 10:15 AM   #2
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
echo $PATH
 
Old 10-26-2005, 10:36 AM   #3
Adil_uk
LQ Newbie
 
Registered: Feb 2005
Location: London
Distribution: Auditor
Posts: 25

Original Poster
Rep: Reputation: 0
echo $PATH

Return

/bin/ksh/


I have feeling I need to change some setting in the .profile
 
Old 10-26-2005, 10:47 AM   #4
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
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"
 
Old 10-26-2005, 10:59 AM   #5
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
*EDIT: Duplicate post*
 
Old 10-27-2005, 05:03 AM   #6
Adil_uk
LQ Newbie
 
Registered: Feb 2005
Location: London
Distribution: Auditor
Posts: 25

Original Poster
Rep: Reputation: 0
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.
 
Old 10-27-2005, 05:35 AM   #7
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
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

Last edited by phil.d.g; 10-27-2005 at 05:37 AM.
 
Old 10-27-2005, 05:38 AM   #8
Adil_uk
LQ Newbie
 
Registered: Feb 2005
Location: London
Distribution: Auditor
Posts: 25

Original Poster
Rep: Reputation: 0
Everyday I'm learning new things


thanks for the tip
 
Old 12-16-2005, 07:25 PM   #9
starchild321
LQ Newbie
 
Registered: Aug 2005
Location: United States
Distribution: Suse 9.1
Posts: 7

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

thanks
 
Old 12-17-2005, 06:36 AM   #10
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
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.
 
Old 10-09-2008, 09:48 PM   #11
grisswold
LQ Newbie
 
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
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..
 
Old 12-10-2008, 09:55 AM   #12
pra
LQ Newbie
 
Registered: Dec 2008
Posts: 1

Rep: Reputation: 0
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
 
Old 07-24-2009, 07:47 AM   #13
PeterUK
Member
 
Registered: May 2009
Posts: 281

Rep: Reputation: 16
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
 
Old 03-13-2010, 09:52 AM   #14
wireisetc
LQ Newbie
 
Registered: Mar 2007
Location: Boston, MA, US
Distribution: openSUSE 11.2
Posts: 4

Rep: Reputation: 1
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 View Post
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 View Post
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
 
1 members found this post helpful.
Old 04-09-2012, 01:04 AM   #15
maazrehan
LQ Newbie
 
Registered: Sep 2008
Posts: 1

Rep: Reputation: 0
Thumbs up 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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: g++: command not found m_lp_ql_m Linux - Software 8 07-08-2010 01:45 PM
bash: pg: command not found Chomper Programming 2 02-05-2005 02:22 AM
-bash: cp: command not found johnlittlepeap Fedora 2 11-15-2004 08:52 AM
-bash: ls: command not found jchun Linux - General 3 11-02-2004 10:11 AM
bash: command not found jc80 Fedora 3 03-14-2004 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration