2

I want to run a program, for example gedit from terminal.

How can I run gedit through terminal by just typing ge on terminal?

A.B.
  • 90,397
Dika
  • 23
  • @RaduRădeanu I don't see any question on how to edit ~/.bashrc here, that is only one of the options. – Jacob Vlijm Aug 12 '14 at 09:11
  • type 'ged' + 'Tab' key? – Wilf Aug 12 '14 at 09:12
  • 1
    @Wilf and there is another good option! – Jacob Vlijm Aug 12 '14 at 09:13
  • @JacobVlijm The question is not about how to edit ~/.bashrc as you noticed very well; the main problem is to create a custom name, an alias, for one command. – Radu Rădeanu Aug 12 '14 at 12:40
  • @RaduRădeanu Aha, I kind of agree. Surely when it comes to the title of the original question, the body however is about editing ~/.bashrc (as well as the answers there). Also the way the alias is applied in his case excludes some soulutions that would fit here. – Jacob Vlijm Aug 12 '14 at 12:54

2 Answers2

6

You can add an alias for the command. Open your terminal with ctrl+alt+t and type:

nano ~/.bashrc

Find alias section and add alias:

alias ge='gedit'

Changes will take affect in the new terminal.

  • I was read article regarding my question and found that it was temporarily. Is is possible to make it permanently ? – Dika Aug 12 '14 at 08:05
  • With alias it will work for your user permanent. To add this for all users on the system add alias to the /etc/profile – Alex Kondratiev Aug 12 '14 at 08:09
  • Will this method work on any directory folder or just on /usr/bin folder that contain application ?? – Dika Aug 13 '14 at 01:44
4

An option is to create a directory ~/bin, and make a link from there to gedit:

ln -sf /usr/bin/gedit ~/bin/ge

You can do that with any application; to find out where to link to, type:

which [applicationname]

e.g.

$ which gedit
/usr/bin/gedit
Jacob Vlijm
  • 83,767
  • N.B. if $HOME/bin is not in the users path, it won't work. – Wilf Aug 12 '14 at 09:13
  • 2
    @Wilf That is a bit faint to mention; it is practically impossible that it won't work if the user didn't specifically remove it from $PATH. By default ~/bin is in $PATH – Jacob Vlijm Aug 12 '14 at 09:15