File:// prefix on Linux and parsing of file paths

Hi. I recently migrated from Windows to Linux and have many paths to external files in the following manner ![My File](file://C:/Users/Username/Documents/file.pdf) which are now located under ![My File](file:///mnt/c/Users/Username/Documents/file.pdf).

What is the proper way to link to external files on Linux systems? I could not get the file:// prefix to work.

Second, for compatibility, parsing of existing paths file://C:/ into file:///mnt/c/ before the link opens would allow to continue to open the graph from the windows system without disruption - any idea how this could be realized?

Thank you for your reply.

1 Like

On linux, you just need to add a slash “/” which you did. But the “!” has a different meaning. In the linux version, the “!” is used to trigger an application. So by saying ![My File] linux wants to start the application [My File] that obviously does not exist.

In linux, you can just say [My File](/mnt/c/Users/Username/Documents/file.pdf)
Note well that Linux distinguishes between upper and lower case. So if your file is in /mnt/C/Users and you type /mnt/c/users it will not find it.

But [My File](file:///mnt/c/Users/Username/Documents/file.pdf) will also work.

Note that if you want to open your folder when clicking, you need to operate with file:/// because just giving the path /mnt/c/Users/Username/Documents/ will not work. Instead you need [My Folder](file:///mnt/c/Users/Username/Documents/) and if your linux is configured correctly, it opens the folder with the file manager.

1 Like

Thank you, @rigow, for your answer and highlighting the case-sensitiveness and the meaning of the exclamation mark.
Regarding the latter, how to make the difference between opening the link in/outside Logseq, see Github?

Using Logseq 0.10.9 installed via Flatpak or the official AppImage on Fedora Linux 41 (Workstation Edition) links specified in your manner do not open for me; using the file-prefix a small green arrow shows instead of the hand upon hovering over the link, but upon clicking it, nothing happens.

I always open PDFs in the external viewer. Because linux has mime-types configured. And a certain application is configured to open certain mime-types. I open all PDF with okular (KDE). If you want to open a folder within Logseq, omit the file part: “My Folder” will open the folder in logseq, not in your file manager. I prefer the filemanager (by far) because it knows about all mime-types.

Since I could not identify the reason for linked files not opening on my system, I created an issue on Github. I would appreciate any insight into the problem.