12

In Ubuntu, you can mark certain applications as your favorite, and in the file explorer, you can drag folders to the left sidebar. But I can't seem to add a bookmark for a specific file, nor can I set a file to open from the Ubuntu dock at the left of the screen.

What is a good option to have a document in a place where you will remember its importance on a frequent basis?

pomsky
  • 68,507
Jack Pan
  • 253
  • 1
    Put a link to it in your desktop or home directory? – muru Aug 20 '18 at 03:07
  • 1
    @muru That's probably as good as an answer. – Sergiy Kolodyazhnyy Aug 20 '18 at 03:45
  • 2
    @MaxLi Btw, "best way" is highly subjective, so you might want to edit your answer to state specifically what are your needs. Do you want the file to be on the dock ? In nautilus file manager panel ? In the top panel ? Maybe on desktop, as muru suggested ? – Sergiy Kolodyazhnyy Aug 20 '18 at 03:46
  • Something similar: I have a number of files and folders whose locations I frequently forget. I created a Links directory in my home directory and put symlinks in it to things I have trouble finding. – Joe Aug 23 '18 at 04:37

2 Answers2

18

Instead of pinning a file, let's switch gears: pin a command that opens the file. That's easily achieved via creating a .desktop file, which is what those icons on the dock actually are. Sufficient enough would be to have file in ~/.local/share/applications/ called importantfile.desktop and with contents maybe like so:

[Desktop Entry]
Type=Application
Terminal=false
Exec=gedit /etc/passwd
Name=Open Important Thing
Icon=/usr/share/icons/gnome/48x48/status/messagebox_critical.png

The Icon= part is optional, but as you can see you can use standard gnome icons. Remember also to use your own favorite program to open the important file - Exec=gedit /etc/passwd is just an example.

Alternative (and a very biased solution, as I am the author of that) is to use Files Indicator, which besides other things allows pinning specific files to be shown in the indicator itself and are opened by whatever default program is set for their respective filetypes.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • 1
    Perhaps adding something like the following before the last paragraph would be nice for completion (for Ubuntu 17.10 and later with GNOME 3): Then you would be able to search and find "*Open Important Thing*" in *Activities* overview and then pin it to the dock by right-clicking and selecting "Add to Favourites". – pomsky Aug 22 '18 at 09:33
  • 2
    Also xdg-open or something similar in place of gedit in the Exec= line? – pomsky Aug 22 '18 at 10:10
  • @pomsky Yes, xdg-open can work, but for some files that aren't in database it's just easier to use specific app. But yes, good point – Sergiy Kolodyazhnyy Aug 23 '18 at 04:35
9

An alternative for simpler files is to use Nautilus file manager to create a link and move it to the desktop.

For your word processing, spreadsheet and presentation documents you can navigate using Nautilus to the directory containing the file. Then right click on the the file and select Make Link a new icon appears called Link to filename. Grab this and drag it to your desktop.

Below is an animation for a word processing document called eyesome.odt and a desktop link created for it:

make link.gif

After the link is dragged to the desktop, simply double click on it and the application associated with it automatically opens it.


Keyboard shortcut method Ctrl+Shift+Left-Click

A quicker method is to use Ctrl+Shift+Left-Click on the file and drag a copy to the desktop.

The subtle difference is the Desktop name is no longer "Link to filename" but simply "filename".