I recommend the way Jo-Erlend Schinstad gave you. In case you want to know about the technical background, I'll give you something here.
In Linux a file like a script or a binary file that is marked as executeable can execute code. To add things like keywords, names in different languages, icons and many more things, some kind of "wrapper files" (.desktop files) are stored in folders where they are searched for and then automatically are displayed in launchers etc. To find out where to store them so launchers find them by themselves, see here: Where are the Unity Launcher .desktop files?
They are basically just text files with a special syntax. Alacarte (and some other apps in the ubuntu store) can create them or you write/edit them yourself. To find out more about them, you can just search here on askubuntu.
A small example from an answer I found here:
[Desktop Entry]
Encoding=UTF-8
Terminal=0
Exec=/home/pierre/Desktop/XnViewMP/xnview.sh
Icon=/home/pierre/Desktop/XnViewMP/xnview.png
Type=Application
Categories=Graphics;
StartupNotify=true
Name=XnView Multi Platform
GenericName=XnViewMP
How to make a launcher(.desktop file) for a binary file?
Also, .desktop files offer some Unity features. The steam.desktop is a good example for this:
[Desktop Entry]
Name=Steam
Comment=Application for managing and playing games on Steam
Exec=/usr/bin/steam %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;FileTransfer;Game;
MimeType=x-scheme-handler/steam;
Actions=Store;Community;Library;Servers;Screenshots;News;Settings;BigPicture;Friends;
[Desktop Action Store]
Name=Store
Name[de]=Shop
Name[es]=Tienda
Name[fr]=Magasin
Name[it]=Negozio
Name[pt]=Loja
Name[ru]=Магазин
Name[zh_CN]=商店
Name[zh_TW]=商店
Exec=steam steam://store
[Desktop Action Community]
Name=Community
Name[es]=Comunidad
Name[fr]=Communauté
Name[it]=Comunità
Name[pt]=Comunidade
Name[ru]=Сообщество
Name[zh_CN]=社区
Name[zh_TW]=社群
Exec=steam steam://url/SteamIDControlPage
[Desktop Action Library]
Name=Library
Name[de]=Bibliothek
Name[es]=Biblioteca
Name[fr]=Bibliothèque
Name[it]=Libreria
Name[pt]=Biblioteca
Name[ru]=Библиотека
Name[zh_CN]=库
Name[zh_TW]=遊戲庫
Exec=steam steam://open/games
[Desktop Action Servers]
Name=Servers
Name[de]=Server
Name[es]=Servidores
Name[fr]=Serveurs
Name[it]=Server
Name[pt]=Servidores
Name[ru]=Серверы
Name[zh_CN]=服务器
Name[zh_TW]=伺服器
Exec=steam steam://open/servers
[Desktop Action Screenshots]
Name=Screenshots
Name[es]=Capturas
Name[fr]=Captures d'écran
Name[it]=Screenshot
Name[ru]=Скриншоты
Name[zh_CN]=截图
Name[zh_TW]=螢幕擷圖
Exec=steam steam://open/screenshots
[Desktop Action News]
Name=News
Name[de]=Neuigkeiten
Name[es]=Noticias
Name[fr]=Actualités
Name[it]=Notizie
Name[pt]=Notícias
Name[ru]=Новости
Name[zh_CN]=新闻
Name[zh_TW]=新聞
Exec=steam steam://open/news
[Desktop Action Settings]
Name=Settings
Name[de]=Einstellungen
Name[es]=Parámetros
Name[fr]=Paramètres
Name[it]=Impostazioni
Name[pt]=Configurações
Name[ru]=Настройки
Name[zh_CN]=设置
Name[zh_TW]=設定
Exec=steam steam://open/settings
[Desktop Action BigPicture]
Name=Big Picture
Exec=steam steam://open/bigpicture
[Desktop Action Friends]
Name=Friends
Name[de]=Freunde
Name[es]=Amigos
Name[fr]=Amis
Name[it]=Amici
Name[pt]=Amigos
Name[ru]=Друзья
Name[zh_CN]=好友
Name[zh_TW]=好友
Exec=steam steam://open/friends
This file is stored in /usr/share/applications/steam.desktop when Steam is installed.
./
in front of your script tochmod
, you only need that if you are running it from its directory..
stands for the current directory. So./pycharm.sh
just means "the file 'pycharm.sh' in the directory I'm in at the moment". Most tools look in the current directory unless you tell them otherwise, so withchmod
you can ommit the./
. It's different when you execute a file. To find the binary you want to execute, the shell searches in the directories noted in your PATH variable. Otherwise, you'd have to do something like/bin/chmod +x pycharm.sh
or/usr/bin/apt-get update
all the time. For security reasons, the current directory isn't included in your PATH by default.