LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 11-08-2005, 08:51 AM   #1
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Rep: Reputation: 15
"global commands" in linux


Hi guys, back to the newbie forum I come

I've done a search but I can't come up with the answer, probably because I don't know what exactly to be searching for.

I want to know how I can make a program name 'global' so I can call it from any directory instead of where the program resides, I suspect its going to be making a symbolic link to somewhere but I don't know where.

E.g. To use azureus I have to go 'cd /usr/local/bin/azureus then ./azureus'
to run firefox I have to type 'firefox' and away it goes.

While we're at it, any way to put this program into the applications menu?

Running SuSe 10, thanks guys.
 
Old 11-08-2005, 09:04 AM   #2
jmr71769
Member
 
Registered: Jun 2003
Location: East Coast, USA
Distribution: Gentoo, Debian, Slack, FreeBSD
Posts: 82

Rep: Reputation: 15
WTF?

Eh, so I take it you build a lot from source? I don't understand what's all the cd'ing for. Even then, I don't understand why you have to cd to /usr/local/src to run something. If you finish your compile with 'make install', and your path is correct, you should be able to run everything without having to cd.

What's up!
 
Old 11-08-2005, 09:05 AM   #3
ashamril
Member
 
Registered: Jan 2003
Location: cyberjaya
Distribution: rh mdk deb fed suse
Posts: 99

Rep: Reputation: 15
put your program in your path.
$ echo $PATH
 
Old 11-08-2005, 09:10 AM   #4
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
Re: "global commands" in linux

Quote:
Originally posted by Peleus
I want to know how I can make a program name 'global' so I can call it from any directory instead of where the program resides, I suspect its going to be making a symbolic link to somewhere but I don't know where.

E.g. To use azureus I have to go 'cd /usr/local/bin/azureus then ./azureus'
to run firefox I have to type 'firefox' and away it goes.
What you are looking for in the PATH environment variable. Open a shell and type
Code:
echo $PATH
to see which directories are searched for the command you type (what you refer to as being 'global').
Assuming you use bash - find out this way:
Code:
blindcoder@ceres:~$ echo $SHELL
/bin/bash
you can add /usr/local/bin by adding the following line to the file ~/.bashrc
Code:
PATH="$PATH:/usr/local/bin"
Quote:

While we're at it, any way to put this program into the applications menu?

Running SuSe 10, thanks guys.
With KDE it should be in the ControlCenter. There should be an option "Menu Editor" or something like that. There you can add each and any items to the menu and remove others.

HTH,
Benjamin
 
Old 11-08-2005, 09:26 AM   #5
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Ok, in regards to how I installed it, I decided that I'm putting my programs into /usr/local/bin because I read somewhere thats where people put them a lot of the time, probably wrong but either way it shouldn't hurt anything.

Now correct me if I'm wrong but with azureus you mearly download then untar it, which produces the program azureus which you just run with ./azureus, no need to make install etc to get the right path.

Since I have absolutely no idea what I'm doing with path can someone please fill me in with what the correct command exactly?

P.s. output of linux:~ # echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/opt/gnome/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin


my azureus program and files is located in /usr/local/bin.

Last edited by Peleus; 11-08-2005 at 09:28 AM.
 
Old 11-08-2005, 09:33 AM   #6
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
Quote:
Originally posted by Peleus

P.s. output of linux:~ # echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/opt/gnome/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin

my azureus program and files is located in /usr/local/bin.
That should work...
Now, can you do this and post the whole output here:
Code:
linux:~ # azureus
IE, start azureus not from the /usr/local/bin directory but from somewhere else.

Greetings,
Benjamin
 
Old 11-08-2005, 09:38 AM   #7
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
peleus@linux:~> azureus
bash: azureus: command not found

linux:~ # azureus
-bash: azureus: command not found

(Both normal user and root same result)

On another note if I type in az "TAB" it comes up with azureus so I think there is some type of recognition there?

Last edited by Peleus; 11-08-2005 at 09:40 AM.
 
Old 11-08-2005, 09:39 AM   #8
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
Quote:
Originally posted by Peleus
peleus@linux:~> azureus
bash: azureus: command not found
Okay, this is definately strange. I need a bit more information from these commands:
Code:
which azureus
type azureus
ls -l /usr/local/bin/azureus
 
