Apparently this option is intentionally cut years ago. From the topic Creating hard links from bugzilla.gnome.org:
Almost none of our users knows the hardlink concept, so why should we
confuse him and even risk data loss? You can use
nautilus-open-terminal and create hardlinks manually.
The good news is you have two options to create this feature:
- by using Nautilus Actions or
- by using Nautilus Scripts
Solution 1: by using Nautilus Actions
1. First install the package
sudo apt update
sudo apt install nautilus-actions
Or use Ubuntu Software:
2. Run the program:
3. Go to 'Preferences' and uncheck 'Create root Nautilus Action menu':
When this option is ticked, in the context menu will have sub menu, etc.
4. Click on Define new action button and fill the data in the Action tab. As Context Label you can use
Make Hard Link, also tick only the option
Display item in selection context menu - in other words display this item when a file is selected.
5. Go to Command tab and fill the parameters:
Default profile - if there is no any custom profile.
/bin/ln - this is path to the executable file (or command).
%f 'Hard Link to %b' - click on Label button for more info.
- Working directory:
%d - means current directory.
6. Because Directory hardlinks break the filesystem in multiple ways we must disable this possibility. Go to Mimetypes tab and add a new rule:
- Mimetype filter:
Must not match any of option selected.
7. Record the action Make Hard Link:
8. Run Nautilus and use Make Hard Link action from the context menu:
Additionally, if you want to backup your settings:
- the file
$HOME/.config/nautilus-actions/nautilus-actions.conf contains Nautilus Actions preferences.
- and the new actions are places within the folder:
Solution 2: by using Nautilus Scripts
The same result can be achieved via a script, placed into
$HOME/.local/share/nautilus/scripts/. This script could looks like:
$ cat "$HOME/.local/share/nautilus/scripts/Make Hard Link"
if [[ -f "$1" ]]
ln "$1" "Hard Link to $1"
We can create this script and give to it executable permissions via the command:
ScriptNAME="$HOME/.local/share/nautilus/scripts/Make Hard Link" && \
printf '#!/bin/bash\nif [[ -f \"$1\" ]]\nthen\n\tln \"$1\" \"Hard Link to $1\"\nfi\n' |\
tee "$ScriptNAME" && chmod +x "$ScriptNAME"
The result will be: