How do I start appimages from the terminal (shortcut in /usr/bin)?

I recently switched to a few appimages instead of flatpaks or packages from the official repositories like Libreoffice to improve speed. How do I integrate these manually, giving me the file in “/usr/bin” and the “open with” option every time I open a supported file to the appimage program for example?

AppImages are not installed in /usr/bin, but rather as a compressed image that is stored in your home directory, which then gets mounted via the FUSE framework. :arrow_down:

In order to have files automatically opened with a certain AppImage, you would need to create .desktop files — look for examples in /usr/share/applications — in which you invoke the AppImage with the file in question as its parameter.

Yes, I know, I have several and I use them. But I want to open them straight from the terminal or using “alt+f2” like regular installed packages.

The whole philosophy behind AppImages — as well as Snaps and FlatPaks — is that the applications in question would not be integrated with the rest of the system, and therefore, you cannot have your cake and eat it at the same time.

If you want to open an AppImage from the command line, then you’re going to have to create a script that mounts the image and runs the executable contained in the image.

can’t I make an executable named “libreoffice” in “/usr/bin” and make the script that runs the appimage?

/usr/bin would not be the place for that. You should put your scripts in ~/.local/bin instead. It’s part of your ${PATH} and will be searched for executables before /usr/bin and /usr/local/bin.

ok, I created it as “libreoffice” but it opens the text editor. if i double click it, it would actually start.

What is the content of the script?

#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Name=Libreoffice
Comment=Libreoffice
Icon=
Exec=/home/manjaro/Applications/LibreOffice-still.standard-x86_64.AppImage
Terminal=false
Categories=Libreoffice,Office,Tools

That’s not a valid script. That’s a .desktop file with a header from a shell script. :face_with_raised_eyebrow:

Remove the #!/usr/bin/env xdg-open line and then it’s a valid .desktop file, albeit that you may need to name it that too. But then that either way isn’t executable from the command line, because .desktop files are parsed by your desktop environment.

A shell script in ~/.local/bin would look something like… :arrow_down:

#!/bin/sh
exec /home/manjaro/Applications/LibreOffice-still.standard-x86_64.AppImage $1

… or at least, if that’s how an AppImage is executed. I don’t really know because I don’t use any AppImages, or for that matter, Snaps or FlatPaks. :man_shrugging:

1 Like

You’re right, I corrected it, now it works fine. Thank you

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.