Old 11-08-2005, 09:42 AM   #9
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
linux:~ # which azureus (No visible result)
linux:~ # type azureus
-bash: type: azureus: not found
linux:~ # ls -l /usr/local/bin/azureus/
total 14273
drwxrwxrwx 3 root 48 856 Nov 8 19:11 .
drwxr-xr-x 4 root root 112 Nov 9 01:31 ..
-rw-r--r-- 1 root 48 16722 Nov 1 2004 Azureus.png
-rw-r--r-- 1 root 48 11235 Nov 1 2004 Azureus.torrent.png
-rw-rw-r-- 1 root 48 5790827 Jun 27 22:32 Azureus2.jar
-rw-r--r-- 1 peleus users 6746754 Nov 8 19:09 Azureus_2.3.0.4_linux.GTK.tar.bz2
-rw-r--r-- 1 root 48 55117 Jun 27 22:32 ChangeLog.txt
-rw-r--r-- 1 root 48 17719 May 24 2004 License.txt
-rw-r--r-- 1 root 48 456 Nov 22 2004 README.txt
-rwxr-xr-x 1 root 48 3177 Jun 15 21:43 azureus
-rw-rw-r-- 1 root 48 15048 Sep 24 2004 cpl-v10.html
-rw-rw-r-- 1 root 48 26432 Sep 24 2004 lgpl-v21.txt
-rwxr-xr-x 1 root 48 31895 Sep 24 2004 libswt-atk-gtk-3106.so
-rwxr-xr-x 1 root 48 6607 Sep 24 2004 libswt-awt-gtk-3106.so
-rwxr-xr-x 1 root 48 14169 Sep 24 2004 libswt-gnome-gtk-3106.so
-rwxr-xr-x 1 root 48 207030 Sep 24 2004 libswt-gtk-3106.so
-rwxr-xr-x 1 root 48 28712 Sep 24 2004 libswt-kde-gtk-3106.so
-rwxr-xr-x 1 root 48 125467 Sep 24 2004 libswt-mozilla-gtk-3106.so
-rwxr-xr-x 1 root 48 358820 Sep 24 2004 libswt-pi-gtk-3106.so
-rw-rw-r-- 1 root 48 25755 Sep 24 2004 mpl-v11.txt
drwxr-xr-x 4 root root 112 Dec 19 2004 plugins
-rw-rw-r-- 1 root 48 3455 Sep 24 2004 swt-about.html
-rw-rw-r-- 1 root 48 79721 Sep 24 2004 swt-mozilla.jar
-rw-rw-r-- 1 root 48 54118 Sep 24 2004 swt-pi.jar
-rw-rw-r-- 1 root 48 937275 Sep 24 2004 swt.jar
 
