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.
my netscape 7.2 is in /usr/local/netscape
everytime i have to go to that folder and type
./netscape
to launch it.
in DOS, i can create a file named
netscape.bat,
inside typed
cd /usr/local/netscape
./netscape
You don't really need a batch file (or a script in Linuxese) to do this. I'll show you two different ways.
1. Create an alias
At the command line type this:
Code:
alias netscape="cd /usr/local/netscape; ./netscape"
From that point on, you can type "netscape" at the prompt, and it will change directory and launch netscape for you. If you want to make it permanent, edit ~/.bashrc and add the line above at the end of the file. The next time you log into the system, the alias will be set up automatically.
2. Modify your PATH environment variable.
At a command line type this:
Code:
export PATH=$PATH:/usr/local/netscape
Then you can launch netscape from anywhere. The system will check /usr/local/netscape for executable files just like /bin, /usr/bin, etc. You won't even need to change directories anymore. Just type "netscape" and it'll work. Similar to the alias before, you need to modify a file to make the change permanent. Edit ~/.bash_profie, and put the export line above at the end of the file. The next time you log in, it should work.
NOTE: with both of these methods, you'll need to completely log out if you make the change permanent. Opening a new xterm won't work. If you want to be absolutely sure, reboot the machine.
Last edited by Dark_Helmet; 10-02-2005 at 04:03 AM.
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
~ is a "shortcut" that means your home directory (Probably /home/tigerlinux)
~/.bashrc is a file in your home directory where you change the settings for the shell.
$PATH is an environment variable that contains the list of directories where Linux will search for programs to execute. If you enter the command "echo $PATH", you will get an output like this "/bin:/usr/bin:/usr/X11R6/bin". This means that if you type a command, say "netscape", Linux will search /bin, then /usr/bin, the /usr/X11R6/bin for it.
The command "export PATH=$PATH:/usr/local/netscape" will add /usr/local/netscape to the end of this list.
There is another way to add netscape to your path - make a symbolic link to it in /usr/bin. This way, all users on your machine can "see" it. As root:
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
Quote:
Originally posted by TigerLinux this is the most useful
export PATH=$PATH:/usr/local/netscape
It depends on how many programs you install like this - if you install many of them, your PATH will
become unmanagebly long. It would be useful if there were several programs in the same directory,
but when there is only one a symbolic link is better.
As far as I know, the "normal" way is the symbolic link, like I mentioned above, but who needs to be normal
All the different ways of achieving the same thing all have their pros and cons in different situations.
Another approach would be to move the executable (netscape in this case) from /usr/local to /usr/local/bin. This would be the normal resting place for a system specific executable file. /usr/local/bin is normally found in the PATH variable by default. On my system no individual files are found in /usr/local; only directories are there.
ciao,
jdk
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.