LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-20-2007, 12:44 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Rep: Reputation: 30
bash command not found


Hey there
Is anyone familiar with the following? :

-bash: id: command not found
-bash: dircolors: command not found
-bash: biff: command not found
-bash: dircolors: command not found
-bash: id: command not found
BT ~ $

This happens whenever i start the terminal window.
I was having a problem with my javac and java and I made some changes to profile and .bash_profile files. The fact is that finally i fixed java and javac but now i got this problem.

Many thanks for your time and for sharing your knowledge
Manolakis
 
Old 01-20-2007, 01:02 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Could you post your .bash_profile and .bashrc
 
Old 01-20-2007, 01:44 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,128

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Chances are you removed the /bin and/or /usr/bin directories from your $PATH. These directories are where many Linux system executables are stored so they need to be in your $PATH or you'll see results like what you posted.
 
Old 01-20-2007, 03:03 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by btmiller
Chances are you removed the /bin and/or /usr/bin directories from your $PATH. These directories are where many Linux system executables are stored so they need to be in your $PATH or you'll see results like what you posted.
Or maybe the executables are executed before PATH has been properly set-up (somewhere in profile).
 
Old 01-20-2007, 07:31 PM   #5
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"

# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/jdk1.6.0/bin/"

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi

# I had problems using 'eval tset' instead of 'TERM=', but you might want to
# try it anyway. I think with the right /etc/termcap it would work great.
# eval `tset -sQ "$TERM"`
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
VISUAL=emacs
# VISUAL=gmacs
# VISUAL=vi
fi

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
#My colour additions (muts)

#PS1="\u@\h:\w\$ "
#PS1="\[\033[1;34m\]\u@\h:\w\$ \033[0m "
#PS1='\[\e[34;1m\]\u@\h:\w\$ \[\e[0m\]'
PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask. A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Set up the LS_COLORS and LS_OPTIONS environment variables for color ls:
if [ "$SHELL" = "/bin/zsh" ]; then
eval `dircolors -z`
elif [ "$SHELL" = "/bin/ash" ]; then
eval `dircolors -s`
else
eval `dircolors -b`
fi

# Notify user of incoming mail. This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
biff y
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:/usr/local/jdk1.6.0/bin/."
fi

###############################################
###############################################
 
Old 01-20-2007, 07:41 PM   #6
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
What i post before was the .bash_profile file.I cannot find .bashrc Well i think that i have made a big mistake.When i rebooted my pc i could not use the startx not even su and i decided to reinstall BackTrack(My linux) and to create a new user
The fact now is that javac again is not recognized
Please can you explain how exactly should these files be(.bash_profile && .bashrc)
What can i do now that i have lost .bashrc?

Many thanks for dedicating your time
Manolakis
 
Old 01-20-2007, 07:49 PM   #7
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
.bashrc

# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"

# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/apache/bin:/usr/local/pgsql/bin:/opt/mono/bin:/usr/local/pgsql/bin:."

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi

# I had problems using 'eval tset' instead of 'TERM=', but you might want to
# try it anyway. I think with the right /etc/termcap it would work great.
# eval `tset -sQ "$TERM"`
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
VISUAL=emacs
# VISUAL=gmacs
# VISUAL=vi
fi

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
#My colour additions (muts)

#PS1="\u@\h:\w\$ "
#PS1="\[\033[1;34m\]\u@\h:\w\$ \033[0m "
#PS1='\[\e[34;1m\]\u@\h:\w\$ \[\e[0m\]'
PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask. A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Set up the LS_COLORS and LS_OPTIONS environment variables for color ls:
if [ "$SHELL" = "/bin/zsh" ]; then
eval `dircolors -z`
elif [ "$SHELL" = "/bin/ash" ]; then
eval `dircolors -s`
else
eval `dircolors -b`
fi

# Notify user of incoming mail. This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
biff y
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:/usr/local/jdk1.6.0/bin/."
fi
 
Old 01-21-2007, 12:22 AM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,128

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
It's generally best not to modify /etc/profile but to make your own .bash_profile and .bashrc which will keep you from screwing up the global environment. I noticed inthe above scripts you had used commands like id before you had added the standard /bin and /usr/bin directories to the $PATH.

Here's what I would do if I were you.

1) Create a .bash_profile script in your home directory with the following content:

Code:
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
Also create a .bashrc file in your home directory with the following:

Code:
export PATH=$PATH:/usr/local/jdk1.6.0/bin
Assuming javac lives in /usr/local/jdk1.6.0/bin you will now be able to use it and the rest of the $PATH is kept intact (we just tacked the directory containing the java executables on at the end).
 
Old 01-21-2007, 11:49 AM   #9
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by manolakis
PATH="/usr/local/jdk1.6.0/bin/"
This seems to be the glaringly offending line for your original problem (line 17 of .bash_profile). It wipes out the path, and replaces it with /usr/local/jdk1.6.0/bin, and thereafter, the shell interpreter cannot find id, dircolors, or biff.
 
Old 01-21-2007, 11:58 AM   #10
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
Hey again

I just want to ask smth to be sure. When you say in your home directory you probably mean(setting the case that i am the user 'newbie') /home/newbie/
Is that right? If that is right i have to say that a .bashrc already exists in there.
Do i have to erase everything in that file and only put the export statement that you gave me or just to put the export statement where the others are?
I did what you said and again javac cannot be found.
You said before that it is not good to modify the etc/profile
Unfortunately for me i made some changes to that files and i am quite afraid that i dont remember which changes i have to take back. Any ideas what i can do?

Please any advice will be grateful
 
Old 01-21-2007, 01:43 PM   #11
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
not desirable 'which java'

Hey there
I made javac being recognized but now i have another problem.
When i try to run a java file after compilation i get an error that indicates that the versions of javac and java are not the same

which java outputs:
/usr/lib/java/bin/java

now in my case i believe which javac should output:
/usr/local/jdk1.6.0/bin/java

Any ideas?

Dont know how to thank u for your precious help.
Manolakis
 
Old 01-21-2007, 01:48 PM   #12
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
BT ~ $ which -a java
/usr/lib/java/bin/java
/usr/local/jdk1.6.0/bin/java

I just noticed that which java with option -a outputs the above
I thougth that this could be useful

Thanks again
 
Old 01-21-2007, 01:55 PM   #13
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by manolakis
BT ~ $ which -a java
/usr/lib/java/bin/java
/usr/local/jdk1.6.0/bin/java

I just noticed that which java with option -a outputs the above
I thougth that this could be useful

Thanks again
Hello, instead of:
Code:
export PATH=$PATH:/usr/local/jdk1.6.0/bin
try
Code:
export PATH=/usr/local/jdk1.6.0/bin:$PATH
 
Old 01-21-2007, 02:07 PM   #14
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
Wink

Yeap
Finally it works.
Honestly i dont know how to thank u.
It was really nice of you.
Can i ask the last question?
What kind of programming language is that?
I mean the code in the profile & bashrc ,etc.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
bash: command not found intels_ss Linux - Newbie 5 07-20-2005 07:41 PM
-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


All times are GMT -5. The time now is 07:15 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration