1

How can I set alias for gnome-calculator so I can launch it just by typing calc. And how can I create my own command for my own application?

I need it to work in this command prompt: Command prompt

I know that in Windows it's by creating shortcut in C:\Windows directory.

0
1

To create an alias, in most shells you would run the alias command. Example:

$ alias calc='gnome-calulator'

To make this permament across login sessions, put this in your shell startup files - for the bash shell, that would be with .bash_profile or .bashrc in your home directory. This will let you create any alias for any command, but you should be careful to not create aliases that already exist as different commands.

3
  • Thanks for your answer! I've tried that it works well in terminal but I'd like to use it in command prompt (I've added an image of it to my question). Sorry I though that it would work everywhere. I didn't know that there is lot of shells and I need to set it separatelly for them. So in which file I should write this to make it work in command prompt as shown in image?
    – sczdavos
    Mar 24 '15 at 18:06
  • Doesn't works with Alt+F2 in gnome.
    – A.B.
    Mar 24 '15 at 18:24
  • 2
    @sczdavos - run mkdir ~/bin; cp /usr/bin/gnome-calculator ~/bin/calc then add bin to your PATH e.g. you should have: PATH=$PATH:$HOME/bin in your ~/.profile. You should then be able to Alt+F2 then calc to run gnome-calculator Mar 24 '15 at 21:05
0

This won't work with Alt-F2 — don_crissti's comment covers that — but you can actually just hit the Windows key to bring up the overview and start typing c a l c ... and hit enter when the calculator is the top result. For me, that's actually after just c a . (It'll depend on what you have installed, and I think how often you use various apps.)

You can also right click on that icon and hit "add to favorites" to make it show on the dash, if you want.

Note also that GNOME Calculator has its own search provider. Try just typing a simple math problem into the search box directly — it'll show the results. For simple things, that might remove the need to actually run calc at all.

If you want to create a new launcher that will show up in this way, create a new .desktop file and put it in the folder ~/.local/share/applications. The spec for these files is the [freedesktop.org Desktop Entry Specification http://standards.freedesktop.org/desktop-entry-spec/latest/], and from that document, an example might be:

[Desktop Entry]
Version=1.0
Type=Application
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
TryExec=fooview
Exec=fooview %F
Icon=fooview
MimeType=image/x-foo;
Actions=Gallery;Create;

Anything in the name, comment, or command will show up in the Overview search.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.