You are not logged in.

#1 2009-05-26 22:55:47

playdafunkimuzic
Member
Registered: 2008-10-25
Posts: 220

How to create a program shortcut (command line, not icon)

Hi,

I installed a program from source, it's a biological structure modeling software. How can I make a shortcut so that I just type in the name of the program to get it to start? Thanks!

Offline

#2 2009-05-26 22:56:47

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,601
Website

Re: How to create a program shortcut (command line, not icon)

Add it to your ~/.bashrc in the path statement

Example:

PATH=$PATH:/path/to/your/app

Then close the shell and reopen it.  Now you should just need to type the name of the app in the shell and it'll run.

Alternatively can you just make an alias to it in the same file.

Example:

alias bioapp="/path/to/your/app"

Now whenever you type the word, bioapp the shell will run the /path/to/your/app command.

Last edited by graysky (2009-05-26 22:58:41)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2009-05-26 23:10:08

Peanut
Member
From: Norway
Registered: 2009-05-24
Posts: 99

Re: How to create a program shortcut (command line, not icon)

There are two ways of doing it, depending on what you want to accomplish. Both require that you edit the file ~/.bashrc (I assume you use bash)

1) If the application places all the executable files in a given directory (let's say /opt/Application/bin/), you can access all those executables directly by simply telling your shell where to look (in the same way the shell automatically looks for executable files in eg. /usr/bin). In ~/.bashrc, you would have to add a line that looks like this:

PATH="$PATH:/opt/Application/bin"

2) If you just want to make a traditional "shortcut" that executes a given command, this can be done with alias. Add this command to your ~/.bashrc:

alias shortcut="some command"

In this case, typing shortcut into a terminal will be interpreted just like if you had typed some command instead.

In order to try out these changes, either restart your terminal or run this command:

source ~/.bashrc

[EDIT]
I was obviously beaten to it tongue

Last edited by Peanut (2009-05-26 23:12:47)

Offline

#4 2009-05-26 23:16:04

playdafunkimuzic
Member
Registered: 2008-10-25
Posts: 220

Re: How to create a program shortcut (command line, not icon)

thanks!

Offline

#5 2009-05-26 23:18:47

playdafunkimuzic
Member
Registered: 2008-10-25
Posts: 220

Re: How to create a program shortcut (command line, not icon)

I went with the second option the 'alias' and everything works from terminal. I'm an openbox user using gmrun and it doesn't work from there, why is that?

Offline

#6 2009-05-26 23:34:35

Peanut
Member
From: Norway
Registered: 2009-05-24
Posts: 99

Re: How to create a program shortcut (command line, not icon)

I think you just have to re-login in order for openbox to load the new bashrc.

Offline

#7 2009-05-27 00:41:38

Chokkan
Member
Registered: 2009-04-06
Posts: 129

Re: How to create a program shortcut (command line, not icon)

I use the following alias to reload my .bashrc:

alias reload='source ~/.bashrc'


< Daenyth> tomkx: my girlfriend is linux
< Daenyth> srsly
< Daenyth> she loves the way I «make install»
< Daenyth> all her /dev entries are mode 7 for me

Offline

#8 2009-05-27 01:02:37

djnm
Member
From: USA
Registered: 2008-12-21
Posts: 78

Re: How to create a program shortcut (command line, not icon)

You can add a script to /usr/bin and gmrun will recognize that.
Also, I believe gmrun has the ability to run shell commands:

sh: command

But I am not sure on that though, check your gmrun config file for more info.


br0tat0chip in #archlinux and on freenode

Offline

#9 2009-05-27 01:04:55

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: How to create a program shortcut (command line, not icon)

To get it to work from gmrun try something like this (which will also make your alias unnecessary):

ln -s /path/to/bioapp /someplace/in/your/$PATH/bioapp

Offline

#10 2009-05-27 03:13:28

playdafunkimuzic
Member
Registered: 2008-10-25
Posts: 220

Re: How to create a program shortcut (command line, not icon)

what do you mean by "/someplace/in/your/$PATH/bioapp"

Offline

#11 2009-05-27 03:58:33

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: How to create a program shortcut (command line, not icon)

playdafunkimuzic wrote:

what do you mean by "/someplace/in/your/$PATH/bioapp"

eg # ln -s /path/to/bioapp /usr/bin/bioapp

Offline

#12 2009-05-27 09:49:59

Peanut
Member
From: Norway
Registered: 2009-05-24
Posts: 99

Re: How to create a program shortcut (command line, not icon)

playdafunkimuzic wrote:

what do you mean by "/someplace/in/your/$PATH/bioapp"

Pick one of these:

echo $PATH|sed 's/:/\n/g'

Offline

#13 2009-05-27 14:00:21

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: How to create a program shortcut (command line, not icon)

playdafunkimuzic wrote:

Hi,

I installed a program from source, it's a biological structure modeling software. How can I make a shortcut so that I just type in the name of the program to get it to start? Thanks!

A small tip. makepkg is quite handy to avoid future problems, like uninstall/upgrade. I wrap anything larger than personal scripts in arch packages. Only take a minute or two extra.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

Board footer

Powered by FluxBB