Results 1 to 7 of 7

Thread: How do I launch an executable at the first line of the Terminal?

  1. #1
    Join Date
    Jun 2013
    Beans
    10

    How do I launch an executable at the first line of the Terminal?

    I have an executable named "phasor" located in this sample directory: /location/of/my/exe

    Just after starting up the Terminal (Ctrl + Alt + T) I would like to be able to type phasor and the program is launched.

    How would I set this up?

    I am familiar with moving around directories, editing files using vi, becoming root, etc etc; but I'm not sure what the steps are to set this up, any guidance would be great!

  2. #2
    Join Date
    Jun 2013
    Location
    Canada
    Beans
    136
    Distro
    Kubuntu 13.04 Raring Ringtail

    Re: How do I launch an executable at the first line of the Terminal?

    Sounds like you would like to have it in your path. Type this:
    Code:
    export PATH=$PATH:/location/of/my/exe
    If that does what you want, then you can make it permanent by adding that line to your .bashrc

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: How do I launch an executable at the first line of the Terminal?

    The easiest method is probably to create a folder called bin in your home directory and put the executable in there.
    If the ~/bin directory exists then it is automatically added to your $PATH variable meaning it gets searched every time you type in a command.

    If you want to leave the executable in its current location then you need to add this location to your $PATH. The easiest way to do this is to edit your ~/.bashrc file and add the following to the bottom...
    Code:
    export PATH=$PATH:/location/of/my/exe
    Last edited by Cheesemill; June 25th, 2013 at 06:43 PM.
    Cheesemill

  4. #4
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    1,814

    Re: How do I launch an executable at the first line of the Terminal?

    Make an alias definition and add to your .bash_aliases file:

    alias phasor=/full-path-to-program-executable/phasor

    Using your example path,

    alias phasor=/location/of/my/exe/phasor

    Then starting the terminal and typing phasor at the command prompt will run it.

  5. #5
    Join Date
    May 2007
    Beans
    12,808

    Re: How do I launch an executable at the first line of the Terminal?

    Executables in Linux are not "exe" files; instead, they are "bin" or other such files. IF this is a Windows ".exe" file, you are not going to be able to run it from a command line the way you want.
    Ubuntu 14.04, Mint 17; MS Win 8.1.
    Will not respond to PM requests for support -- use the forums.

  6. #6
    Join Date
    Jun 2013
    Beans
    10

    Re: How do I launch an executable at the first line of the Terminal?

    Quote Originally Posted by Mark Phelps View Post
    Executables in Linux are not "exe" files; instead, they are "bin" or other such files. IF this is a Windows ".exe" file, you are not going to be able to run it from a command line the way you want.

    I wrote "exe" as an abbreviation for the term executable, which now I see as being a little ambiguous. Sorry about that. But thanks for the tip! The "export PATH..." examples above worked out great!

  7. #7
    Join Date
    Jun 2013
    Beans
    10

    Re: How do I launch an executable at the first line of the Terminal?

    Quote Originally Posted by DeathByDenim View Post
    Sounds like you would like to have it in your path. Type this:
    Code:
    export PATH=$PATH:/location/of/my/exe
    If that does what you want, then you can make it permanent by adding that line to your .bashrc

    Great answer, thank you

    -M

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •