21

I have just recently installed Light Table downloading it from the git repository, and followed the instructions on this website to create a desktop launcher.

Now I want to run the program by directly typing in the terminal

LightTable

and not

./opt/LightTable/deploy/LightTable
Seth
  • 59,332
dapias
  • 397

6 Answers6

26

This can be crudely accomplished with an alias. You can create a permanent bash alias by adding a single line to your .bashrc file.

In the terminal run nano ~/.bashrc

Add the the following line at the bottom:

alias LightTable='/full/path/opt/LightTable/deploy/LightTable'

notice I added thee full path instead of the . so this will work in any working directory. Close and reopen the terminal or run source ~/.bashrc to reload the bashrc file.

Dan
  • 6,784
9

This isn't an elementary question, the best way to do this is to make an alias, Ill use netbeans as an example

Open Terminal Ctrl+Alt+T

nano ~/.bashrc

write this at the bottom of the file:

alias netbeans='/home/john/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

Johnn
  • 492
5

You can try to copy the executable to /usr/bin if its a simple executable program and doesn't depend on any other file. if it does depend of other files, the best to do is create a shortcut command to the program.

Where you create the alias is by yourself (.bashrc, .profile, etc). However I personally let all my enviroment variables in my .bash_aliases file (you need to create it at first stance).

Create the file .bash_aliases in your HOME folder and edit it anyway you like. Then to create the shortcut, you can do:

alias LightTable='path_to_opt/LightTable/deploy/LightTable'

Save the file and that's it.

ps: you can also put the alias as lighttable and LIGHTTABLE in case forget to uppercase the L or if capslock is active by accident, so you don't have to type the command again.

Geo
  • 1,315
3

I'm not sure why other answerers have not suggested this, but as the OP actually pointed out, prepending to the $PATH variable would have been the way I would have achieved this:

echo 'PATH=/opt/LightTable/deploy:$PATH' >> ~/.bash_profile
source ~/.bash_profile

Then run with:

LightTable
JoeNyland
  • 129
2

Better to create a symbolic link than an alias I think. An alias might make substitutions on your command line when you didn't want one; creating a symlink will allow you to run the program as you want:

sudo ln -s full_path_to_opt/LightTable/deploy/LightTable  /usr/local/bin

This will create a shortcut in /usr/local/bin (which should be in your PATH already!) to where LightTable actually is. Note also that you can rename the symlink as well if you don't like the capital letters in "LightTable":

sudo ln -s full_path_to_opt/LightTable/deploy/LightTable  /usr/local/bin/lighttable

Just for reference, if the program is awkwardly designed, i.e. complains about not finding configuration files or libraries or whatever, then another solution that might be more useful is creating a wrapper script. To do this just create a file (wherever you like for the time being) called "LightTable" (or whatever else you like) with this in it:

#!/bin/sh
# Simple script to run LightTable
if ! cd full_path_to_opt/LightTable/deploy/LightTable ; then
    echo "$0: error: LightTable directory not found." >&2
    exit 1
fi
exec ./LightTable

Change the permissions of this file:

chmod 755 <wrapper_script>

and try executing it just to see if it works, and if so then move it to /usr/local/bin:

sudo mv -i <wrapper_script> /usr/local/bin
Zorawar
  • 121
0

I tried to do this , when I started in Ubuntu. When you put LightTable in terminal It searches for a file named LightTable in $PATH directories. you can put echo $PATH to get the directories.

If you want to execute your LightTable program in ./opt/LightTable/deploy/LightTable, then what you have to do is, place your Light Table file in /usr/games or /usr/bin. But that requires Super User Permissions

open the terminal by Ctrl+Alt+T

then put

I prefer to create a shortcut of LightTable using

sudo ln -s path/to/LightTable  /usr/games/LightTable

Then put the SU password. Then, you can access your program by using LightTable in the terminal

You can put /usr/bin or /usr/local/bin instead of /usr/games, anything that is a $PATH directory, It doesn't need to be like that, but I recommend you to place it in /usr/local/bin

I also recommend you to change the output file as lightpath instead of LightPath