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.
Add the directory into your path, or symlink the program into an existing folder in your path.
You can add the directory to your path by editing /etc/profile.
Once you have saved, at the command line:
There is quite a few ways to do this. When you type a command, bash searches your PATH variable.
# echo $PATH
You can either put your program in one of those folders, or change your PATH to include it's current directory. Your best bet is to just cp your executable to /bin
ok, i have no idea what im looking at, other than general programming knowledge. here is my profile file:
Code:
# /etc/profile -*- Mode: shell-script -*- # (c) MandrakeSoft, Chmouel Boudjnah
<chmouel@mandrakesoft.com> loginsh=1 # Users generally won't see annoyng
core files [ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1 if ! echo ${PATH}
|grep -q /usr/X11R6/bin ; then PATH="$PATH:/usr/X11R6/bin" fi if [ "$UID" -ge 500 ]
&& ! echo ${PATH} |grep -q /usr/games ; then export PATH=$PATH:/usr/games fi
umask 022 USER=`id -un` LOGNAME=$USER MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups HOSTNAME=`/bin/hostname` HISTSIZE=1000 if [ -z
"$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then INPUTRC=/etc/inputrc fi # some old
programs still use it (eg: "man"), and it is also # required for level1 compliance for
LI18NUX2000 NLSPATH=/usr/share/locale/%l/%N export PATH PS1 USER
LOGNAME MAIL HOSTNAME INPUTRC NLSPATH export HISTCONTROL HISTSIZE
for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then . $i fi done unset i
exactly where, how, and what should be placed into this script?
Originally posted by scottman There is quite a few ways to do this. When you type a command, bash searches your PATH variable.
# echo $PATH
You can either put your program in one of those folders, or change your PATH to include it's current directory. Your best bet is to just cp your executable to /bin
ahh, cause bin is already included in path? geeze, that is quite a task. see, this is my first day using linux. i took a linux class in college about 5 years ago, but it was all book and no hands on. im assuming i can't just copy the file to run the program into bin but would have to actually move all the related files into bin as well. geeze. you say in order to copy i use the command 'cp'?
yea, see, it said, "cannot find runtime directory.." something or other. i put the executable file into bin but it cant locate the other components it needs i assume.
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
You should simply create a symbolic link to the executable in /usr/bin (/bin is for programs like ls, mv, etc):
Code:
ln -s /path/to/executable /usr/bin
This way, you are not adding extra files to a directory which is set aside for binary's. You will need to be root to do this, since you are making system wide changes.
To add a directory to your path, add the following lines to the bottom of ~/.bash_profile (For just your user)
Code:
PATH=/path/to/new/directory:$PATH
export PATH
Then run the command "source .bash_profile" and the new directory will be added to your path, and will be available each time you log in.
If you have only one executable in a directory (eg Firefox or something similar), use the symbolic link, while if you have a directory with lots of executables (eg Java Bin directory) then add it to your path.
IBall's link solution is actually better than my cp solution. This is because if the executable looks for dependant files relative to it's location it would fail (in my solution). The link would cause the executable to be executed from it's original location, preserving any directory path's. Sorry if my solution caused any problems.
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
~/ means to look in the current users home directory.
The dot in froto of .bash_profile means that it is a hidden file - means that it is not displayed unless you want it to be. do a "ls -a" to see all the hidden files in a directory. Bash has 3 config files, .bash_profile, .profile and .bashrc. You can use any one of them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.