System utilities such as ls
don't need to have the full path typed before executing them. However, to execute Netbeans, I have to type /home/chris/netbeans-7.0.1/bin/netbeans
. How can I make it so that I only have to type netbeans
?
Asked
Active
Viewed 1.3k times
5

Casebash
- 5,789
3 Answers
8
An easy way is to place a link in /usr/local/bin:
sudo ln -s -T /home/chris/netbeans-7.0.1/bin/netbeans /usr/local/bin/netbeans
after that you can execute netbeans with:
netbeans &

Michael K
- 13,888
4
You can add an alias
Open Terminal Ctrl+Alt+T
nano ~/.bashrc
write this at the bottom of the file:
alias netbeans='/home/chris/netbeans-7.0.1/bin/netbeans'
Ctrl + x
Y
Enter
The netbeans word is the command you will use to start the program, you can change it to whatever you need. Inside the quotes is the command you want to run when netbeans alias is called.
In order this command to be active you have to re-open the Terminal, or type
. ~/.bashrc

Ivan Dokov
- 792
-1
- go to the program directory.
- open the terminal using ctrl+alt+T.
- Drag and drop the program file to the terminal windows.
- Hit enter on the terminal windows.
-
-
If someone is trying to avoid typing in the path to his program, is going to the program directory in the file manager, and then doing all the things you describe, going to be better? – Chan-Ho Suh Feb 16 '12 at 07:18
-
that's why I told to create a desktop shortcut... desktop shortcut does the same thing in terminal. Then he can take the advantage of seeing program errors in terminal without typing the full path!! – Chathura Widanage Feb 16 '12 at 07:21
/usr/local/bin/netbeans
already exists and is a directory, without-T
would create a the link inside the given directory with the same base name as the linked file. With the-T
in such a situation it should give an error. – enzotib Feb 16 '12 at 08:02mkdir -p ~/bin && ln -s ~/netbeans-7.0.1/bin/netbeans ~/bin
. If ~/bin exists, it will be added to your PATH. This happens during login though, so if ~/bin did not already exist, you need to log out and back in for the new command to be available. – geirha Feb 20 '12 at 06:19