How do you find out the 'Command' for custom KB shortcuts?

I want to add a few custom shortcuts, for example, I want custom key combo for deleting things. I know how to create the shortcut but I don’t know what to enter in the ‘Command’ field. Does anyone know what the Delete command is (I tried Delete and didn’t work!)?

1 Like
# Remove
rm -f -R "/path/to/dir_or_file"

# Move to trash
gio trash -f "/path/to/dir_or_file"

There’s a rabbit hole here. The reason I say this is because if are you looking for permanent deletion? As in you are absolutely sure you do not want that file ever? This is possible, but would require you to write a script. Also, the Files System ( BTRFS if you have a standard install fo Fedora ) & Encryption with Luks both come into play some here as well.

Tools like shred , dd , and custom tooling are all feasible, but the understanding of how Luks & BTRFS work is necessary for file deletion. There are a couple things I can share but I would need to know more of what you are trying to achieve.

But. . . don’t you think this is akin to pressing Delete on the keyboard ? That in and of itself is a shortcut.

Plus,Shift + Delete deletes files directly, without involving Trash.

1 Like

So like unlink in what I call “The Graveyard of our Digital world”.

Which brings me back to my previous post, If the usecase if File deletion, then sure pressing Delete on the keyboard would do this. If it’s file shredding, it’s a different solution which with journaling File Systems and Encrytion is a different solution.

If you’re setting your custom shortcuts using GNOME, via Settings->Keyboard->Keyboard Shortcuts->Custom Shortcuts, I have noticed that relative paths don’t work, only absolute ones.

E.g. mkdir ~/Downloads/testdir didn’t work, but mkdir /home/mike/Downloads/testdir did.

1 Like

Did you try environment variables? e.g. $HOME/Downloads/testdir.

For some reason, environment variables aren’t accepted (read don’t work) either.

You are confusing relative paths with special characters.
Relative paths work as usual relative to your home directory:

mkdir -p 1

Special characters and variables can be expanded like this:

sh -c 'mkdir -p ~/2 ${HOME}/3'

You’re right, thanks. I was just expecting that the same simple commands working in terminal would work as such in the Set Custom Shortcut setup as well.

I confirm that relative paths to the home directory work, so that my previous example should have been mkdir -p Downloads/testdir.

1 Like

It could be useful to automate some task or work around a specific problem.

Sorry, no clue what to do with that.

Hiya HC, thanks.
I see your point. Does it simplify if I explain more?..

My Dell laptop has a backspace, and a Delete key on top row after function keys, like most laptops have these days. The Delete key is the one I have to press if I want to delete a file in Files, or an email in Thunderbird, or most other deletion tasks.

(And yes, I should have said, not permanently (i.e. skip trash), just a normal Delete (moving to trash in case of files, or deleted items in case of Thunderbird)

I merely want to make a key combo (ctrl-backspace) to perform that same function. In case it’s easier, if there were a way to do so I would be happy to just swap/map the Delete key functionality to ctrl-backspace.

So, you are basically doing this :

Which is safer than a solution using rm or unlink

In hindsight, what you are asking for is actually to remap Delete to a new shortcut Ctrl + Backspace ? :thinking:

There are different methods with their own pros and cons.

Nautilus scripts


tee ~/.config/nautilus/scripts-accels << "EOF" > /dev/null
<Control>BackSpace trash
tee ~/.local/share/nautilus/scripts/trash << "EOF" > /dev/null
then while read -r SELECTED_URI
do gio trash -f "${SELECTED_URI}"
chmod +x ~/.local/share/nautilus/scripts/trash
nautilus -q


  • The mapping will only work for Nautilus.
  • The built-in Undo action is not possible for this operation.
  • The Trash action will fail if the filesystem doesn’t support it.


Custom shortcuts and ydotool


sh -c "sleep .2; ydotool key 111:1 111:0"


  • The mapping will work globally for all apps in the GNOME session.
  • The original function for Ctrl+Backspace will be replaced by the new one.
  • The selection must not be changed within the specified time interval, otherwise the shortcut applies to the latest selection.
  • The Ctrl modifier must be released within the specified time interval, otherwise it triggers the Ctrl+Delete shortcut that has a different function.


I am scratching my head here. The quote you cited makes no sense to me.

Yes, well, almost. I don’t want to replace the Delete key function (if that’s what ‘mapping’ means). I’d say ‘I want to COPY the functionality of Delete key to ctrl-backspace, so I have both options to delete files/emails’.

I was hoping there might be some sort of utility or custom ‘Tweak’ I can use to do it, but couldn’t find it in Tweaks. I just want to be able use keystroke CTRL-Backspace to DO what ‘Delete’ key does, hope that explains it!

1 Like

Added gnome, keyboard-shortcuts, workstation