linux create desktop shortcut

Take pycharm as an example:
first go to the official website to download the corresponding compressed package, then use tar zxvf xxx.tar.gz to extract it to the corresponding directory, then find the pycharm.sh file, and then create a new file in your desktop directory , edit pycharm.desktop with vim, my content is:

[Desktop Entry]
Encoding=UTF-8
Comment=Pycharm
Exec=/opt/pycharm/pycharm-2018.1.2/bin/pycharm.sh
Icon=/opt/pycharm/pycharm-2018.1.2/bin/pycharm.png
Terminal=false
Type=Application
Categories=Application;Development;

The most important one is Exec, which determines the execution command of your file, and then changes the permissions of the file, sudo chmod u+x pycharm.desktop, it becomes an executable file, and then you can use it on the desktop, However, I also encountered a problem that it cannot be executed because the user is not himself but root, then execute the command chown user file, and then change the owner, you can trust and execute

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325021979&siteId=291194637