Bookmark Terminal Commands And Easily Retrieve Them Using Marker

Marker command bookmark manager

Marker is a command bookmark manager for the console. The tool lets you bookmark commands and command templates, and easily retrieve them using a real-time fuzzy matcher.

Marker, which is described as a command palette for the terminal by its developer, includes a list of common commands for Linux and macOS, and requires Bash 4.3+ or Zshell, and Python 2.7+ or 3.0+ to run.

This is a demo gif from the program's GitHub project page:

Marker commands bookmark manager for console

The tool is useful to remember commands used previously, which is like going through your Bash history but better since you can add descriptions for each bookmark (and add placeholders), as well as to save some commands you come across, for future use. Your command bookmarks are saved in a text file located in ~/.local/share/marker/.

Marker features include:

  • Real-time fuzzy matcher for commands and descriptions, with a UI selector to easily choose the desired command if more than one is presented
  • Command template: You can bookmark commands with placeholders and quickly place the cursor at those placeholders using a keyboard shortcut
  • Includes common commands for Linux and macOS from the tldr project
  • Keyboard shortcuts: Ctrl + space to search for commands, Ctrl + k to bookmark a command, and Ctrl + t to place the cursor at the next placeholder, identified by '{{anything}}', to fill out the command - these are customizable

The default key binding for opening the command palette, Ctrl + space, seems to have issues on some systems. On my Ubuntu 18.04 desktop, trying to use this key combination resulted in a -bash: bash_execute_unix_command: cannot find keymap for command error.

The fix for this lies in the customizable key bindings ability. MARKER_KEY_GET, MARKER_KEY_MARK and MARKER_KEY_NEXT_PLACEHOLDER can be set as environment variables in order to change the Marker key bindings (I'll explain how to do this after the installation instructions).

How to install Marker


Marker doesn't have any releases and to install it, you'll need to get the latest code from Git. You can install Git in Debian, Ubuntu and Linux Mint using:

sudo apt install git

Now you can get the Marker code and install it using these commands:

git clone --depth=1 https://github.com/pindexis/marker ~/.marker 

~/.marker/install.py

You'll also need to source Marker in your ~/.bashrc file - open ~/.bashrc with a text editor and at the bottom of the file, paste the following:

[[ -s "$HOME/.local/share/marker/marker.sh" ]] && source "$HOME/.local/share/marker/marker.sh"

Save the file and source ~/.bashrc using this command:

. ~/.bashrc

In case the Ctrl + space keyboard shortcut (which should open the command palette) doesn't work for you, change its keybinding. Open ~/.bashrc with a text editor and add the following line ABOVE the line in which Marker was sourced:

export MARKER_KEY_GET='\C-^'

This is for using Ctrl + ^ (6) as the keybinding, but you can change it to whatever you want (not all key combinations will work though). Save the file and source ~/.bashrc:

. ~/.bashrc

In the same way you can also change the keyboard shortcut for bookmarking a command (MARKER_KEY_MARK, default keybinding is C-k) and for placing the cursor at the next placeholder (MARKER_KEY_NEXT_PLACEHOLDER, default is C-t).

Now try it out. Open a terminal and use Ctrl + ^ (if you changed the key combination) to open the searchable command palette, or type some command and press Ctrl + k to bookmark it. Type marker remove to remove a saved bookmark.