Old 11-08-2005, 09:49 AM   #10
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
okay, here we go.
/usr/local/bin/azureus is not a program but a directory. I suggest doing the following:
Install Azureus to /opt/azureus. Then create the following symlink:
Code:
ln -sf . /opt/azureus/bin
After you logout and login again you should be able to run azureus without having to cd to the path.
What happens:
/opt/*/bin are automatically added to the PATH environment variable which is searched by your shell for programs. By having azureus in /opt/azureus and creating the symlink from /opt/azureus/bin to /opt/azureus the name /opt/azureus/bin/azureus will point to the executable program /opt/azureus/azureus.


HTH,
Benjamin
 
Old 11-08-2005, 09:55 AM   #11
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Firstly I'd like to say thanks for your help you're being awesome.

Secondly I tried without any success.

Firstly I moved /usr/local/bin/azureus to /opt/azureus

I then created the symlink cut and pasting the command you said, now the output when I type is
peleus@linux:~> azureus
bash: /usr/bin/azureus: Permission denied

Was the symlink ment to be for /opt/azureus/bin though because all my azureus files are in that azureus folder, none in bin, you probably did say the right command but thought I would double check.

linux:/usr/bin # ls -l "azureus"
-rw-r--r-- 1 peleus users 75 Nov 9 01:20 azureus

if that helps.

Last edited by Peleus; 11-08-2005 at 10:02 AM.
 
Old 11-08-2005, 10:02 AM   #12
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
Quote:
Originally posted by Peleus
Firstly I'd like to say thanks for your help you're being awesome.
Thanks, I need that from time to time

Quote:

Secondly I tried without any success.

Firstly I moved /usr/local/bin/azureus to /opt/azureus

I then created the symlink cut and pasting the command you said, now the output when I type is
peleus@linux:~> azureus
bash: /usr/bin/azureus: Permission denied

Was the symlink ment to be for /opt/azureus/bin though because all my azureus files are in that azureus folder, none in bin, you probably did say the right command but thought I would double check.
Okay, what we have here is another problem.
There seems to exist a file/directory /usr/bin/azureus, possibly from your Distribution or an older azureus installation.
You said you use SuSE, so I suggest checking with YaST and possibly deinstalling the older version.
Please also paste the output from
Code:
ls -l /opt/azureus
Then I can tell you if the symlink is correct.


Greetings,
Benjamin
 
Old 11-08-2005, 10:09 AM   #13
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Ok, well firstly in regards to the old install as far as I can tell there never has been any install on the system. If I go yast > software management and search for azureus no results come up. This is a fresh install from today and I know that I haven't put any previous installation on.

In regards to the output,

peleus@linux:~> ls -l /opt/azureus/
total 14272
-rwxr-xr-x 1 root 48 3177 2005-06-15 21:43 azureus
-rw-r--r-- 1 peleus users 6746754 2005-11-08 19:09 Azureus_2.3.0.4_linux.GTK.tar.bz2
-rw-rw-r-- 1 root 48 5790827 2005-06-27 22:32 Azureus2.jar
-rw-r--r-- 1 root 48 16722 2004-11-01 19:27 Azureus.png
-rw-r--r-- 1 root 48 11235 2004-11-01 19:27 Azureus.torrent.png
lrwxrwxrwx 1 root root 1 2005-11-09 01:51 bin -> .
-rw-r--r-- 1 root 48 55117 2005-06-27 22:32 ChangeLog.txt
-rw-rw-r-- 1 root 48 15048 2004-09-24 23:32 cpl-v10.html
-rw-rw-r-- 1 root 48 26432 2004-09-24 23:32 lgpl-v21.txt
-rwxr-xr-x 1 root 48 31895 2004-09-24 23:32 libswt-atk-gtk-3106.so
-rwxr-xr-x 1 root 48 6607 2004-09-24 23:32 libswt-awt-gtk-3106.so
-rwxr-xr-x 1 root 48 14169 2004-09-24 23:32 libswt-gnome-gtk-3106.so
-rwxr-xr-x 1 root 48 207030 2004-09-24 23:32 libswt-gtk-3106.so
-rwxr-xr-x 1 root 48 28712 2004-09-24 23:32 libswt-kde-gtk-3106.so
-rwxr-xr-x 1 root 48 125467 2004-09-24 23:32 libswt-mozilla-gtk-3106.so
-rwxr-xr-x 1 root 48 358820 2004-09-24 23:32 libswt-pi-gtk-3106.so
-rw-r--r-- 1 root 48 17719 2004-05-24 08:31 License.txt
-rw-rw-r-- 1 root 48 25755 2004-09-24 23:32 mpl-v11.txt
drwxr-xr-x 4 root root 112 2004-12-19 10:56 plugins
-rw-r--r-- 1 root 48 456 2004-11-22 02:22 README.txt
-rw-rw-r-- 1 root 48 3455 2004-09-24 23:32 swt-about.html
-rw-rw-r-- 1 root 48 937275 2004-09-24 23:32 swt.jar
-rw-rw-r-- 1 root 48 79721 2004-09-24 23:32 swt-mozilla.jar
-rw-rw-r-- 1 root 48 54118 2004-09-24 23:32 swt-pi.jar

Thanks again
 
Old 11-08-2005, 10:14 AM   #14
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
Quote:
Originally posted by Peleus
Ok, well firstly in regards to the old install as far as I can tell there never has been any install on the system. If I go yast > software management and search for azureus no results come up. This is a fresh install from today and I know that I haven't put any previous installation on.
Okay, in that case it should be safe to just delete /usr/bin/azureus. Maybe you should just move it somewhere else first to check if everything still runs and then delete it.

Quote:

In regards to the output,

peleus@linux:~> ls -l /opt/azureus/
lrwxrwxrwx 1 root root 1 2005-11-09 01:51 bin -> .
Perfect
 
Old 11-08-2005, 10:21 AM   #15
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
You know what I'm going to say don't you

peleus@linux:~> azureus
bash: azureus: command not found

Thats after I deleted azureus from /usr/bin

Out of intrest once we get this working is it going to be a universal process for all these programs assuming I install them in /opt/?

Thanks mate
 
  


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
commands "init" and "modprobe" not working Diagmato Fedora 2 07-23-2005 12:44 AM
what is difference between "reset" and "clean " commands? zameer_india Linux - Newbie 2 01-10-2005 07:23 AM
"depmod" and "modprobe" commands don't work The1PatO Fedora 7 06-10-2004 01:10 PM
gnome global settings "Help Me!!" or "URGENT" Fascistchicken Linux - Software 3 01-26-2004 07:27 PM
Module usage :Global symbol "$ref" requires explicit package name rajatgarg Programming 2 12-17-2003 02:55 AM


All times are GMT -5. The time now is 03:58 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration