Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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).
# /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
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?
# /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
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).
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.
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?
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.