Execute programs

From LQWiki
Jump to navigation Jump to search

When a program is installed from outside a distribution's package installation routines, (such as a program that was installed with make) it is often hard to get the program to run. The following are some steps to take to determine why a program isn't running.

Check to See if it is Marked Executable

From a terminal:

  • cd to the directory that has the program you want to run
  • ls -lah program_name
  • check to see if it has an x in any of the columns

If it doesn't have the right file permissions, change the permissions so the file can be executed:

Change Permissions to be Executable if Needed

If you are the owner of the file, you can run the following command:

$ chmod u+x filename

If you are not the owner, root can set the needed privileges using g+x or o+x on it. Or, if you aren't the owner of the file, but you are the only one who uses the computer and have root access, you can use the chown command to give yourself ownership.

Check if all dependencies are satisfied

A program may refuse to run if its library dependencies are not satisfied. To find out, type

ldd program_name

Check if the program runs

Maybe the program runs and quits immediately. To find out if the program does any syscalls, use the command:

strace program_name

Execute the Program

Type in one of the following commands to the terminal:

  • ./programname
  • or /full/path/to/programname

If this doesn't work, you can go to http://linuxquestions.org and ask for help there.

Make It Easier to Execute in the Future

If you call the program from a console, you can place the directory containing the program in your path. This means that all you have to do next time you want to run the program is to type the name of the program in to a terminal and place return. There are security issues to be concerned here, though. Make sure that only programs you want to be able to run are in the directory before you added to your path.

If you run the program in a GUI, you can simply make a shortcut to it on your desktop.